CentOS system KVM QEMU virtual machine installation Configuration Tutorial

Source: Internet
Author: User
Tags centos

Second, install and configure KVM

The code is as follows Copy Code

# yum-y Install KVM python-virtinst libvirt bridge-utils\
Virt-manager qemu-kvm-tools virt-viewer virt-v2v QEMU-KVM tunctl

[root@localhost ~] #vim/etc/sysconfig/selinux//Close SELinux

Selinux=disabled

[Root@localhost ~] #reboot

[Root@localhost ~]# Cat/etc/redhat-release
CentOS Release 6.5 (Final)//centos 6.5

Third, start LIBVIRTD

The code is as follows Copy Code
[Root@localhost ~]#/ETC/INIT.D/LIBVIRTD Start/

[Root@localhost ~]# ps-e|grep LIBVIRTD//See whether to start
19458? 00:00:01 LIBVIRTD

Four, check that the KVM module is loaded correctly

The code is as follows Copy Code
[Root@localhost ~]# lsmod |grep KVM
Kvm_intel 54285 0
KVM 333172 1 Kvm_intel

Five, configure network bridging

  code is as follows copy code
[root@localhost network-scripts]# cat Ifcfg-eth0 |awk ' {if" $!~/^$/&& $! ~/^#/) {print $}} '  
device=eth0 
type=ethernet 
onboot=yes 
bootproto=none  ;
bridge=br0 
ipv6init=no 
hwaddr=f8:bc:12:60:99:86 
 
[root@localhost network-scripts]# cat Ifcfg-br0 |awk ' {if ($!~/^$/&& $!~/^#/) {print $}} '  
device=br0 
type=bridge 
onboot=yes 
bootproto=static 
ipaddr=192.168.10.103 
GATEWAY= 192.168.10.1 
netmask=255.255.255.0 
dns1=192.168.10.1 
ipv6init=no 
DELAY=0& nbsp

Reboot the network and find the following error:

[Root@localhost network-scripts]#/etc/init.d/network start
Pop-up loopback interface: [OK]
Pop-up interface eth0: Error: Failed to activate connection: Master connection not found or invalid
Failed
Pop-up interface br0: Error: Activating connection failed: Failed to determine connection ' virtual interface name
Failed
Rtnetlink Answers:file exists
Rtnetlink Answers:file exists
Rtnetlink Answers:file exists
Solution:

[root@localhost rules.d]# service NetworkManager Stop//This closes off on the line
Stop NetworkManager daemon: [OK]

[Root@localhost rules.d]# Service Network restart
Shutting down interface br0: [OK]
Shutting down interface eth0: [OK]
Close Loopback interface: [OK]
Pop-up loopback interface: [OK]
Pop-up interface eth0: [OK]
Pop-up interface br0:determining If IP address 192.168.10.103 be already in with for device br0 ...
Determine
If the following describes the successful configuration:

[Root@localhost network-scripts]# Ifconfig
Br0 Link encap:ethernet hwaddr f8:bc:12:60:99:86//have this OK
inet addr:192.168.10.103 bcast:192.168.10.255 mask:255.255.255.0
Inet6 ADDR:FE80::FABC:12FF:FE60:9986/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:36416 errors:0 dropped:0 overruns:0 frame:0
TX packets:28648 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13151508 (12.5 mib) TX bytes:5962449 (5.6 MIB)

Eth0 Link encap:ethernet hwaddr f8:bc:12:60:99:86
Inet6 ADDR:FE80::FABC:12FF:FE60:9986/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:1360857 errors:0 dropped:0 overruns:0 frame:0
TX packets:902173 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1913592871 (1.7 GiB) TX bytes:72387220 (69.0 MiB)

Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up loopback RUNNING mtu:16436 metric:1
RX packets:176842 errors:0 dropped:0 overruns:0 frame:0
TX packets:176842 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:880282316 (839.5 MiB) TX bytes:880282316 (839.5 MiB)

Virbr0 Link encap:ethernet hwaddr 52:54:00:1a:b6:f1
inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0  (0.0 b) TX bytes:4651 (4.5 KiB)

[Root@localhost network-scripts]# Brctl Show
Bridge name Bridge ID STP enabled interfaces
Br0 8000.f8bc12609986 No eth0//This is OK
Virbr0 8000.5254001ab6f1 Yes Virbr0-nic
VI, generate an. img file with Virt-install

The code is as follows Copy Code
# Virt-install--name=ubuntu1\
--ram 1024--vcpus=1\
--disk path=/root/ubuntu1.img,size=10\
--accelerate--cdrom/root/ubuntu-14.04-desktop-amd64.iso\
--graphics vnc,port=5920--network Bridge=br0

If you report the following error:
Could not open disk Image:permission denied


Workaround:

[Root@localhost ~]# cat/etc/libvirt/qemu.conf |awk ' {if ($!~/^$/&& $!~/^#/) {print $}} '
Vnc_listen = "0.0.0.0"
user = "root"//Remove Comment
Group = "root"//Remove Comment
dynamic_ownership = 0//Remove comment, change 1 to 0
This step is done, the system file is good.
Seven, start the virtual machine
If you report the following error
[Root@localhost ~]# Virsh start UBUNTU1
Error: Domain is active

Solution:

[Root@localhost ~]# Pkill QEMU-KVM

[Root@localhost ~]# Virsh start UBUNTU1
Domain UBUNTU1 already started

[Root@localhost ~]# virt-viewer ubuntu1/Enter graphical interface

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.