Cobbler部署指南之Cobbler安装操作系统篇

来源:互联网 发布:gs算法的matlab代码 编辑:程序博客网 时间:2024/05/21 12:08

《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

七、Cobbler安装操作系统

7.1 安装完系统后默认的密码是啥呢?

这个密码 $default_password_crypted 就是步骤3.6使用openssl passwd -1 生成的密码

 

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 /images/centos5.8-x86_64/vmlinuz

        MENU LABEL centos5.8-x86_64

        append initrd=/images/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 /images/centos5.8-x86_64/vmlinuz

        ipappend 2

        append initrd=/images/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的安装系统数据源,其他系统同理

链接

https://url/cblr/links/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重装系统

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

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=images

 

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/images/pxeboot/vmlinuz

              initrd  : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/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/images/pxeboot/vmlinuz

              initrd  : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/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/images/pxeboot/vmlinuz

              initrd  : /var/www/cobbler/ks_mirror/centos5.8-x86_64/images/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 --image=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/images/centos5.8-x86_64/initrd.img

- reading URL: http://172.17.10.14/cobbler/images/centos5.8-x86_64/initrd.img

downloading kernel vmlinuz to /boot/vmlinuz_koan

url=http://172.17.10.14/cobbler/images/centos5.8-x86_64/vmlinuz

- reading URL: http://172.17.10.14/cobbler/images/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/images/centos5.8-x86_64/initrd.img

- reading URL: http://172.17.10.14/cobbler/images/centos5.8-x86_64/initrd.img

downloading kernel vmlinuz to /boot/vmlinuz

url=http://172.17.10.14/cobbler/images/centos5.8-x86_64/vmlinuz

- reading URL: http://172.17.10.14/cobbler/images/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

本文出自 “Dreamway的运维点滴” 博客,请务必保留此出处http://dreamway.blog.51cto.com/1281816/1166947


原创粉丝点击