三、Cobbler 安装
1.Cobbler运行所需基础包
[root@node2 ~]# yum install -y cobbler tftp dhcp httpd cman pykickstart debmirror
2.Cobblerf所需环境支持包
[root@node2 ~]# yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl
3.将所有服务加入开机自启动并启动相关服务
[root@node2 ~]# chkconfig httpd on
[root@node2 ~]# chkconfig dhcpd on
[root@node2 ~]# chkconfig xinetd on
[root@node2 ~]# chkconfig cobblerd on
[root@node2 ~]#
[root@node2 ~]# service httpd start
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using node2.test.com for ServerName
[确定]
[root@node2 ~]# service cobblerd start
Starting cobbler daemon: [确定]
4.修改apache相关配置并重新启动
注,从上面的启动信息可以看出apache启动有点小错误,我们来修正一下。
[root@node2 ~]# vim /etc/httpd/conf/httpd.conf
#增加一行
ServerName localhost:80
[root@node2 ~]# service httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
5.运行Cobbler检查命令
[root@node2 ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
5 : comment out 'dists' on /etc/debmirror.conf for proper debian support
6 : comment out 'arches' on /etc/debmirror.conf for proper debian support
7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
Restart cobblerd and then run 'cobbler sync' to apply changes.
注,从上面的执行结果来看上面有7处错误,下面我们来解决一下。
(1).错误1,修改/etc/cobbler/settings 里面的 server 为Cobbler Server的IP地址 ;
[root@node2 ~]# vim /etc/cobbler/settings
server: 192.168.18.202
(2).错误2,修改/etc/cobbler/settings 里面的 next_serverw 为本机的 ip;
[root@node2 ~]# vim /etc/cobbler/settings
next_server: 192.168.18.202
(3).错误3,据说这个错误可以忽略,有强迫完美运行症的人士可以运行以下命令来解决;
[root@node2 ~]# cobbler get-loaders
task started: 2013-11-04_143149_get_loaders
task started (id=Download Bootloader Content, time=Mon Nov 4 14:31:49 2013)
downloading to /var/lib/cobbler/loaders/README
downloading to /var/lib/cobbler/loaders/COPYING.elilo
downloading to /var/lib/cobbler/loaders/COPYING.yaboot
downloading to /var/lib/cobbler/loaders/COPYING.syslinux
downloading to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading to /var/lib/cobbler/loaders/yaboot
downloading to /var/lib/cobbler/loaders/pxelinux.0
downloading to /var/lib/cobbler/loaders/menu.c32
downloading to /var/lib/cobbler/loaders/grub-x86.efi
downloading to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
(4).错误4,修改/etc/xinetd.d/tftp 把'disable' 修改为'no';修改/etc/xinetd.d/rsync 把'disable' 修改为'no';
[root@node2 ~]# vim /etc/xinetd.d/tftp
disable = no
[root@node2 ~]# vim /etc/xinetd.d/rsync
disable = no
注,启动xinetd服务。
12 [root@node2 ~]# service xinetd start
正在启动 xinetd: [确定]
(5).错误5与错误6,debmmirror有错误;
[root@node2 ~]# vim /etc/debmirror.conf
#注释掉@dists="sid"与@arches="i386即可
#@dists="sid";
#@arches="i386";
(6).错误7,设置默认root密码;
注,刚接触Cobbler的博友会问,这个密码是什么密码。有的博友系统安装好了会问,root密码是什么。这里设置的就是客户端安装好系统的root密码。
#生成你想要的密码的加密字符串,然后复制运行命令之后的加密代码;
12 [root@node2 ~]# openssl passwd -1 -salt 'hahaha' '123456'
$1$hahaha$hSxFjZSHRoiEn4DYrrGUI.
#然后替换/etc/cobbler/settings 中选项双引号中的加密代码;
[root@node2 ~]# vim /etc/cobbler/settings
default_password_crypted: "$1$hahaha$hSxFjZSHRoiEn4DYrrGUI."
6.重新启动Cobbler并运行检查命令
[root@node2 ~]# service cobblerd restart
Stopping cobbler daemon: [确定]
Starting cobbler daemon: [确定]
[root@node2 ~]# cobbler check
No configuration problems found. All systems go.
好了,到这里我们Cobbler安装就全部完成了,最后我们来查看一下启动的端口。
[root@node2 ~]# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1011/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1087/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1126/sshd
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 1607/sshd
tcp 0 0 127.0.0.1:25151 0.0.0.0:* LISTEN 12677/Python
tcp 0 0 :::80 :::* LISTEN 1696/httpd
tcp 0 0 :::22 :::* LISTEN 1011/sshd
tcp 0 0 ::1:25 :::* LISTEN 1087/master
tcp 0 0 ::1:6010 :::* LISTEN 1126/sshd
tcp 0 0 ::1:6011 :::* LISTEN 1607/sshd
tcp 0 0 :::873 :::* LISTEN 12747/xinetd
udp 0 0 0.0.0.0:69 0.0.0.0:* 12747/xinetd