4 easy steps of kvm installation in Ubuntu 16.4
KVM stands for Kernel Based Virtual Machine. It's a virtualisation software. kvm provides ability to run a multiple guest operating systems with the help of hardware virtualization extensions.
KVM managed by Virt-Manager (Virtual Machine Manager) it supports creating, editing, starting, and stopping KVM-based virtual machines.
Step 1:
Pre-installation checklist
Check that your CPU supports hardware virtualization
egrep -c '(vmx|svm)' /proc/cpuinfo
If 0 it means that your CPU doesn't support hardware virtualization.
If 1 or more it does - but you still need to make sure that virtualization is enabled in the BIOS.
OR-->
kvm-ok
which may provide an output like this:
INFO: /dev/kvm exists
KVM acceleration can be used
If you see :
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
To see if your processor is 64-bit Or 32-bit, you can run this command:
egrep -c ' lm ' /proc/cpuinfo
If 0 is printed, it means that your CPU is not 64-bit.
If 1 or higher, it is. Note: lm stands for Long Mode which equates to a 64-bit CPU.
Now see if your running kernel is 64-bit, just issue the following command:
uname -m
x86_64 indicates a running 64-bit kernel. If you use see i386, i486, i586 or i686, you're running a 32-bit kernel.
Note: x86_64 is synonymous with amd64.
Step 2
Installation KVM
Install Necessary Packages
apt-get install qemu-kvm qemu bridge-utils virtinst libvirt-bin virt-manager virt-viewer cpu-checker
Step 3
Configure bridged networking
backup interface file :
cp /etc/network/interfaces /etc/network/interfaces.backup
vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 172.17.20.110
netmask 255.255.0.0
gateway 172.17.25.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
Restart the networking service, OR reboot system to take effact enter:
systemctl restart networking
Or
reboot
Check bridge
brctl show
bridge name bridge id STP enabled interfaces
br0 8000.0800279ac61a no enp0s3
Step 4
Create Virtual Machine
In this tutorial i install centos 7 minimal, you can download from “https://mirrors.kernel.org/centos/7.3.1611/isos/x86_64/”
mkdir /iso
wget https://mirrors.kernel.org/centos/7.3.1611/isos/x86_64/CentOS-7-x86_64-Minimal-1611.iso
CREATE CENTOS 7 VM
Method - 1 : Terminal Mode:
In this example, I’m creating CentOS 7 VM with 1GB RAM, 1 CPU core, 1 nics and 16 GB disk space, enter:
virt-install --name=CentOS7 --ram=1024 --vcpus=1 --cdrom=/iso/CentOS-7-x86_64-Minimal-1611.iso --os-type=linux --os-variant=rhel7 --network bridge=br0 --graphics=spice --disk path=/var/lib/libvirt/images/centos7-minimal.qcow2,size=16
--name – Name of the Virtual machine
--ram – Memory size in MB
--vcpus – Virtual cpu’s in numbers
--cdrom – Location of the ISO image
--os-type – OS type like Linux, Windows and Unix
--os-variant – OS variant like rhel 6, solaris, windows
--network – networking
--graphics – display settings
--disk path – image store location of the disk with size of 16 GB
A new virt-viewer window will be open,Now you can install your centos
Method -2 : Graphical Mode:
Type the following command in terminal in GUI mode.
virt-manager
1. Press “Create a new virtual machine” icon - new window will open
Here i choose "Local Install Media ( ISO image or CD-ROM ). & Press “Forward”
2. Locate your install media :
Press Browse Button → Browse Local → Select path of ISO file
Press “Forward”
3. Choose memory & cpu
here i set 1GB ram and 1 Core & Press “Forward”
4. Create disk image/volume for virtual machine
Here i set 16GB disk Space for VM & Press “Forward”
5. Ready to be install
Type os name - < any name > & Press “Finish”
6. a new window will open for installation of os
Enjoy !
Leave a Comment