Install KVM and create a kvm vm in CentOS 6.3
Install KVM and create a kvm vm in CentOS 6.3
1. Install kvm
1. You can choose to install kvm when installing CentOS 6.3.
2. If kvm is not installed, install it as follows:
[Create local yum]
Mount the iso file to the directory
Mount-o loop-t iso9660 CentOS-6.3-x86_64-bin-DVD1.iso/mnt
Set local yum Source
Create the "any file name. repo" file in/etc/yum. repos./d.
Vi editing
[Localyum] Any name with no space.
Name = local yum any name
Baseurl = file: // mnt/Packages. Server is the Server directory in the CD, and Packages and Server are placed in the same directory. Under the/software Directory
Enabled = 1 indicates that 0 is invalid.
Gpgcheck = 1 Check that gpgkey 1 takes effect 0 does not take effect
Gpgkey = file: // when this file is not specified in the software installation CD, you may be prompted not to register
Save and exit
Execute Command yum clean all (1) kvm requires CPU support (Intel VT or amd svm)
[Root @ moniter ~] # Egrep '^ flags. * (vmx | svm)'/proc/cpuinfo
(2) install kvm libvirted
Yum install kvm kmod-kvm qemu kvm-qemu-img virt-viewer virt-manager libvirt-python-kernel Inst
Yum groupinstall KVM
(3) Start libvirted
Service messagebus start
Service haldaemon start
Service libmongod start
Chkconfig messagebus on
Chkconfig haldaemon on
Chkconfig libmongod on
(4) monitor whether kvm is successfully installed
[Root @ moniter ~] # Virsh-c qemu: // system list
Id Name State
----------------------------------
(5) kvm Module
/Sbin/lsmod | grep kvm
RHEL6 KVM virtualization creates a bridge NIC-Bridge
RedHat Linux KVM Virtual Machine bridging
Installation/bridging settings of KVM in CentOS 5.6/virtual machine creation and operation
The/bin/qemu-KVM problem cannot be found when the kvm virtual machine is installed with libvirt In Ubuntu.
2. Configure the bridge
Vi/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE = br0
TYPE = Bridge
BOOTPROTO = static
BROADCAST = 10.207.255.255
IPADDR = 10.207.20.200
NETMASK = 255.255.255.0
NETWORK = 10.207.20.0
ONBOOT = yes
B,
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
# Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
DEVICE = eth0
BOOTPROTO = none
ONBOOT = yes
BRIDGE = br0
C,
Restart the network service to take effect
Service network restart
D,
Echo 1>/proc/sys/net/ipv4/ip_forward # VM access
E,
Check bridging Network
[Root @ moniter ~] # Brctl show
Bridge name bridge id STP enabled interfaces
Br0 8000.842b2b74e1b6 no eth0
Virbr0 8000.000000000000 yes
Br0 is the configured bridging network card, and virbr0 is the NAT network card automatically configured by the system script.
3. Install vnc
Note: CentOS6.3 VNC is named as tiggervnc-server.
(1)
Yum install tiggervnc-server
(2)
Vi/etc/sysconfig/vncservers
# Add a row
VNCSERVERS = "1: root"
(3)
Vncpasswd
Create Password
(4)
/Etc/init. d/vncserver start
(5)
# Netstat-nulpt | grep vnc
Tcp 0 0 0.0.0.0: 5901 0.0.0.0: * LISTEN 29167/Xvnc
Tcp 0 0 0.0.0.0: 6001 0.0.0.0: * LISTEN 29167/Xvnc
Tcp 0 0: 6001: * LISTEN 29167/Xvnc
Indicates that vnc can be used.
For more details, please continue to read the highlights on the next page: