Centos6.4 install xen
Install xen
Yum install-y centos-release-xen
Install virtualization management tools
Yum install libvirt python-virtinst libvirt-daemon-xen bridge-utils-y
Restart and run the xen Kernel
Virtual Machine installation environment setup:
1. Configure the bridging Network
[Root @ localhost xen] # cat xend-config.sxp | egrep-v '(^ # | ^ \ * $ )'
(Xend-unix-server yes)
(Xend-relocation-server no)
(Xend-relocation-hosts-allow '^ localhost $ ^ localhost \. localdomain $ ')
(Network-script/bin/true)
(Vif-script vif-bridge)
(Dom0-min-mem 256)
(Enable-dom0-ballooning yes)
(Total_available_memory 0)
(Dom0-cpus 0)
(Vncpasswd '')
To:
[Root @ localhost xen] # cat xend-config.sxp | egrep-v '(^ # | ^ \ * $ )'
(Xend-unix-server yes)
(Xend-relocation-server no)
(Xend-relocation-hosts-allow '^ localhost $ ^ localhost \. localdomain $ ')
(Network-script 'network-bridge = xenbr1 ')
(Network-script/bin/true)
(Vif-script vif-bridge)
(Dom0-min-mem 256)
(Enable-dom0-ballooning yes)
(Total_available_memory 0)
(Dom0-cpus 0)
(Vncpasswd '')
[Root @ localhost xen] #
2. Set server startup
Chkconfig libmongod on
Chkconfig libvirt-guest on
Chkconfig libvirt-guests on
3. After restart:
[Root @ localhost xen] # ifconfig
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: 65536 Metric: 1
RX packets: 928 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 928 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 36599055 (34.9 MiB) TX bytes: 36599055 (34.9 MiB)
Peth0 Link encap: Ethernet HWaddr 08: 00: 27: 63: 01: 87
Inet6 addr: fe80: a00: 27ff: fe63: 187/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 11196 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 6741 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX bytes: 9413252 (8.9 MiB) TX bytes: 851189 (831.2 KiB)
Vif2.0 Link encap: Ethernet HWaddr FE: FF
Inet6 addr: fe80: fcff: ffff: feff: ffff/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 25 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 255 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 32
RX bytes: 1028 (1.0 KiB) TX bytes: 19605 (19.1 KiB)
Virbr0 Link encap: Ethernet HWaddr A2: 81: 98: EC: A4: 44
Inet addr: 192.168.122.1 Bcast: 192.168.122.255 Mask: 255.255.255.0
Up broadcast multicast mtu: 1500 Metric: 1
RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 0 (0.0 B) TX bytes: 0 (0.0 B)
Xenbr1 Link encap: Ethernet HWaddr 08: 00: 27: 63: 01: 87
Inet addr: 192.168.16.253 Bcast: 0.0.0.0 Mask: 255.255.255.0
Inet6 addr: fe80: a00: 27ff: fe63: 187/64 Scope: Link
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 25135 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 26826 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 9837395 (9.3 MiB) TX bytes: 305790710 (291.6 MiB)
4. Install httpd and put the image in html
Yum install httpd
Mkdir/var/www/html/iso
Mount/dev/cdrom1/var/www/html/iso/
Service iptables stop
Service httpd start
Mkdir/xen
Virt-install-n zyt_vm01-r 512 -- disk path =/xen/zyt_vm01.img, size = 6-l http: // 192.168.16.253/iso
Cp:
1. Create an xen virtual machine configuration file
[Root @ localhost xen] # cat xmexample1 | egrep-v '(^ # | ^ \ * $ )'
Kernel = "/boot/vmlinuz-2.6.10-xenU"
Memory = 64
Name = "ExampleDomain"
Vif = ['']
Disk = ['phy: hda1, hda1, W']
Root = "/dev/hda1 ro"
Extra = "4"
[Root @ localhost xen] # cat xmexample1 | egrep-v '(^ # | ^ \ * $)'> zyt_vm02
[Root @ localhost xen] # vi zyt_vm02
[Root @ localhost xen] # cat zyt_vm02
# Kernel = "/boot/vmlinuz-2.6.10-xenU"
Memory = 512
Name = "zyt_vm02"
Vif = ['bridge = xenbr1']
Disk = ['file:/xen/zyt_vm02.img, xvda, W']
# Root = "/dev/hda1 ro"
# Extra = "4"
[Root @ localhost xen] #
2. cp Image
[Root @ localhost ~] # Cd/xen/
[Root @ localhost xen] # ll
Total 1516148
-Rwxr-xr-x. 1 root 6442450944 Mar 6 05:01 zyt_vm01.img
[Root @ localhost xen] # cp zyt_vm01.img zyt_vm02.img
[Root @ localhost xen] #
3. Start a new Virtual Machine
Xm create-c zyt_vm02
4. Modify the mac address and host name after entering
This article is from the "relieved" blog, please be sure to keep this source http://yantaohncz.blog.51cto.com/727950/1618371