Installing qemu with kvm and virt-manager

I have used Oracle Virtualbox before. It has an easy and intuitive UI, supports all the features I needed and is open-source. But this time I decided to use another widely recognized virtualization solution on Linux, qemu, along with kvm.

First of all, let me give some brief idea about qemu, virt-manager and kvm. Qemu is the software which can be used to install and run a guest OS on top of the actual OS to put it in a very simple way although it’s much more powerful than that. It can be compared to Virtualbox except that qemu itself does not have a UI, instead it’s a command line utility. Virt-manager is some thing that provides a GUI to qemu. Together virt-manager and qemu can be thought of as the Virtualbox. On the other hand, kvm is the Linux kernel module that can help qemu execute the virtualized instructions directly on the CPU which can improve the performance greatly. This is to be kept in mind that qemu can run even without kvm but the speed will be much slower.

The system that I have comprises of an AMD Fx6300 processor with 6 cores and AMD-V capability and 4 gigs of RAM. AMD-V is similar to Intel vt-x and it enhances the virtualization capability of a processor. I am running Xubuntu 14.04 as my main OS with Linux kernel 3.19.0-56 64 bit at the time of writing.

First of all, I needed to enable the AMD-V from the BIOS menu to take full advantage of the processor. For my system, the option could be found in BIOS Settings > Advanced BIOS Features > Virtualization. I just had to enable the flag. After that, I restarted the system and logged into my computer. I installed the following packages:

 sudo apt-get install qemu virt-manager virt-viewer libvirt-bin 

I didn’t install the qemu-kvm package as this package is not needed for a x86_64 hardware. After I restarted the system, I launched the Virtual Machine Manager and it looked like this.

Screenshot - Wednesday 30 March 2016 - 09:00:40 IST

Next few screenshots quickly show the steps of creating and launching a new VM where I had to provide a name for the VM, select the installation CD image and specify the amount of RAM, number of cores and the size of the hard disk image for the virtual machine.

Screenshot - Wednesday 30 March 2016 - 09:01:08 IST
Screenshot - Wednesday 30 March 2016 - 09:06:36 IST
Screenshot - Wednesday 30 March 2016 - 09:06:56 IST
Screenshot - Wednesday 30 March 2016 - 09:08:24 IST
Screenshot - Wednesday 30 March 2016 - 09:09:05 IST

I selected the Virt type as kvm to take advantage of the virtualization capabilities of the Linux kernel. After clicking on the Finish button, the VM is launched with the selected ISO image in the second step. Well that’s about it. Pretty easy, I would say!

The advantage of using qemu + kvm over Virtualbox is that it does not require me to install any additional module in the kernel. I haven’t taken any benchmark of the performance though. If you have any suggestion/correction please let me know in the comments.

Advertisements

I am a software engineer, an open-source enthusiast and a hobbyist blogger.

Tagged with: , , , , , , , , ,
Posted in HowTos, Ubuntu
One comment on “Installing qemu with kvm and virt-manager
  1. sipsmi says:

    Nice intro…

    Probably worth mentioning, if you want to expose this to the rest of your network you may want to consider bridge not NAT network.

    Also well worth using logical volume manager volumes for your storage so you can snapshot etc.

    Of course if your guests are Linux then lxc is a lightweight alternative 😃

    Si

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: