How to install KVM virtual machine on CentOS6.4 system

Install KVM virtual machine on CentOS6.4 system

Remarks: The following operating instructions are transcripts summarized after experimental verification. Friends in need can refer to them. The following are based on theVMware12.5.2 virtual machine The experimental environment installed on the version.

一、InstallKVM

1. KVM requires a CPU Support (Intel VT or AMD SVM). Enter the command: egrep ‘^flags.*(vmx|svm)’ /proc/cupinfo, the following display: svm, it can be seen that the CPU model of my computer is AMD.

Share pictures

2. installkvm libvirted, enter the command:< /span>yum install kvm kmod-kvm qemu kvm-qemu-img virt-viewer virt- manager libvirt libvirt-python python-virtinst

share picture

share picture

< p>3. Startlibvirted

input command:

service messagebus start

service haldaemon start

service libvirtd start

chkconfig messagebus on

chkconfig haldaemon on

< p>chkconfig libvirtd on

Share pictures

4. Check if kvmis installed successfully, enter the command:virsh -c qemu:// /system list. Check if the kvm module is installed successfully, enter the command:/sbin/lsmod | grep kvm

share picture

Second, Configure the bridge

1. Enter the command:

vi /etc/sysconfig/network-scripts/ifcfg- br0

a、

DEVICE=br0

TYPE=Bridge

BOOTPROTO=static

BROADCAST=192.168.xxx< /span>.255

IPADDR=192.168.xxx .1

NETMASK=255.255.255.0

NETWORK=192.168.< span style="color: #ff0000;">xxx.0

ONBOOT=yes< /p>

share picture

< span style="font-size: 16px;">b,

vi /etc/sysconfig/network-scripts/ifcfg- eth0

DEVICE=eth0

BOOTPROTO=dhcp

ONBOOT=yes

BRIDGE=br0

Share a picture< /p>

2. restart the network service to take effect
service network restart

3. Enter the command:echo 1> /proc/sys/net/ipv4/ip_forward #Internet access on the virtual machine span>

4. Check the bridged network
[[email protected] ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.842b2b74e1b6 8000.842b2b74e1b6 No eth0
virbr0 pan style=”font-size: 16px;”> 8000.000000> 8000. -size: 16px;”>br0is the bridged network card we configured,virbr0 is automatically configured by the system scriptNATNetwork Card

Three, InstallVNC
(1). input command:
yum install tiggervnc-server

Share a picture

share picture

View

span>vncInstallation input command:

rpm -q vnc tigervnc-server

Display successful installation

span>

package vnc is not installed

tigervnc-server-1.1.0-8.el6_5.x86_64

share picture

(2). input command:
vi /etc/sysconfig/vncservers
#Add one line
VNCSERVERS=”1:root”

Share a picture

< span style="font-size: 16px;">(3). input command:
vncpasswd
Create a password:123456 span>

share picture

(4). input command:
/etc/init.d/vncserver start

Share a picture

(5). input command:
# netstat -nulpt | grep vnc
tcp 0 0.0.0.0:5901 0.0.0.0:* pan Xpan 167/ nc LIST
tcp 0 0.0.0.0:6001 0.0.0.0: * * * * * * * * * * * * * * * * * * * * * * * * * LISTEN. *. ;”>tcp 0 :::6001 0 :::6001 song LISTEN LISTEN style; 29167/Xvnc
It is ready to use

Share the picture

Four. CreateKVMVirtual Machine
#virsh-install
1, enter the virtual machine name span>
2, how much memory is allocated
3, the number of processors
4, this step can be entered directlyiso The location orurl
5, virtual machine typeKVM< /span>
6, define the location of the virtual machine disk image< br> 7, the size of the disk

6, which bridge to specify or multiple bridges can be specified
7, additional console andKSFile
8, connect to the system Parameter
Parameter description Note that each line must have a space
-n Virtual machine name
< span style="font-size: 16px;">-r Allocation of virtual machine memory size
–vcpus Assign virtualcpuNumber
-c Mirror file location< /span>
–vnc –vncport=5901 –vnclisten=0.0.0.0 Launch the graphical installation interface
–virt-type Virtual machine mode
-f Virtual machine system file storage directory< /span>
-s allocate disk size (GB)
-w Networking (birdge bridge:br0/nat bridge:virbr0)
–os-type=’windows’ –os-variant=win2k3 InstallationwindowsThe most If you add this, it will report an error
virt -installAfter the tool installs the virtual machine, in the directory/etc/libvirt/qemu/Generate belowxmlConfiguration file
-s Used to specify the size unit of the virtual disk ForGB
-m Specify the hardware address of the virtual network card by defaultvirt-installAutomatically generate
-p Create virtual Machine
-l specify installation source
-x EXTRA, –extra-args=EXTRAWhen executing from“–location”The option to specify the location of the client installation, attach Add kernel command line parameters to the installer.
-v, –hvm Set up full virtualization
virt-install –name=centos6.3 –ram 1024 –vcpus=2 –disk path=/data0/centos- 6.3.x86_64.img.img,size=20–accelerate –cdrom /data0/CentOS-6.3-x86_64-bin-DVD1.iso–graphics vnc,listen=0.0.0.0,port=5920,–network bridge =br0 –force –autostart
After execution,netstat- nulpt | grep 5920 See if the port is enabled

Five ,KVMVirtual machine configuration

1. Created with the default wizardKVMVirtual machine, the disk file location cannot be modified. You can use the following command to create a disk file first

qemu-img create -f qcow2 win7.img 700G

inhome/vpsdirectory, create a virtual machine disk file

Share a picture

2. UseVirtual Machine ManagerCreate a virtual machine system< /span>

share picture

Share a picture

Share a picture

Find the system disk to be installed from the hard disk Mirror, for examplewin7.iso

share picture

share picture

p>

Here, be sure to select Customeize configuration before install < span style="font-family: 宋体;">, do the final customization before installation

Note: Need to modify< /span>2A place

a.add aInputdevice (EvTouch USB Graphics Tablet) (Many articles on the Internet are for introductionvi To modify the configuration file, I don’t recommend you to do that. It’s very troublesome. And the effect of my experiment is not so good! ),If you don’t add this device, you are inVNCIn the environment, you will find that the mouse is very awkward and will run around!

share picture< /p>

b.Add one

span>Graphics device, and set the defaultDisplay VNC Delete (because the defaultVNC< /span>Monitor only127.0.0.1)

share picture

share picture

Share a picture

So far, the key parts are all configured. Start the virtual machine and check VNC Port number

The default port is 5900

Share a picture

Share a picture

OK That’s it! OurKVMvirtual machine has been successfully installed and is inKVM< span style="font-family: 宋体;">Uploaded successfullyWIN7 GHOST. Next how to installWIN7I think everyone should be very familiar with the system, ( If not, you can refer to the installation on a certain degree by yourselfWIN7operating system steps) Don’t waste time here, I wish you all a happy weekend!

Leave a Comment

Your email address will not be published.