Coobler简介
Cobbler是一款快速的网络系统部署工具,其最大的特点是集合了所有系统部署所需服务,如DHCP、DNS、TFTP,这样你在部署一台操作系统的时候不需要在各个服务之前协调切换,Cobbler都可以替你来管理,Cobbler内部集成了一个镜像版本仓库,你可以自定义相关配置文件,实现不同系统不同安装需求的选择;当然,Cobbler还提供了包括yum源管理、Web界面管理、API接口、电源管理等功能,方便你自定义开发管理。通过将设置和管理一个安装服务器所涉及的任务集中在一起,从而简化了系统配置。
准备环境
1.安装cobbler:
[root@Master /]#yum install cobbler httpd cobbler-web debmirror pykickstart
2.安装system-config-kickstart用于生成ks文件
[root@Master /]#yum install system-config-kickstart
3.主要配置文件
[root@Master cobbler]# ls
modules.conf //模块配置文件
*.template //各服务配置文件样板
settings //主要配置文件
users.conf //配置登录用户
4,启动并初始化cobbler
[root@Master cobbler]# service cobblerd start
Starting cobbler daemon: [确定]
[root@Master cobbler]# cobbler check
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
***此情况下可能selinux处于开启状态,请关闭selinux***
Traceback (most recent call last):
File "/usr/bin/cobbler", line 36, in <module>
sys.exit(app.main()).....
**解决方法从新启动cobbler并且执行以下命令**
[root@Master cobbler]# cobbler get-loaders
[root@Master cobbler]# 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 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
https://github.com/cobbler/cobbler/wiki/Selinux
4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : comment out 'dists' on /etc/debmirror.conf for proper debian support
7 : comment out 'arches' on /etc/debmirror.conf for proper debian support
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.
根据以上提示更改配置文件
a.改变/etc/cobbler/settings配置文件
[root@Master cobbler]#vim settings
272 next_server: 192.168.100.110 //此ip可以通过外网进行访问
384 server: 192.168.100.110
b.编辑/etc/xinetd.d/rsync和/etc/xinetd.d/rsync
[root@Master cobbler]#vim /etc/xinetd.d/rsyns /etc/xinetd.d/rsync
6 disable = no //关闭reyns的开机自启动
c.注释掉/etc/debmirror.conf中的dists和arches指令
28 #@dists="sid";
30 #@arches="i386";
d.使用openssl命令生成密码,写进配置文件
[root@Master cobbler]# openssl passwd -1 -salt "jifesdqwdcs"
Password:
$1$jifesdqw$o2T1Oq41h/9EivqobDX8D.
[root@Master cobbler]# vim settings
101 default_password_crypted: "$1$jifesdqw$o2T1Oq41h/9EivqobDX8D."
5.设置cobbler是否托管DHCP,TFTP,rsync,dns
[root@Master cobbler]# vim settings
258 manage_tftpd: 1 //tftp让cobbler进行托管
261 manage_rsync: 0 //cobbler不进行rsync托管
242 manage_dhcp: 0
246 manage_dns: 0
6.安装dhcp并配置dhcp服务,启动
[root@Master cobbler]# vim /etc/dhcp/dhcpd.conf
28 subnet 192.168.100.0 netmask 255.255.255.0 {
29 range 192.168.100.100 192.168.100.200;
30 option routers 192.168.100.1;
31 }
7.使用system-config-kickstart
8.配置distros:(命令 cobbler distro)
[root@Master ~]# cobbler distro list //查看distro列表
[root@Master ~]# cobbler distro add //添加一个distro
--name is required
[root@Master ~]# cobbler import --name="contes6.8" --path=/media/CentOS_6.8_Final //若:已经存在安装结构树,或者iso文件一定挂在至本地,要是cobbler import命令,导入文件,将文件导入到/var/www/cobbler/目录下
task started: 2017-05-11_215905_import
task started (id=Media import, time=Thu May 11 21:59:05 2017)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/contes6.8:
creating new distro: contes6.8-x86_64
trying symlink: /var/www/cobbler/ks_mirror/contes6.8 -> /var/www/cobbler/links/contes6.8-x86_64
creating new profile: contes6.8-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/contes6.8 for contes6.8-x86_64
processing repo at : /var/www/cobbler/ks_mirror/contes6.8
need to process repo/comps: /var/www/cobbler/ks_mirror/contes6.8
looking for /var/www/cobbler/ks_mirror/contes6.8/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/contes6.8/repodata
*** TASK COMPLETE ***
[root@Master ~]# cobbler distro list
contes6.8-x86_64
9.配置profile(命令cobbler profile) //在此可以定义同一版本不同的安装
[root@Master ~]# cobbler profile add --name="contes6.8" --distro="contes6.8-x86_64" --kickstart="/var/lib/cobbler/kickstarts/centos.cfg"
[root@Master ~]# cobbler profile list
contes6.8
contes6.8-x86_64
验证结果: