《Cobbler部署指南》系列python
一、《Cobbler部署指南之安裝篇》http://dreamway.blog.51cto.com/blog/1281816/1166589linux
二、《Cobbler部署指南之配置管理篇[上文]》http://dreamway.blog.51cto.com/blog/1281816/1166921git
三、《Cobbler部署指南之配置管理篇[下文]》http://dreamway.blog.51cto.com/blog/1281816/1166932github
四、《Cobbler部署指南之yum倉庫配置管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166936centos
五、《Cobbler部署指南之Cobbler安裝操做系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166947api
六、《Cobbler部署指南之安裝虛擬化Xen系統篇》http://dreamway.blog.51cto.com/blog/1281816/1166950服務器
七、《Cobbler部署指南之電源管理篇》http://dreamway.blog.51cto.com/blog/1281816/1166957app
八、《Cobbler部署指南之FAQ處理篇》http://dreamway.blog.51cto.com/blog/1281816/1167078
運維
這個密碼 $default_password_crypted 就是步驟3.6使用openssl passwd -1 生成的密碼
grep rootpw /var/lib/cobbler/kickstarts/sample.ks
rootpw --iscrypted $default_password_crypted
默認菜單文件內容
cat /tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Hexun Automation Install System
TIMEOUT 150
TOTALTIMEOUT 6000
ONTIMEOUT local
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
LABEL centos5.8-x86_64
kernel /p_w_picpaths/centos5.8-x86_64/vmlinuz
MENU LABEL centos5.8-x86_64
append initrd=/p_w_picpaths/centos5.8-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://172.17.10.14/cblr/svc/op/
ks/profile/centos5.8-x86_64
ipappend 2
指定系統的菜單文件內容
cat /tftpboot/pxelinux.cfg/01-00-19-b9-e5-34-fe
default linux
prompt 0
timeout 1
label linux
kernel /p_w_picpaths/centos5.8-x86_64/vmlinuz
ipappend 2
append initrd=/p_w_picpaths/centos5.8-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://172.17.10.14/cblr/svc/op/ks/system/host-188116
將須要安裝系統的服務器網卡啓用PXE,啓動服務器從PXE引導
默認從本地硬盤引導,能夠修改,建議仍是保持此默認。
選擇安裝系統centos5.8-x86_64便可自動安裝系統
Tab鍵,能夠對啓動項參數進行編輯
安裝源數聽說明:
系統centos5.8-x86_64的安裝系統數據源,其餘系統同理
連接
目錄
/var/www/cobbler/links/centos5.8-x86_64/
是一個連接目錄,實際位置以下
ll links/
total 0
lrwxrwxrwx 1 root root 43 Mar 12 13:41 centos5.8-x86_64 -> /var/www/cobbler/ks_mirror/centos5.8-x86_64
koan是cobbler的一個輔助工具,koan是kickstart-over-a-network的縮寫安裝在客戶端的使用,koan配合cobbler實現快速重裝linux。
koan 在Fedora, Red Hat Enterprise Linux, 和 CentOS工做正常,其餘Linux版本應該也不錯
koan的相關腳本在此目錄內/usr/lib/python2.4/site-packages/koan/
經過EPEL安裝的koan版本爲koan-2.2.3-2.el5,使用中報錯較多,此版本比較穩定koan-1.6.6-1.el5,下載連接ftp://rpmfind.net/linux/epel/5/i386/koan-1.6.6-1.el5.noarch.rpm
關於Koan更多內容見https://github.com/cobbler/cobbler/wiki/Koan
在重裝的機器上安裝koan
rpm -ivh koan-1.6.6-1.el5.noarch.rpm
koan --server=172.17.10.14 --list=profiles
- looking for Cobbler at http://172.17.10.14:80/cobbler_api
centos5.8-xen-x86_64
centos6.4-x86_64
centos5.8-x86_64
centos6.3-x86_64
koan --server=172.17.10.14 --list=systems
- looking for Cobbler at http://172.17.10.14/cobbler_api
host-188116
koan --server=172.17.10.14 --list=p_w_picpaths
koan --server=172.17.10.14 --display --profile=centos5.8-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-x86_64
install_tree: http://172.17.10.14/cblr/links/centos5.8-x86_64
name : centos5.8-x86_64
distro : centos5.8-x86_64
kickstart : http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-x86_64
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-x86_64
install_tree : http://172.17.10.14/cblr/links/centos5.8-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/pxeboot/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/pxeboot/initrd.img
kernel_options : ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-x86_64 ksdevice=link kssendmac lang= text
repos : centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates
virt_ram : 512
virt_disk_driver : raw
virt_type : qemu
virt_path :
virt_auto_boot : 1
koan --server=172.17.10.14 --display --system=host-188116
- looking for Cobbler at http://172.17.10.14/cobbler_api
- reading URL: http://172.17.10.14/cblr/svc/op/ks/system/host-188116
install_tree: http://172.17.10.14/cblr/links/centos5.8-x86_64
name : host-188116
distro : centos5.8-x86_64
profile : centos5.8-x86_64
kickstart : http://172.17.10.14/cblr/svc/op/ks/system/host-188116
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-x86_64
install_tree : http://172.17.10.14/cblr/links/centos5.8-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/pxeboot/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/pxeboot/initrd.img
kernel_options : ks=http://172.17.10.14/cblr/svc/op/ks/system/host-188116 ksdevice=link kssendmac lang= text
repos : centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates
virt_ram : 512
virt_type : qemu
virt_path :
[root@host-d-116 ~]# koan --server=172.17.10.14 --display --system=host-188116
- looking for Cobbler at http://172.17.10.14/cobbler_api
- reading URL: http://172.17.10.14/cblr/svc/op/ks/system/host-188116
install_tree: http://172.17.10.14/cblr/links/centos5.8-x86_64
name : host-188116
distro : centos5.8-x86_64
profile : centos5.8-x86_64
kickstart : http://172.17.10.14/cblr/svc/op/ks/system/host-188116
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-x86_64
install_tree : http://172.17.10.14/cblr/links/centos5.8-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/pxeboot/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/pxeboot/initrd.img
kernel_options : ks=http://172.17.10.14/cblr/svc/op/ks/system/host-188116 ksdevice=link kssendmac lang= text
repos : centos5.8-x86_64-base centos5.8-x86_64-epel centos5.8-x86_64-updates
virt_ram : 512
virt_type : qemu
virt_path :
koan --server=172.17.10.14 --display --p_w_picpath=name
koan -r --server=172.17.10.14 --profile=centos5.8-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-x86_64
install_tree: http://172.17.10.14/cblr/links/centos5.8-x86_64
downloading initrd initrd.img to /boot/initrd.img_koan
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/initrd.img
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/initrd.img
downloading kernel vmlinuz to /boot/vmlinuz_koan
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/vmlinuz
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/vmlinuz
- ['/sbin/grubby', '--add-kernel', '/boot/vmlinuz_koan', '--initrd', '/boot/initrd.img_koan', '--args', '"ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-x86_64 ksdevice=link kssendmac lang= text "', '--copy-default', '--make-default', '--title=kick1364289618']
- reboot to apply changes
注意:輸入此命令重啓後,不能再停止重裝,重啓後自動進入pxe裝機。
reboot
執行reboot命令重啓服務器後,客戶端服務器會自動從新安裝操做系統,無需人工干預
步驟3.11已經添加指定客戶機配置,在這裏使用配置爲指定的服務器安裝操做系統
[root@host-d-116 ~]# koan -r --server=172.17.10.14 --system=host-188116
- looking for Cobbler at http://172.17.10.14/cobbler_api
- reading URL: http://172.17.10.14/cblr/svc/op/ks/system/host-188116
install_tree: http://172.17.10.14/cblr/links/centos5.8-x86_64
downloading initrd initrd.img to /boot/initrd.img
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/initrd.img
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/initrd.img
downloading kernel vmlinuz to /boot/vmlinuz
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/vmlinuz
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-x86_64/vmlinuz
- ['/sbin/grubby', '--add-kernel', '/boot/vmlinuz', '--initrd', '/boot/initrd.img', '--args', '"ks=http://172.17.10.14/cblr/svc/op/ks/system/host-188116 ksdevice=link kssendmac lang= text "', '--copy-default', '--make-default', '--title= kick1364390697']
- reboot to apply changes
[root@host-d-116 ~]# reboot
系統重啓看到kick1364390697與上面命令生成的相同,重裝過程同上
請看《Cobbler部署指南》系列續文
《Cobbler部署指南》系列文檔下載:http://down.51cto.com/data/745895