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
驗證結果: