#####################################################
##如有轉載,請務必保留本文連結及版權資訊
##歡迎廣大運維同仁一起交流linux/unix網站運維技術!
##QQ:335623998
##E-mail:[email protected]
##部落格: http://dreamway.blog.51cto.com/
##weibo:http://weibo.com/zhaixiangpan
《Cobbler部署指南》系列
1、《Cobbler部署指南之安裝篇》http://dreamway.blog.51cto.com/blog/1281816/1166589
2、《Cobbler部署指南之配置管理篇[上文]》http://dreamway.blog.51cto.com/blog/1281816/1166921
3、《Cobbler部署指南之配置管理篇[下文]》http://dreamway.blog.51cto.com/blog/1281816/1166932
4、《Cobbler部署指南之yum倉庫配置管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166936
5、《Cobbler部署指南之Cobbler安裝作業系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166947
6、《Cobbler部署指南之安裝虛拟化Xen系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166950
7、《Cobbler部署指南之電源管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166957
8、《Cobbler部署指南之FAQ處理篇》http://dreamway.blog.51cto.com/blog/1281816/1167078
7.5 安裝Xen 主控端
Cobbler PXE菜單裡沒有關于Xen虛拟機的系統版本,導入CentOS5.8系統鏡像時,已經生成一個關于Xen的distros和profiles 即centos5.8-xen-x86_64,因為Cobbler知道它不可能PXE引導實體硬體。
如果你想安裝Xen 主控端,需要在安裝腳本ks檔案%packages部分添加xen包名 "kernel-xen"、“xen”。當然這樣似乎不太友善,你可以使用指令“cobbler import”再導入一個關于xenserver主控端的配置。
配置好ks檔案,安裝方法同步驟7.3。
7.6 安裝Xen虛拟機
7.6.1 Xen主控端安裝koan
yum install koan -y
7.6.2 檢視關于Xen主控端的配置資訊
koan --server=172.17.10.14 --list=profiles
- looking for Cobbler at http://172.17.10.14/cobbler_api
centos5.8-xen-x86_64
centos6.4-x86_64
centos5.8-x86_64
centos6.3-x86_6
koan --server=172.17.10.14 --display --profile=centos5.8-xen-x86_64
- looking for Cobbler at http://172.17.10.14:80/cobbler_api
- reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
name : centos5.8-xen-x86_64
distro : centos5.8-xen-x86_64
kickstart : http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-xen-x86_64
install_tree : http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/xen/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/xen/initrd.img
kernel_options : ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text
repos :
virt_ram : 512
virt_disk_driver : raw
virt_type : xenpv
virt_path :
virt_auto_boot : 0
7.6.3 安裝Xen虛拟機
koan --server=172.17.10.14 --virt-name=testvm --virt --profile=centos5.8-xen-x86_64
libvirtd (pid 2749) is running...
downloading initrd initrd.img to /var/lib/xen/initrd.img
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/initrd.img
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/initrd.img
downloading kernel vmlinuz to /var/lib/xen/vmlinuz
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/vmlinuz
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/vmlinuz
Wed, 27 Mar 2013 16:12:17 DEBUG No conn passed to Guest, opening URI 'None'
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByName
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByUUID
Wed, 27 Mar 2013 16:12:17 DEBUG Creating guest from:
<domain type='xen'>
<name>testvm</name>
<currentMemory>524288</currentMemory>
<memory>524288</memory>
<uuid>b0dee8f5-284b-1622-6191-2443ea10cc1c</uuid>
<os>
<type>linux</type>
<kernel>/var/lib/xen/vmlinuz</kernel>
<initrd>/var/lib/xen/initrd.img</initrd>
<cmdline>ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text </cmdline>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<vcpu>1</vcpu>
<devices>
<disk type='file' device='disk'>
<source file='/var/lib/xen/p_w_picpaths/testvm-disk0'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:28:12:79'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
</devices>
</domain>
Wed, 27 Mar 2013 16:12:18 DEBUG Created guest, looking to see if it is running
Wed, 27 Mar 2013 16:12:18 DEBUG Saving XML boot config:
<bootloader>/usr/bin/pygrub</bootloader>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
use virt-manager or reconnect with virsh console testvm
7.6.4 列出虛拟機清單
xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 7494 4 r----- 79.0
testvm 1 512 1 r----- 86.5
7.6.5 打開控制台管理虛拟機
xm console 1
或者
xm console testvm
Bootdata ok (command line is ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text )
Linux version 2.6.18-308.el5xen ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Tue Feb 21 20:47:10 EST 2012
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 0000000020800000 (usable)
No mptable found.
Built 1 zonelists. Total pages: 129529
Kernel command line: ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text
Initializing CPU#0
…………略…………
Write protecting the kernel read-only data: 503k
Restarting system.
預設虛拟機配置檔案在目錄/etc/xen下
7.6.6 啟動虛拟機
xm create -c testvm
在SecureCRT顯示的啟動、登入内容如下:
pyGRUB version 0.6
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ CentOS (2.6.18-308.el5xen) ³
³ ³
³ ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Use the ˜ and ™ keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting, 'a' to modify the kernel arguments
before booting, or 'c' for a command line.
………虛拟機啟動過程略……………
登入界面
CentOS release 5.8 (Final)
Kernel 2.6.18-308.el5xen on an x86_64
host-d-115.sys.hexun login: root
Password:
檢視虛拟機主機名
[root@host-d-115 ~]# hostname
host-d-115.sys.hexun
檢視ip
[root@host-d-115 ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:16:3E:28:12:79
inet addr:172.17.188.115 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::216:3eff:fe28:1279/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:325 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25014 (24.4 KiB) TX bytes:1298 (1.2 KiB)
到此Xen虛拟機已經通過Cobbler安裝完畢。
請看《Cobbler部署指南》系列續文