Virtualization With KVM On CentOS 6
Virtualization With KVM On CentOS 6
7 Server
1 Preliminary Setup
vim /etc/selinux/config
Set SELINUX=disabled...
And reboot
2 Installing KVM
First check if youre CPU supports hardware virtualization - if this is the case, the command
egrep '(vmx|svm)' --color=always /proc/cpuinfo
To install KVM and virtinst (a tool to create virtual machines), we have to run
yum install kvm libvirt python-virtinst qemu-kvm
service libvirtd start
We need to set up a network bridge on our server so that our virtual machines can be accessed
from other hosts as if they were physical systems in the network.
yum install bridge-utils
Create the file /etc/sysconfig/network-scripts/ifcfg-br0
(please
use
the IPADDR, PREFIX, GATEWAY,
the /etc/sysconfig/network-scripts/ifcfg-eth0 file)
make sure you use TYPE=Bridge, notTYPE=Ethernet:
from
vim /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE="br0"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.30.xx
PREFIX=24
GATEWAY=192.168.30.1
DNS1=192.168.30.1
DNS2=192.168.30.5
DEFROUTE=yes
IPV6INIT=no
NAME="System br0"
Then Modify /etc/sysconfig/network-scripts/ifcfg-eth0 as follows (comment
out BOOTPROTO, IPADDR, PREFIX, GATEWAY, DNS1, andDNS2 and add BRIDGE=br0):
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
#BOOTPROTO=none
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE="Ethernet"
HWADDR=XXXXXXXXXXXX
#IPADDR=192.168.30.xx
#PREFIX=24
#GATEWAY=192.168.20.1
DNS1=192.168.30.1
DNS2=192.168.30.5
DEFROUTE=yes
IPV6INIT=no
NAME="System eth0"
BRIDGE=br0
then enter
service network restart
and run
ifconfig