天天看点

自动化运维工具cobbler的使用

概述:

    cobbler 实现自动化安装OS,是依赖于:网卡的PXE技术(dhcp client、tftp client ) + anaconda(linux上安装操作系统的程序) + dhcp(为需要安装操作系统的主机分配IP) + tftp(提供基于网卡引导时所需要的启动文件) + httpd(os install tree 的存放位置 ) 实现的。

使用 cobbler 的命令能够自动化地实现:

        在tftp server 上提供基于网卡引导时所需要的程序文件

能够在 httpd 服务器的文档根目录下,自动生成安装操作OS时,所需要的install tree.

所以,使用cobbler 实现自动化安装OS,要安装:httpd、tftp、dhcp服务,还有rsync服务(cobbler可以从远程镜像install tree的)。

自动化安装OS原理如下图:

<a href="http://s3.51cto.com/wyfs02/M00/4C/EE/wKioL1RHk22SMbd1AAI0TsoilC8708.jpg" target="_blank"></a>

工作原理:

     1、首先基于网卡的PXE技术引导启动目标机(需要安装OS的服务器):

        (1)、支持PXE技术的网卡上的芯片的dhcp client 客户端,请求dhcp server分配IP地址.

        (2)、dhcp server 会告诉客户端,Bootloader所在的服务器,以及引导文件是什么?

            这样tftp client就知道了Bootloader的URL了。

        (3)、需要安装OS的主机配置好IP后,tftp client 就联系tftp server 服务器请求基于

              网卡引导启动OS所需要的文件。

        (4)、在目标机(需要安装OS的服务器)启动内核,从而能够驱动目标机的磁盘,

              就可以访问磁盘了。

     2、启动完成以后,在用户空间启动anaconda 程序,该程序负责安装OS

           当内核启动完成,通过/sbin/loader 启动anaconda系统安装程序,该程序就会读取

            ks.cfg文件,ks.cfg文件中定义有安装源(install tree)所在的

            位置和安装OS时的配置数据。这样就实现了自动化给服务器安装操作系统了。

            cobbloer的安装树(install tree)的位置在httpd服务器上的。所以,ks.cfg文件中指定

            安装源的URL就是httpd服务器的地址。

配置使用cobbler实现自动化安装OS所需要的程序包:

1

2

<code>         </code><code>cobbler-2.4.0-1.el6.noarch       cobbler服务程序包</code>

<code>         </code><code>cobbler-web.2.4.0-1.el6.noarch   cobbler 提供的web gui 配置接口。</code>

一、配置cobbler服务

1、启动cobbler和httpd服务

启动cobbler 服务

<code>[root@localhost ~]</code><code># service cobblerd start</code>

<code>Starting cobbler daemon:                                   [  OK  ]</code>

查看cobbler 服务监听的端口

<code>[root@localhost ~]</code><code># netstat -anptul | grep python</code>

<code>tcp        0      0 127.0.0.1:25151             0.0.0.0:*                   LISTEN      1784</code><code>/python</code>

启动httpd服务

<code>[root@localhost ~]</code><code># service httpd start</code>

<code>Starting httpd:                                            [  OK  ]</code>

2、cobbler正常工作所必须的条件:

(1)、使用cobbler提供的测试命令【cobbler check】测试cobbler 的环境

3

4

5

6

7

8

9

10

11

12

13

<code>[root@localhost ~]</code><code># cobbler check</code>

<code>The following are potential configuration items that you may want to fix:</code>

<code>1 : The </code><code>'server'</code> <code>field </code><code>in</code> <code>/etc/cobbler/settings</code> <code>must be </code><code>set</code> <code>to something other than localhost, or kickstarting features will not work.  This should be a resolvable </code><code>hostname</code> <code>or IP </code><code>for</code> <code>the boot server as reachable by all machines that will use it.</code>

<code>2 : For PXE to be functional, the </code><code>'next_server'</code> <code>field </code><code>in</code> <code>/etc/cobbler/settings</code> <code>must be </code><code>set</code> <code>to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.</code>

