安装与配置Cobbler(Linux自动安装)

落幕 178 0

前言(使用Centos6进行安装)

网络安装服务器套件 Cobbler(补鞋匠)从前,我们一直在做装机民工这份很有前途的职业。自打若干年前 Red Hat 推出了 Kickstart,此后我们顿觉身价倍增。不再需要刻了光盘一台一台地安装 Linux,只要搞定 PXE、DHCP、TFTP,还有那满屏眼花缭乱不知所云的 Kickstart 脚本,我们就可以像哈里波特一样,轻点魔棒,瞬间安装上百台服务器。这一堆花里胡哨的东西可不是一般人都能整明白的,没有大专以上学历,通不过英语四级, 根本别想玩转。总而言之,这是一份多么有前途,多么有技术含量的工作啊。很不幸,Red Hat 最新(Cobbler项目最初在2008年左右发布)发布了网络安装服务器套件 Cobbler(补鞋匠),它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会。对于我们这些在装机领域经营多年,经验丰富,老骥伏枥,志在千里的民工兄弟们来说,不啻为一个晴天霹雳。

--来自百度百科[aru_41]

Cobbler介绍

Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows。

该工具使用python开发,小巧轻便(才15k行python代码),可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS,TFTP、RSYNC以及yum仓库、构造系统ISO镜像。

Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。

Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。

Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。

基础配置环境准备(重要)

[root@try2~]# getenforce #检测selinux是否关闭(必须关闭)
Disabled
[root@try2 ~]# /etc/init.d/iptables status #检测防火墙是否关闭(必须关闭)
iptables: Firewall is not running.
[root@try2 ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo #cobbler的安装必须使用到epel源

注意:最好yum源也使用成阿里云的源
注意:同一个网关里建议使用NAT模式,不然容易DHCP冲突哦,但是我还是用了桥接模式来做,哈哈哈

开始安装cobbler

[root@try2 ~]# yum install cobbler cobbler-web pykickstart httpd dhcp tftp-server-y
cobbler #cobbler程序包
cobbler-web #cobbler的web服务包
pykickstart #cobbler检查kickstart语法错误
httpd #Apache web服务
dhcp #dhcp服务
tftp-server #tftp服务

#注意如果yum cobbler-web cobbler报错的话,[aru_39]

报错Django >= 1.4
Error: Package: cobbler-web-2.6.11-6.git95749a6.el6.noarch (epel)
Requires: Django >= 1.4

解决办法在这里

[root@try2 ~]# rpm -ql cobbler # 查看安装的文件,下面列出部分。

cobbler安装的文件

配置Cobbler

cobbler的运行主要依赖于dhcp、tftp、rsync。

cobbler的配置文件是:/etc/cobbler/settings

[root@try2 cobbler]# /etc/init.d/httpd restart #启动httpd服务
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for cobbler
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
#遇见报错需要修改httpd的配置文件,任意位置添加一行
[root@try2 cobbler]# vim /etc/httpd/conf/httpd.conf
ServerName localhost:80
#然后再重启
[root@try2 cobbler]# /etc/init.d/httpd restart
停止                                                             httpd: [ OK ]
启动                                                             httpd: [ OK ]

温馨提示

然后还要启动xinetd服务,总共启动这几个服务:xinetd,httpd,dhcpd(后面配置完了再启动)

检查Cobbler配置

[root@cobbler cobbler]# cobbler check #检查cobbler配置,然后解决报错
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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : 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.
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : file /etc/xinetd.d/rsync does not exist
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : 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
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

Cobbler报错解决

报错1修改/etc/cobbler/settings文件中的server参数的值为提供cobbler服务的主机相应的IP地址或主机名,可以先备份一下。

# server,Cobbler服务器的IP,修改384行server: 127.0.0.1 (修改成你自己的ip)

报错2:修改/etc/cobbler/settings文件中的next_server参数的值为提供PXE服务的主机相应的IP地址

#修改272行next_server: 127.0.0.1(修改成你自己的ip)

报错3:修改/etc/xinetd.d/tftp文件中的disable参数修改为 disable = no

报错4:执行 cobbler get-loaders 命令,等待下载安装完成就OK

报错5:修改rsync配置文件vim /etc/xinetd.d/rsync

#修改disable = no

报错7:安装debmirror

#命令: yum install -y debmirror

温馨提示

断网了,还没写完,有机会再继续写吧。。。

安装与配置Cobbler(Linux自动安装)


 

打赏
发表评论 取消回复
表情 图片 链接 代码