create a virtual box with kvm on ubuntu 12.04
In this post we shall talk about creating an Ubuntu virtual server on Ubuntu using KVM.
KVM is a full virtualization solution for Linux. It can help setup virtual machines running unmodified Linux or Windows images. All the virtual machines created have their own virtualized hardware. We present below a step by step guide to create your own virtual machine.
Install basic dependencies and kvm.
$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder
If you have any trouble you can look here for reference or troubleshooting.
Install the virtual manager GUI:
sudo apt-get install virt-manager
you can type virt-manager to confirm the installation.
Prepare the image:
Download the Ubuntu Image, i prefer 12.04 LTS precise pangolin. You can choose your desired/compatible version from here.
Extract your image to a safe location, i prefer /var/lib/libvirt/images
Create a snapshot of your ubuntu image by the following command:
sudo qemu-img create -f qcow2 -b precise-server-cloudimg-i386.img
In the above command we are using the open source process emulator qemu, to create a snapshot. -f flag specifies a filename, usage of qcow2 is explained here, and -b flag implies a backing file so that all writes to the virtual disc will go to the newly being created disposable image, not the base copy.
Start the GUI for easy setting up of things.
type virt-manager in your terminal, the later steps have been described with the help of the following presentation.
Once you have finished all the above steps, do an ifconfig, to get the IP Address of the newly created machine. You can then ssh into it ssh ubuntu@IP_ADDRESS and use it for testing or whatever. Here is a guide to best practices using KVM.Previous Post Next Post