<code>3 : some network boot-loaders are missing from </code><code>/var/lib/cobbler/loaders</code><code>, you may run </code><code>'cobbler get-loaders'</code> <code>to download them, or, </code><code>if</code> <code>you only want to handle x86</code><code>/x86_64</code> <code>netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files </code><code>in</code> <code>this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The </code><code>'cobbler get-loaders'</code> <code>command</code> <code>is the easiest way to resolve these requirements.</code>

<code>4 : change </code><code>'disable'</code> <code>to </code><code>'no'</code> <code>in</code> <code>/etc/xinetd</code><code>.d</code><code>/rsync</code>

<code>5 : debmirror package is not installed, it will be required to manage debian deployments and repositories</code>

<code>6 : ksvalidator was not found, </code><code>install</code> <code>pykickstart</code>

<code>7 : The default password used by the sample templates </code><code>for</code> <code>newly installed machines (default_password_crypted </code><code>in</code> <code>/etc/cobbler/settings</code><code>) is still </code><code>set</code> <code>to </code><code>'cobbler'</code> <code>and should be changed, try: </code><code>"openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'"</code> <code>to generate new one</code>

<code>8 : fencing tools were not found, and are required to use the (optional) power management features. </code><code>install</code> <code>cman or fence-agents to use them</code>

<code>Restart cobblerd and </code><code>then</code> <code>run </code><code>'cobbler sync'</code> <code>to apply changes.</code>

(2)、解决测试出来的问题

解决第1个问题:设置cobbler server的地址/etc/cobbler/settings 文件中的【server】指令定义的

<code>[root@localhost ~]</code><code># vim /etc/cobbler/settings</code>

<code>server: 192.168.60.134</code>

解决第2个问题:在cobbler的/etc/cobbler/settings配置文件指定tftp server 地址。

<code>next_server: 192.168.60.134</code>

解决第3个问题:缺少一些网络引导所需要的文件,如果只引导x86/x86_64。保证安装了syslinux 程序包就可以了。

<code>[root@localhost ~]</code><code># yum install syslinux</code>

解决第4个问题:要开启rsync服务

<code>[root@localhost ~]</code><code># chkconfig rsync on</code>

<code>[root@localhost ~]</code><code># chkconfig --list rsync</code>

<code>rsync</code>           <code>on</code>

解决第5个问题:如果安装的是 debian 操作系统的话,需要把debmirrot包安装好。

<code>[root@localhost admin]</code><code># yum install debmirror-2.14-2.el6.noarch.rpm perl-LockFile-Simple-0.207-2.el6.noarch.rpm</code>

解决第6个问题:需要安装pykickstart程序

<code>[root@localhost ~]</code><code># yum install pykickstart</code>

解决第7个问题:因为安装系统时,要求设置管理员(root)密码。这里就是设置安装操作系统时,设置的管理员密码的。

<code>[root@localhost ~]</code><code># openssl passwd -1 -salt 'abc'</code>

<code>Password:</code>

<code>$1$abc$FEGY5dR6AYgowx6hkRl2d/</code>

<code>default_password_crypted: </code><code>"$1$abc$FEGY5dR6AYgowx6hkRl2d/"</code>

第8个问题,是可忽略的。

(3)、重新启动cobblerd服务

<code>[root@localhost ~]</code><code># service cobblerd restart</code>

<code>Stopping cobbler daemon:                                   [  OK  ]</code>

(4)、同步一下,让cobbler check 检测的环境是修改后的。

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

<code>[root@localhost ~]</code><code># cobbler sync</code>

<code>task started: 2014-10-05_214230_sync</code>

<code>task started (</code><code>id</code><code>=Sync, </code><code>time</code><code>=Sun Oct  5 21:42:30 2014)</code>

<code>running pre-</code><code>sync</code> <code>triggers</code>

<code>cleaning trees </code>

<code>mkdir</code><code>: </code><code>/var/lib/tftpboot/pxelinux</code><code>.cfg</code>

