centos6.4 安裝xen

來源:互聯網
上載者:User

centos6.4 安裝xen

安裝xen

yum install -y centos-release-xen xen

安裝虛擬化管理工具

yum install libvirt python-virtinst libvirt-daemon-xen bridge-utils -y

重啟,xen核心運行

虛擬機器安裝環境搭建:

1.配置橋接網路

[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 '')

修改為:

[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 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.設定伺服器啟動

chkconfig libvirtd on

chkconfig libvirt-guest on

chkconfig libvirt-guests on

3.重啟後:

[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 txqueuelen:1000

RX bytes:9413252 (8.9 MiB) TX bytes:851189 (831.2 KiB)

vif2.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF: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.安裝httpd,並且把鏡像放到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.建立一個xen虛擬機器組態檔

[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鏡像

[root@localhost ~]# cd /xen/

[root@localhost xen]# ll

total 1516148

-rwxr-xr-x. 1 root root 6442450944 Mar 6 05:01 zyt_vm01.img

[root@localhost xen]# cp zyt_vm01.img zyt_vm02.img

[root@localhost xen]#

3.啟動新的虛擬機器

xm create -c zyt_vm02

4.進入後修改mac地址,主機名稱

本文出自 “釋然” 部落格,請務必保留此出處http://yantaohncz.blog.51cto.com/727950/1618371

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.