KVM Virtualization

Kernel-based Virtual Machine (KVM) is a popular virtualization solution supported by modern Linux kernels. It takes advantage of the CPU support for virtualization (Intel VT and AMD-V). You can run unmodified operating systems such as Linux, FreeBSD, and Microsoft Windows using KVM. For more information, see the compatibility list.

For our Ubuntu 16.04 host, we have installed the following packages via apt (see https://help.ubuntu.com/lts/serverguide/libvirt.html):

  • libvirt-bin
  • qemu-kvm
  • virt-manager
  • virtinst
  • virt-viewer

For a CentOS 7 host, install the following packages via yum:

  • libvirt
  • qemu-kvm
  • qemu-img
  • virt-install
  • virt-manager
  • virt-client

For other Linux distributions, refer to their respective manuals.

You can create virtual machines using the command line as long as you have installed the proper packages. For example, the following creates a CentOS 7 guest with 2 virtual CPUs and 4GiB of RAM:

virt-install -n centos-test \
        --ram 4096 \
        --vcpus 2 \
        --metadata description='CentOS – test',title='CentOS - test' \
        --cdrom /usr/local/src/dists/CentOS/7/CentOS-7-x86_64-Everything-1511.iso \
        --os-variant centos7.0 \
        --disk path=/var/lib/libvirt/images/centos-test-storage0.qcow2,size=40,format=qcow2 \
        --network bridge=br0,model=virtio \
        --graphics spice

If you want to have a processor topology of 2 sockets and 2 cores each, you can specify that as:

        ....
        --vcpus sockets=2,cores=2
        ....

Verification of the processor topology can be done using the utility lscpu, part of util-linux.

The --cdrom parameter points to the installation disc image and the --disk parameter points to the final installed OS image. In this example, we also specify the use of a bridge (the network device br0 in this case) to make it appear on the local host’s network as a regular host. The parameter --graphics specifies Spice as the means of connecting to the VM console.

Naturally, you can also use a GUI (virt-manager) to create the VM, but the command line is more fun, isn’t it? 😉 The man page for virt-install has the requisite information on how to use it. More examples are also available in the man page.

 

Happy Birthday, Linux!

We wish Linux a happy 20th birthday. Knowing that Linux is alive, well, and unbound, we celebrate this year with The Linux Foundation. Thanks to Linus Torvalds, computing has changed for the better.

It’s nice to know that we have an alternative operating system which has proven to be scalable, reliable, innovative and even fun!  We are pleased to see that Linux is welcome in organizations and business entities.  I wonder what more can we expect from Linux in the next decade.

The Linux ecosystem is very much alive and thriving.  A lot of companies are now building products and services on top of Linux.  Companies like IBM, Intel, HP, Oracle, etc. now have Linux as one of their platforms for building new products and services.  Many application domains are using Linux as a computing platform.  RedHat and Canonical have been built and are successful in the Linux ecosystem.

As for us users, we benefit from the Linux ecosystem because we have a good alternative to proprietary products and solutions.  Linux is technically sound and has been ready for various applications.

There is still room to grow.  Desktop Linux is slowly picking up but needs more momentum.  User-friendliness is improving with the use of desktop interfaces such as Gnome and KDE.  Video cards need more support and solutions from hardware vendors who make device drivers.

Well, it’s good to know that Linux has made it and that its future looks bright. Even Microsoft is beginning to notice.