<code>mkdir</code><code>: </code><code>/var/lib/tftpboot/grub</code>

<code>mkdir</code><code>: </code><code>/var/lib/tftpboot/s390x</code>

<code>mkdir</code><code>: </code><code>/var/lib/tftpboot/ppc</code>

<code>mkdir</code><code>: </code><code>/var/lib/tftpboot/etc</code>

<code>removing: </code><code>/var/lib/tftpboot/grub/images</code>

<code>copying bootloaders                              --------&gt; 自动复制基于网卡引导所需要的文件到tftp server的共享文件目录中。</code>

<code>copying: </code><code>/usr/share/syslinux/pxelinux</code><code>.0 -&gt; </code><code>/var/lib/tftpboot/pxelinux</code><code>.0</code>

<code>copying: </code><code>/usr/share/syslinux/menu</code><code>.c32 -&gt; </code><code>/var/lib/tftpboot/menu</code><code>.c32</code>

<code>copying: </code><code>/usr/share/syslinux/memdisk</code> <code>-&gt; </code><code>/var/lib/tftpboot/memdisk</code>

<code>copying distros to tftpboot</code>

<code>copying images</code>

<code>generating PXE configuration files  -----&gt; 自动产生基于PXE引导的配置文件</code>

<code>generating PXE menu structure</code>

<code>rendering TFTPD files</code>

<code>generating </code><code>/etc/xinetd</code><code>.d</code><code>/tftp</code>

<code>cleaning link caches</code>

<code>running post-</code><code>sync</code> <code>triggers</code>

<code>running python triggers from </code><code>/var/lib/cobbler/triggers/sync/post/</code><code>*</code>

<code>running python trigger cobbler.modules.sync_post_restart_services</code>

<code>running shell triggers from </code><code>/var/lib/cobbler/triggers/sync/post/</code><code>*</code>

<code>running python triggers from </code><code>/var/lib/cobbler/triggers/change/</code><code>*</code>

<code>running python trigger cobbler.modules.scm_track</code>

<code>running shell triggers from </code><code>/var/lib/cobbler/triggers/change/</code><code>*</code>

<code>*** TASK COMPLETE ***</code>

(5)、再检测是否满足cobbler工作所需要的环境

<code>[root@localhost admin]</code><code># cobbler check</code>

<code>1 : some network boot-loaders are missing from </code><code>/var/lib/cobbler/loaders</code><code>, you may run </code><code>'cobbler get-loaders'</code> <code>to download them, or, </code><code>if</code> <code>you only want to handle x86</code><code>/x86_64</code> <code>netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files </code><code>in</code> <code>this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The </code><code>'cobbler get-loaders'</code> <code>command</code> <code>is the easiest way to resolve these requirements.</code>

<code>2 : comment out </code><code>'dists'</code> <code>on </code><code>/etc/debmirror</code><code>.conf </code><code>for</code> <code>proper debian support</code>

<code>3 : comment out </code><code>'arches'</code> <code>on </code><code>/etc/debmirror</code><code>.conf </code><code>for</code> <code>proper debian support</code>

<code>4 : fencing tools were not found, and are required to use the (optional) power management features. </code><code>install</code> <code>cman or fence-agents to use them</code>

(6)、解决上述的问题:

<code>[root@localhost ~]</code><code># cp /usr/share/syslinux/pxelinux.0 /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/</code>

<code>[root@localhost ~]</code><code># ll /var/lib/cobbler/loaders/</code>

<code>total 88</code>

<code>-rw-r--r-- 1 root root 60928 Oct  5 22:14 menu.c32</code>

<code>-rw-r--r-- 1 root root 26828 Oct  5 22:14 pxelinux.0</code>

注释掉debmirror.conf文件中指定配置选项

<code>[root@localhost admin]</code><code># vim /etc/debmirror.conf</code>

<code>#@arches="i386";</code>

<code>#@dists="sid";</code>

(7)、再次检测

重新cobblerd 服务

31

32

33

<code>[root@localhost admin]</code><code># service cobblerd restart</code>

