Saturday, September 21, 2019

virt-install Using Open vSwitch Bridge in KVM

When creating VM with virt-install and attach bridge network using command:

--network=bridge=ovs-br0,model=virtio
if ovs-br0 is an openvswitch bridge network, this will fail:

ERROR    Unable to add bridge ovs-br0 port vnet0: Operation not supported
To fix thi, add virtualport_type=openvswitch :

--network=bridge=ovs-br1,model=virtio,virtualport_type=openvswitch

Friday, September 20, 2019

Install and Configure KVM on CentOS 7

Check Virtualization Technology (VT) is enabled in the BIOS:


# lscpu | grep Virtualization
Virtualization:        VT-x
Install KVM and other software:


# yum install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install

Start and enable the service:

# systemctl enable libvirtd
# systemctl start libvirtd
Configure bridge network: consider using openvswitch (search in this blog) Create VM:

virt-install \
--virt-type=kvm \
--name centos7 \
--ram 4096 \
--vcpus=2 \
--os-variant=centos7.0 \
--cdrom=/var/lib/libvirt/boot/CentOS-7-x86_64-Minimal-1908.iso \
--network=bridge=ovs-br0,model=virtio \
--network=bridge=ovs-br1,model=virtio \
--graphics vnc \
--disk path=/var/lib/libvirt/images/centos7-min.qcow2,size=20,bus=virtio,format=qcow2
This will create a VM with two network interface.

Monday, August 19, 2019

Set Up Go Programming Environment for Mac OS X

To start programming with Go programming language, we need to install it, there are many ways to install go, for Mac OS user there is an easy way to install it, using Homebrew.

But, we need to install Xcode first, after that we can type the following command to install Golang using Homebrew:

NodeJS Boot Camp in Jakarta

Boot Camp AirPutih Jakarta

In this bootcamp, we will learn and practice how to build web application using NodeJS, including:

Tuesday, August 13, 2019

Lesson 1 - GIT - Version Control System

This is the first lesson in the study group, git is very important tool for someone who want to develop software.

Let say, you want to develop a software, but you don't do it yourself, you do it with your friends, so how you will manage your code?, share it with your friends?, and collaborate with your team?

It is hard if you don't have tools to help you to do that, and one of the tools to help you collaborate with your team to write code is Git.

Sunday, August 11, 2019

Building Web Application Using Laravel - a Study Group

In this article series I want to talk about Laravel, actually I use this material to teach a study group to start writing code and build web application using Laravel framework.

They are all beginners, so the material will walk through very basic and step by step to build Laravel web application.

Wednesday, July 10, 2019

Install Open vSwitch on CentOS 7

At the time of writing, I couldn't find any Open vSwitch package for CentOS 7, but there is an Open vSwitch package on OpenStack, so I try to use this package to install Open vSwitch on CentOS 7:

# yum update
# yum install centos-release-openstack-queens
# yum install openvswitch
# systemctl enable openvswitch
# systemctl start openvswitch
# systemctl status openvswitch
# ovs-vsctl show
Edit interface configuration:

# vim /etc/sysconfig/network-scripts/ifcfg-eno1

TYPE=Ethernet
NAME=eno1
UUID=65cf8a92-1734-43ac-9abf-6dd0f41463b0
DEVICE=eno1
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=ovs-br1
ONBOOT=yes

# vim /etc/sysconfig/network-scripts/ifcfg-ovs-br0

DEVICE=ovs-br0
DEVICETYPE=ovs
TYPE=OVSBridge
BOOTPROTO=static
IPADDR=192.168.1.5
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes

Finish, now restart network service:

# systemctl restart network

Wednesday, June 19, 2019

Install and Configure KVM on Ubuntu 18.04

We can use VirtualBox or KVM on Ubuntu to do virtualization, we often use virtual machine for development, not necessarily on a server, we can use KVM on Ubuntu Desktop.

To setup KVM on Ubuntu 18.04, perform the following steps:

Nested Virtualization KVM on CentOS 7

Nested Virtualization is disabled by default on CentOS 7, we can verify by running a command:


# cat /sys/module/kvm_intel/parameters/nested

Make sure KVM is intalled on the machine, if output is N, then Nested Virtualization is disabled, to enable the feature, set options kvm-intel nested=1 in /etc/modprobe.d/kvm-nested.conf


# echo "options kvm-intel nested=1" > /etc/modprobe.d/kvm-nested.conf

Reboot the machine, and verify like above command.
On the xml configuration, ensure cpu mode is host-passthrough


To use nested virtualization, the host CPU must have the necessary feature flags: For Intel - vmx (Hardware Virtualization) and ept (Extended Page Tables) For AMD - svm (equivalent to vmx) and npt (equivalent to ept) Check that flag on /proc/cpuinfo

Tuesday, March 26, 2019

Delete All Comments in a File With VS Code

What if you want to delete all comments in a file with VS Code? VS Code has a find and replace feature that support regular expression, so we can use that feature to automatically find line starting with hash (#), Here we go: 1. Press ctrl + f 2. Click on "Use regular expression" button on "find and replace" widget 3. Type the regular expression: ^#.*$\n 4. Leave the "Replace" field empty 5. Click "Replace All" button And all of your comment deleted, actually it is replaced by the empty character. Notes ^#.*$\n : • ^ = matches position just before the first character of the string • # = character that we want to find • . = matches a single character. Does not matter what character it is, except newline • * = matches preceding match zero or more times • $ = matches position just after the last character of the string • \n = Line feed character

7 GNU Screen Commands To Make Your Life Easier

Here 7 GNU Screen commands that could make your life easier:

* ^A ^W - window list
* ^A ^C - create new window
* ^A space - next window
* ^A p - previous window
* ^A ^A - switch to previous screen
* ^A [0-9] - go to window [0-9]
* ^A esc - copy mode