KVM is an Open-Source Virtual Machine Monitor. It leverages hardware extensions available for virtualization, to provide a FAST! virtual environment.
Installing KVM on your machine:
Does your Machine has hardware extension for virtualization?
Check if following command produces any output, if not then your machine doesn't has the required extension:
cat /proc/cpuinfo | grep -i vmx
Installing KVM from source:
Cheers,
Installing KVM from source:
- Install some required packages. On Ubuntu, issue following command :
sudo apt-get install build-essential libsdl1.2-dev zlib1g-dev libasound2-dev pkg-config libgnutls-dev libpci-dev
- Download latest qemu-kvm from http://sourceforge.net/projects/kvm/files/
- Extract it in a directory, say ~/kvm
- cd to above directory and issue following commands:
- ./configure --prefix=/usr/local/kvm (Install kvm in /usr/local/kvm)
- make
- sudo make install
Installing and running a guest Operating System using KVM:
Installing a new Guest OS:
- To start KVM:sudo modprobe kvm-intel (or sudo modprobe kvm-amd if on an AMD box). If this fails, look for last few lines in output of dmesg | tail - if virtual extension are disabled from boot, enable them from boot options.
- To create a new virtual disk (on which guest OS will be installed):/usr/local/kvm/bin/qemu-img create -f qcow2 ubuntu1.img 20GThis creates a disk (which is just a file on your actual hard disk) called ubuntu1.img, that can expand to a size of 20GB.
- To install a new OS in the virtual disk create:sudo /usr/local/kvm/bin/qemu-system-x86_64 -hda /path/to/virtual/disk -cdrom /path/to/iso/of/os/to/be/installed -boot d -m 512
This starts the installation of guest OS.
- To run a guest OS:
sudo /usr/local/kvm/bin/qemu-system-x86_64 -drive cache=writeback,file=/path/to/virtual/disk -m 512 -soundhw es1370
This starts a virtual machine with 512 MB of RAM and with sound support. There are many more options available here, such as configuring guest OS's network etc.
Additional Information:
- Under KVM, each guest OS is just a user process running in Linux. Thus one use any command used on a process, such as killing using ctrl-c, stopping using ctrl-z etc.
- Around 256 MB of RAM is enough to run a Linux guest OS.
- There are multiple networking options available - one can assign a separate IP address to each of virtual machine and make them accessible to each other and the host. You can use such an arrangement for various experiments.
Cheers,
Nipun
awesome
ReplyDeleteNice topics with good information, looking forward for more
ReplyDeletenice blog and good inforation
ReplyDeleteWe manufacturesTablet Press, Tablet Press machine, Rotary Tablet Press, Pharmaceutical machinery, Tablet Dies and Punches.