<code>task started: 2014-10-05_221901_sync</code>

<code>task started (</code><code>id</code><code>=Sync, </code><code>time</code><code>=Sun Oct  5 22:19:01 2014)</code>

<code>cleaning trees</code>

<code>removing: </code><code>/var/lib/tftpboot/pxelinux</code><code>.cfg</code><code>/default</code>

<code>removing: </code><code>/var/lib/tftpboot/grub/efidefault</code>

<code>removing: </code><code>/var/lib/tftpboot/s390x/profile_list</code>

<code>copying bootloaders                  ------------------&gt; 复制基于网卡启动的引导文件</code>

<code>trying hardlink </code><code>/var/lib/cobbler/loaders/pxelinux</code><code>.0 -&gt; </code><code>/var/lib/tftpboot/pxelinux</code><code>.0</code>

<code>copying: </code><code>/var/lib/cobbler/loaders/pxelinux</code><code>.0 -&gt; </code><code>/var/lib/tftpboot/pxelinux</code><code>.0</code>

<code>trying hardlink </code><code>/var/lib/cobbler/loaders/menu</code><code>.c32 -&gt; </code><code>/var/lib/tftpboot/menu</code><code>.c32</code>

<code>copying: </code><code>/var/lib/cobbler/loaders/menu</code><code>.c32 -&gt; </code><code>/var/lib/tftpboot/menu</code><code>.c32</code>

<code>generating PXE configuration files</code>

再次使用【cobbler check】命令检测,是否已经符合cabbler工作的环境

<code>2 : fencing tools were not found, and are required to use the (optional) power management features. </code><code>install</code> <code>cman or fence-agents to use them</code>

说明:

   上述这两个问题可以忽略的。

二、配置dhcp server 

1、复制样例配置文件到dhcp的配置文件目录下

<code>[root@localhost ~]</code><code># cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf</code>

