We want to give an example about installing an operating system in a virtual machine created with QEMU/KVM. We will install Ubuntu 16.04 as guest on top of Ubuntu 16.04 as host. The GUI displayed by Virtual Machine manager (virt-manager). There are only 5 steps to prepare the virtual machine, after that the 6th step is the guest OS installation. This article is a continuation of our previous tutorial about installing QEMU/KVM and virt-manager in Ubuntu.
- Our hardware specification is Intel Celeron 1.8 GHz 32 bit, 2 GB RAM, 12 GB free space.
- We want to install Ubuntu 16.04 Xenial Xerus 32 bit inside a QEMU/KVM virtual machine.
- Tools used in this tutorial are KVM as the hypervisor (kernel-space), QEMU as the machine emulator (user-space), and Virtual Machine Manager (virt-manager) as the display GUI.
- You better place the ISO image in the same partition as your $HOME partition. For example, we have /home/master/Downloads directory, and we put the ISO there. We don't put it in another partition to avoid any error.
- If you have not installed the tools needed, follow our previous tutorial about installing QEMU/KVM.
1. Add New VM
First step, press A New Virtual Machine button. This invokes a new window. Select Choose how: Local install media then select Architecture: i686. Press Forward button.
2. Add Ubuntu ISO
Second step, locate the ISO image of Ubuntu operating system you want to install. See picture below: (1) press Browse button (2) select directory source (3) select the ISO (4) press Choose Volume button. Remember that it is better if the ISO file is in the same partition as your $HOME directory.
3. Add RAM and CPU Amounts
Third step, adding virtual memory and CPU amounts. We choose 700 MB ram and 1 cpu. This depends on your own hardware capability. It is better to give the guest OS appropriate RAM but leave the host OS handles the most. It is better to don't give guest OS more than half of your total RAM. You may choose more or less. Press Forward button.
4. Add Virtual Disk Storage
Fourth step, create new or select already prepared virtual storage (virtual hard disk). If this is your first time to use KVM, press Manage button then follow the next picture.
A new window Choose Storage Volume appears. See picture below: (1) press green plus button then Add a Storage Volume window appears (2) choose the name for the virtual disk storage (3) set the storage size (4) press Finish button (5) select the generic.qcow file just created and press Choose Volume button.
Note: for (2) let it be default is enough; for (3) give it at least 4 GiB for Ubuntu Desktop; for (4) make sure you create the qcow2 file inside your $HOME partition not in another partition.
5. Creating Virtual Machine
Fifth step, you give the name for your virtual machine. For example, we name it Xenial because it runs Ubuntu Xenial Xerus. Select NAT for the Network selection option.
While pressing Finish button, a small dialog appears indicating a progress of creating virtual machine.
6. Boot Ubuntu Operating System
After the fifth step, you should find Virtual Machine Manager with QEMU/KVM runs your Ubuntu as virtual OS. See the title bar "Xenial on QEMU/KVM" indicating it is a virtual machine named Xenial running in QEMU/KVM virtualization solution. You find this as Ubuntu OS running another Ubuntu OS. Xenial running Xenial. In this picture, it shows the first step of Ubuntu installation.
You may go though all steps off Ubuntu installer (Ubiquity) and don't hesitate to format the whole disk because from the virtual machine point of view, the disk is the hard disk but from the host OS point of view, it is only a file. Formatting the disk inside this virtual machine is only affecting the .qcow2 file you create before. So do installation without hesitation.