Cobbler部署指南之Cobbler安裝操做系統篇

#####################################################
##若有轉載,請務必保留本文連接及版權信息
##歡迎廣大運維同仁一塊兒交流linux/unix網站運維技術!
##QQ:335623998
##E-mail:335623998@qq.com
##博客: http://dreamway.blog.51cto.com/
##weibo:http://weibo.com/zhaixiangpan
#####################################################

《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
運維

7、Cobbler安裝操做系統

7.1 安裝完系統後默認的密碼是啥呢?

這個密碼 $default_password_crypted 就是步驟3.6使用openssl passwd -1 生成的密碼 koa

 

grep rootpw /var/lib/cobbler/kickstarts/sample.ks

rootpw --iscrypted $default_password_crypted

7.2 PXE菜單文件

默認菜單文件內容

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

7.3 安裝系統

將須要安裝系統的服務器網卡啓用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

7.4 使用Koan重裝系統

koancobbler的一個輔助工具,koankickstart-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

7.4.1 安裝koan

在重裝的機器上安裝koan

rpm  -ivh koan-1.6.6-1.el5.noarch.rpm

7.4.2 列出遠程cobbler上的系統版本對象

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

 

7.4.3 學習更多關於遠程Cobbler對象信息

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

 

7.4.4 從新安裝客戶端系統

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命令重啓服務器後,客戶端服務器會自動從新安裝操做系統,無需人工干預

 

7.4.5 從新安裝指定客戶機系統

步驟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

相關文章
相關標籤/搜索