<code>cp</code><code>: overwrite `</code><code>/etc/dhcp/dhcpd</code><code>.conf'? y</code>

2、编辑dhcp的配置文件,让dhcp服务器为:192.168.60.0/32网络分配地址并且告诉dhcp 的客户端tftp server的IP地址以及从tftp server下载什么文件,

<code>[root@localhost ~]</code><code># vim /etc/dhcp/dhcpd.conf</code>

<code>option domain-name </code><code>"9527du.com"</code><code>;</code>

<code>option domain-name-servers www.9527du.com;</code>

<code>default-lease-</code><code>time</code> <code>600;</code>

<code>max-lease-</code><code>time</code> <code>7200;                           ----------&gt; IP地址的租约时长</code>

<code>subnet 192.168.60.0 netmask 255.255.255.0 {</code>

<code>  </code><code>range 192.168.60.78 192.168.60.167;           ---------&gt;只负责分配这个段的IP</code>

<code>  </code><code>option routers 192.168.60.134;</code>

<code>}</code>

<code>next_server 192.168.60.134;                    -----------&gt; 指明tftp server 的地址</code>

<code>filename=</code><code>"pxelinux.0"</code><code>;                         -----------&gt; 联系 tftp server 服务器时,请求的文件。其实该文件就是基于网卡PXE技术引导启动OS的引导文件。</code>

3、启动dhcp 服务

<code>[root@localhost ~]</code><code># service dhcpd start</code>

<code>Starting dhcpd:                                            [  OK  ]</code>

4、查看dhcp 是否工作OK?

(1)、查看dhcp server 监听的端口

<code>[root@localhost ~]</code><code># netstat  -anptul | grep dhcpd</code>

<code>udp        0      0 0.0.0.0:67                  0.0.0.0:*                               3193</code><code>/dhcpd</code>

(2)、查看dhcp输出的日志信息

<code>[root@localhost ~]</code><code># tail -3 /var/log/messages</code>

<code>Oct  5 22:39:24 localhost dhcpd: Listening on LPF</code><code>/eth0/00</code><code>:0c:29:59:35:18</code><code>/192</code><code>.168.60.0</code><code>/24</code>

<code>Oct  5 22:39:24 localhost dhcpd: Sending on   LPF</code><code>/eth0/00</code><code>:0c:29:59:35:18</code><code>/192</code><code>.168.60.0</code><code>/24</code>

<code>Oct  5 22:39:24 localhost dhcpd: Sending on   Socket</code><code>/fallback/fallback-net</code>

    从上述,可以判断dhcp工作是OK的。

三、生成安装树(install tree)以及配置profile文件

1、查看tftp server 服务器的共享目录下是否有引导OS所需要的文件

<code>[root@localhost ~]</code><code># cat  /var/lib/tftpboot/pxelinux.cfg/default</code>

<code>DEFAULT menu</code>

<code>PROMPT 0</code>

<code>MENU TITLE Cobbler | http:</code><code>//www</code><code>.cobblerd.org/</code>

<code>TIMEOUT 200</code>

<code>TOTALTIMEOUT 6000</code>

<code>ONTIMEOUT </code><code>local</code>

<code>LABEL </code><code>local</code>

<code>        </code><code>MENU LABEL (</code><code>local</code><code>)</code>

<code>        </code><code>MENU DEFAULT</code>

<code>        </code><code>LOCALBOOT -1</code>

<code>MENU end</code>

是否有启用Linux所需要的:initrd和vmlinuz文件的。

<code>[root@localhost ~]</code><code># ll  /var/lib/tftpboot/images/</code>

<code>total 0</code>

2、为安装OS提供install tree

cobbler可以使用两种方式获取install tree:

      A、使用sync 服务从远程同步install tree 到本地;

      B、从OS安装光盘中导入安装源(install tree)

这里选择从OS安装光盘导入安装源

(1)、以只读方式挂载OS安装光盘

<code>[root@localhost ~]</code><code># mount -ro /dev/cdrom /mnt/cdrom/</code>

<code>[root@localhost ~]</code><code># mount | grep cdrom</code>

<code>/dev/sr0</code> <code>on </code><code>/mnt/cdrom</code> <code>type</code> <code>iso9660 (ro)</code>

(2)、使用cobbler的import命令从OS安装光盘中导入(复制)install tree(安装OS所需要的程序包)

<code>[root@localhost ~]</code><code># cobbler import --path=/mnt/cdrom/ --name=centos-6.5-x86_64</code>

<code>task started: 2014-10-05_223311_import</code>

<code>task started (</code><code>id</code><code>=Media </code><code>import</code><code>, </code><code>time</code><code>=Sun Oct  5 22:33:11 2014)</code>

<code>Found a candidate signature: breed=redhat, version=rhel6</code>

<code>Found a matching signature: breed=redhat, version=rhel6</code>

<code>Adding distros from path </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64:  ---------&gt; 生成的OS镜像文件的目录</code>

<code>creating new distro: centos-6.5-x86_64</code>

<code>trying </code><code>symlink</code><code>: </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64 -&gt; </code><code>/var/www/cobbler/links/centos-6</code><code>.5-x86_64</code>

<code>creating new profile: centos-6.5-x86_64</code>

<code>associating repos</code>

<code>checking </code><code>for</code> <code>rsync</code> <code>repo(s)</code>

<code>checking </code><code>for</code> <code>rhn repo(s)</code>

<code>checking </code><code>for</code> <code>yum repo(s)</code>

<code>starting descent into </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64 </code><code>for</code> <code>centos-6.5-x86_64</code>

<code>processing repo at : </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64</code>

<code>need to process repo</code><code>/comps</code><code>: </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64</code>

<code>looking </code><code>for</code> <code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64</code><code>/repodata/</code><code>*comps*.xml</code>

<code>running: ceatererpo -c cache -s sha --groupfile </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64</code><code>/repodata/b4e0b9342ef85d3059ff095fa7f140f654c2cb492837de689a58c581207d9632-c6-x86_64-comps</code><code>.xml </code><code>/var/www/cobbler/ks_mirror/centos-6</code><code>.5-x86_64</code>

<code>received on stdout: Spawning worker 0 with 3995 pkgs</code>

<code>Workers Finished     ---------------------------&gt; 导入完成</code>

<code>Gathering worker results</code>

<code>Saving Primary metadata</code>

<code>Saving </code><code>file</code> <code>lists metadata</code>

<code>Saving other metadata</code>

<code>Generating sqlite DBs</code>

<code>Sqlite DBs complete</code>

<code>received on stderr:</code>

    其实,就是复制光盘中的的程序包到/var/www/cobbler目录下,

    还生成一个配置文件/etc/httpd/conf.d/cobbler.conf。

如下图:

<a href="http://s3.51cto.com/wyfs02/M00/4C/ED/wKiom1RHlyjz7oSqAAJQuCbI5Mc537.jpg" target="_blank"></a>

(3)、查看导入的安装树,也就是cabbler提供可安装的OS发行版。

<code>[root@localhost ~]</code><code># cobbler distro list</code>

<code>   </code><code>centos-6.5-x86_64</code>

(4)、查看tftp 服务器的共享目录是否有了引导启动Linux所需要的文件

从OS安装光盘光盘导入时,同时会把内核vimlinuz和initrd.img复制到tftp server 共享目录下

<code>[root@localhost ~]</code><code># tree   /var/lib/tftpboot/images/</code>

<code>/var/lib/tftpboot/images/</code>

<code>└── centos-6.5-x86_64</code>

<code>    </code><code>├── initrd.img</code>

<code>    </code><code>└── vmlinuz</code>

<code>1 directory, 2 files</code>

查看引导文件

<code>LABEL centos-6.5-x86_64</code>

<code>        </code><code>kernel </code><code>/images/centos-6</code><code>.5-x86_64</code><code>/vmlinuz</code>    

<code>        </code><code>MENU LABEL centos-6.5-x86_64 </code>

<code>        </code><code>append initrd=</code><code>/images/centos-6</code><code>.5-x86_64</code><code>/initrd</code><code>.img ksdevice=bootif lang=  kssendmac text  ks=http:</code><code>//192</code><code>.168.60.134</code><code>/cblr/svc/op/ks/profile/centos-6</code><code>.5-x86_64  </code>

<code>        </code><code>ipappend 2</code>

   把kickstart文件做为参数传递给内核.

3、配置profile 文件,目的是让kickstarts文件与安装树install tree 关联起来。

由于安装OS时,会自动在/etc/ 目录下生成以.cfg结尾的文件,这就是kickstart文件。该文件保存了安装OS时,配置的所有参数。anaconda 程序就是根据该文件完成OS的自动化安装的。

(1)、提供kickstart文件:把kickstart文件复制到cobbler默认的kickstart文件存放目录。

<code>[root@localhost ~]</code><code># cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/</code>

(2)、生成profile文件

<code>[root@localhost ~]</code><code># cobbler profile add --name=centos-6.5-x86_64-basic --distro=centos-6.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/anaconda-ks.cfg</code>

   --distro 指定该kickstat文件关联的安装树install tree(也就是那个发行版的OS)是什么

   --kickstart 指定kickstat文件

   说白了,这个kickstat是为安装那个发行版使用的文件。

其实,就是在/var/lib/tftpboot/pxelinux.cfg/default 文件中加入一个条目:LABEL 。

(3)、列出cobbler有哪些profile文件。

<code>[root@localhost ~]</code><code># cobbler profile list</code>

<code>   </code><code>centos-6.5-x86_64-basic</code>

查看default配置文件

<code>[root@localhost ~]</code><code># cat /var/lib/tftpboot/pxelinux.cfg/default</code>

<code>        </code><code>kernel </code><code>/images/centos-6</code><code>.5-x86_64</code><code>/vmlinuz</code>

<code>        </code><code>MENU LABEL centos-6.5-x86_64</code>

<code>        </code><code>append initrd=</code><code>/images/centos-6</code><code>.5-x86_64</code><code>/initrd</code><code>.img ksdevice=bootif lang=  kssendmac text  ks=http:</code><code>//192</code><code>.168.60.134</code><code>/cblr/svc/op/ks/profile/centos-6</code><code>.5-x86_64</code>

<code>LABEL centos-6.5-x86_64-basic</code>

<code>        </code><code>MENU LABEL centos-6.5-x86_64-basic</code>

<code>        </code><code>append initrd=</code><code>/images/centos-6</code><code>.5-x86_64</code><code>/initrd</code><code>.img ksdevice=bootif lang=  kssendmac text  ks=http:</code><code>//192</code><code>.168.60.134</code><code>/cblr/svc/op/ks/profile/centos-6</code><code>.5-x86_64-baic</code>

    从上述输出信息可分析,该cobbler提供了两个kickstart文件,也就是说安装OS时,要以选择安装:centos-6.5-x86_64 还是 centos-6.5-x86_64-basic

四、查看cobbler依赖的服务是否准备好?

<code>[root@www ~]</code><code># chkconfig tftp on</code>

<code>[root@www ~]</code><code># chkconfig --list  tftp</code>

<code>tftp            on</code>

查看

<code>[root@localhost ~]</code><code># netstat -anptul | grep -e 'dhcpd' -e 'xinetd' -e 'httpd'</code>

<code>tcp        0      0 :::80                       :::*                        LISTEN      2209</code><code>/httpd</code>        

<code>tcp        0      0 :::873                      :::*                        LISTEN      1651</code><code>/xinetd</code>   <code>-----&gt; </code><code>rsync</code><code>服务监听的端口    </code>

<code>udp        0      0 0.0.0.0:67                  0.0.0.0:*                               3334</code><code>/dhcpd</code>        

<code>udp        0      0 0.0.0.0:69                  0.0.0.0:*                               1651</code><code>/xinetd</code>   <code>------&gt; tftp server 监听的端口</code>

五、测试cobbler

1、目标机的dhcp client 端连系 dhcp server分配IP地址

<a href="http://s3.51cto.com/wyfs02/M00/4C/EE/wKioL1RHmrXTfLBzAAGWO0w62YI326.jpg" target="_blank"></a>

2、选择安装的发行版;

<a href="http://s3.51cto.com/wyfs02/M02/4C/ED/wKiom1RHmuSBXraRAAG3Rqxgrsc509.jpg" target="_blank"></a>

3、开始基于网卡引导启动OS

<a href="http://s3.51cto.com/wyfs02/M00/4C/EE/wKioL1RHnEeibUjKAAIrjH2DtVk216.jpg" target="_blank"></a>

4、运行anaconda系统安装程序,安装OS

<a href="http://s3.51cto.com/wyfs02/M02/4C/ED/wKiom1RHnObBX3LEAAOvqY-bX_8385.jpg" target="_blank"></a>

<a href="http://s3.51cto.com/wyfs02/M00/4C/ED/wKiom1RHnZ_wLiG7AAG-gRbpmhw726.jpg" target="_blank"></a>

5、分区格式化硬盘:

<a href="http://s3.51cto.com/wyfs02/M00/4C/ED/wKiom1RHnguCEl1eAAHh5hDUDjI004.jpg" target="_blank"></a>

5、检测安装的程序包的依赖关系;

<a href="http://s3.51cto.com/wyfs02/M01/4C/ED/wKiom1RHnxzgs47cAAI2ATWl164058.jpg" target="_blank"></a>

5、从httpd服务器下载安装的程序包,进行安装

<a href="http://s3.51cto.com/wyfs02/M00/4C/ED/wKiom1RHn5OglMQRAAHn2Qg_jWA641.jpg" target="_blank"></a>

<a href="http://s3.51cto.com/wyfs02/M01/4C/ED/wKiom1RHn6fD5R6jAAIiAMtLX5U841.jpg" target="_blank"></a>

OK!!!

     本文转自成长的小虫 51CTO博客,原文链接:<b>http://blog.51cto.com/9528du/1566885</b>,如需转载请自行联系原作者