1 Cobbler服務器端系統環境配置
1.1 系統基本環境准備
[root@cobbler-server ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@cobbler-server ~]# uname -r 3.10.0-327.el7.x86_64 [root@cobbler-server ~]# getenforce Disabled [root@cobbler-server ~]# hostname cobbler-server [root@cobbler-server ~]# python -V Python 2.7.5 [root@cobbler-server ~]# firewall-cmd --state not running [root@cobbler-server ~]# ifconfig eth0 | awk -F " " 'NR==2{print $2}' 172.16.0.2 [root@cobbler-server ~]# echo "172.16.0.2 cobbler-server" >> /etc/hosts [root@cobbler-server ~]# ping cobbler-server PING cobbler-server (172.16.0.2) 56(84) bytes of data. 64 bytes from cobbler-server (172.16.0.2): icmp_seq=1 ttl=64 time=0.058 ms 64 bytes from cobbler-server (172.16.0.2): icmp_seq=2 ttl=64 time=0.059 ms
1.1 安裝配置阿里雲epel源
[root@cobbler-server ~]# rpm -Uvh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
Retrieving https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.BkU6SS: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-7-11 ################################# [100%]
[root@cobbler-server ~]# ls -lh /etc/yum.repos.d/epel*
-rw-r--r-- 1 root root 951 Oct 3 2017 /etc/yum.repos.d/epel.repo
-rw-r--r-- 1 root root 1.1K Oct 3 2017 /etc/yum.repos.d/epel-testing.repo
[root@cobbler-server ~]# yum clean all
[root@cobbler-server ~]# yum makecache
注意:我們選擇Vmware Workstation虛擬機演示,故需要關閉NAT模式下的DHCP服務
2 Cobbler服務部署配置
2.1 安裝Cobbler組件服務
[root@cobbler-server ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: mirrors.tongji.edu.cn
* extras: ftp.sjtu.edu.cn
* updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package cobbler.x86_64 0:2.8.2-1.el7 will be installed
--> Processing Dependency: PyYAML for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: createrepo for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: genisoimage for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: mod_wsgi for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: python-cheetah for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: python-netaddr for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: python-simplejson for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: rsync for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: yum-utils for package: cobbler-2.8.2-1.el7.x86_64
---> Package cobbler-web.noarch 0:2.8.2-1.el7 will be installed
--> Processing Dependency: mod_ssl for package: cobbler-web-2.8.2-1.el7.noarch
--> Processing Dependency: python-django for package: cobbler-web-2.8.2-1.el7.noarch
---> Package dhcp.x86_64 12:4.2.5-58.el7.centos will be updated
---> Package dhcp.x86_64 12:4.2.5-68.el7.centos.1 will be an update
--> Processing Dependency: dhcp-libs(x86-64) = 12:4.2.5-68.el7.centos.1 for package: 12:dhcp-4.2.5-68.el7.centos.1.x86_64
--> Processing Dependency: dhcp-common = 12:4.2.5-68.el7.centos.1 for package: 12:dhcp-4.2.5-68.el7.centos.1.x86_64
---> Package httpd.x86_64 0:2.4.6-67.el7.centos.6 will be updated
---> Package httpd.x86_64 0:2.4.6-80.el7.centos will be an update
--> Processing Dependency: httpd-tools = 2.4.6-80.el7.centos for package: httpd-2.4.6-80.el7.centos.x86_64
---> Package pykickstart.noarch 0:1.99.66.18-1.el7 will be installed
---> Package tftp-server.x86_64 0:5.2-13.el7 will be updated
---> Package tftp-server.x86_64 0:5.2-22.el7 will be an update
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package createrepo.noarch 0:0.9.9-28.el7 will be installed
--> Processing Dependency: python-deltarpm for package: createrepo-0.9.9-28.el7.noarch
--> Processing Dependency: libxml2-python for package: createrepo-0.9.9-28.el7.noarch
--> Processing Dependency: deltarpm for package: createrepo-0.9.9-28.el7.noarch
---> Package dhcp-common.x86_64 12:4.2.5-58.el7.centos will be updated
--> Processing Dependency: dhcp-common = 12:4.2.5-58.el7.centos for package: 12:dhclient-4.2.5-58.el7.centos.x86_64
---> Package dhcp-common.x86_64 12:4.2.5-68.el7.centos.1 will be an update
---> Package dhcp-libs.x86_64 12:4.2.5-58.el7.centos will be updated
---> Package dhcp-libs.x86_64 12:4.2.5-68.el7.centos.1 will be an update
---> Package genisoimage.x86_64 0:1.1.11-23.el7 will be installed
--> Processing Dependency: libusal = 1.1.11-23.el7 for package: genisoimage-1.1.11-23.el7.x86_64
--> Processing Dependency: libusal.so.0()(64bit) for package: genisoimage-1.1.11-23.el7.x86_64
--> Processing Dependency: librols.so.0()(64bit) for package: genisoimage-1.1.11-23.el7.x86_64
---> Package httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 will be updated
---> Package httpd-tools.x86_64 0:2.4.6-80.el7.centos will be an update
---> Package mod_ssl.x86_64 1:2.4.6-80.el7.centos will be installed
---> Package mod_wsgi.x86_64 0:3.4-12.el7_0 will be installed
---> Package python-cheetah.x86_64 0:2.4.4-5.el7.centos will be installed
--> Processing Dependency: python-pygments for package: python-cheetah-2.4.4-5.el7.centos.x86_64
--> Processing Dependency: python-markdown for package: python-cheetah-2.4.4-5.el7.centos.x86_64
---> Package python-netaddr.noarch 0:0.7.5-9.el7 will be installed
---> Package python2-django.noarch 0:1.6.11.7-1.el7 will be installed
--> Processing Dependency: python-django-bash-completion = 1.6.11.7-1.el7 for package: python2-django-1.6.11.7-1.el7.noarch
---> Package python2-simplejson.x86_64 0:3.10.0-1.el7 will be installed
---> Package rsync.x86_64 0:3.1.2-4.el7 will be installed
---> Package yum-utils.noarch 0:1.1.31-45.el7 will be installed
--> Processing Dependency: yum >= 3.4.3-143 for package: yum-utils-1.1.31-45.el7.noarch
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-45.el7.noarch
--> Running transaction check
---> Package deltarpm.x86_64 0:3.6-3.el7 will be installed
---> Package dhclient.x86_64 12:4.2.5-58.el7.centos will be updated
---> Package dhclient.x86_64 12:4.2.5-68.el7.centos.1 will be an update
---> Package libusal.x86_64 0:1.1.11-23.el7 will be installed
---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed
---> Package libyaml.x86_64 0:0.1.4-11.el7_0 will be installed
---> Package python-deltarpm.x86_64 0:3.6-3.el7 will be installed
---> Package python-django-bash-completion.noarch 0:1.6.11.7-1.el7 will be installed
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
---> Package python-markdown.noarch 0:2.4.1-2.el7 will be installed
---> Package python-pygments.noarch 0:1.4-10.el7 will be installed
--> Processing Dependency: python-setuptools for package: python-pygments-1.4-10.el7.noarch
--> Processing Dependency: python-imaging for package: python-pygments-1.4-10.el7.noarch
---> Package yum.noarch 0:3.4.3-132.el7.centos.0.1 will be updated
---> Package yum.noarch 0:3.4.3-158.el7.centos will be an update
--> Processing Dependency: python-urlgrabber >= 3.10-8 for package: yum-3.4.3-158.el7.centos.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
---> Package python-pillow.x86_64 0:2.0.0-19.gitd1c6db8.el7 will be installed
--> Processing Dependency: libtiff.so.5(LIBTIFF_4.0)(64bit) for package: python-pillow-2.0.0-19.gitd1c6db8.el7.x86_64
--> Processing Dependency: libwebp.so.4()(64bit) for package: python-pillow-2.0.0-19.gitd1c6db8.el7.x86_64
--> Processing Dependency: libtiff.so.5()(64bit) for package: python-pillow-2.0.0-19.gitd1c6db8.el7.x86_64
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
---> Package python-urlgrabber.noarch 0:3.10-7.el7 will be updated
---> Package python-urlgrabber.noarch 0:3.10-8.el7 will be an update
--> Running transaction check
---> Package libtiff.x86_64 0:4.0.3-27.el7_3 will be installed
--> Processing Dependency: libjbig.so.2.0()(64bit) for package: libtiff-4.0.3-27.el7_3.x86_64
---> Package libwebp.x86_64 0:0.3.0-7.el7 will be installed
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package jbigkit-libs.x86_64 0:2.0-11.el7 will be installed
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================
Installing:
cobbler x86_64 2.8.2-1.el7 epel 574 k
cobbler-web noarch 2.8.2-1.el7 epel 287 k
pykickstart noarch 1.99.66.18-1.el7 base 359 k
Updating:
dhcp x86_64 12:4.2.5-68.el7.centos.1 updates 513 k
httpd x86_64 2.4.6-80.el7.centos base 2.7 M
tftp-server x86_64 5.2-22.el7 base 47 k
Installing for dependencies:
PyYAML x86_64 3.10-11.el7 base 153 k
createrepo noarch 0.9.9-28.el7 base 94 k
deltarpm x86_64 3.6-3.el7 base 82 k
genisoimage x86_64 1.1.11-23.el7 base 298 k
jbigkit-libs x86_64 2.0-11.el7 base 46 k
libtiff x86_64 4.0.3-27.el7_3 base 170 k
libusal x86_64 1.1.11-23.el7 base 135 k
libwebp x86_64 0.3.0-7.el7 base 170 k
libxml2-python x86_64 2.9.1-6.el7_2.3 base 247 k
libyaml x86_64 0.1.4-11.el7_0 base 55 k
mod_ssl x86_64 1:2.4.6-80.el7.centos base 111 k
mod_wsgi x86_64 3.4-12.el7_0 base 76 k
python-backports x86_64 1.0-8.el7 base 5.8 k
python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k
python-chardet noarch 2.2.1-1.el7_1 base 227 k
python-cheetah x86_64 2.4.4-5.el7.centos extras 341 k
python-deltarpm x86_64 3.6-3.el7 base 31 k
python-django-bash-completion noarch 1.6.11.7-1.el7 epel 17 k
python-ipaddress noarch 1.0.16-2.el7 base 34 k
python-kitchen noarch 1.1.1-5.el7 base 267 k
python-markdown noarch 2.4.1-2.el7 epel 186 k
python-netaddr noarch 0.7.5-9.el7 base 983 k
python-pillow x86_64 2.0.0-19.gitd1c6db8.el7 base 438 k
python-pygments noarch 1.4-10.el7 base 599 k
python-setuptools noarch 0.9.8-7.el7 base 397 k
python2-django noarch 1.6.11.7-1.el7 epel 4.0 M
python2-simplejson x86_64 3.10.0-1.el7 epel 188 k
rsync x86_64 3.1.2-4.el7 base 403 k
yum-utils noarch 1.1.31-45.el7 base 119 k
Updating for dependencies:
dhclient x86_64 12:4.2.5-68.el7.centos.1 updates 284 k
dhcp-common x86_64 12:4.2.5-68.el7.centos.1 updates 175 k
dhcp-libs x86_64 12:4.2.5-68.el7.centos.1 updates 131 k
httpd-tools x86_64 2.4.6-80.el7.centos base 89 k
python-urlgrabber noarch 3.10-8.el7 base 108 k
yum noarch 3.4.3-158.el7.centos base 1.2 M
Transaction Summary
=====================================================================================================================================
Install 3 Packages (+29 Dependent packages)
Upgrade 3 Packages (+ 6 Dependent packages)
Total download size: 16 M
2.2 檢查cobbler組件服務軟件包是否安裝成功
[root@cobbler-server ~]# rpm -qa cobbler cobbler-web dhcp tftp-server pykickstart httpd
dhcp-4.2.5-68.el7.centos.1.x86_64
httpd-2.4.6-80.el7.centos.x86_64
cobbler-2.8.2-1.el7.x86_64
pykickstart-1.99.66.18-1.el7.noarch
tftp-server-5.2-22.el7.x86_64
cobbler-web-2.8.2-1.el7.noarch
2.3 啟動cobblerd、httpd服務並加入到開機啟動
[root@cobbler-server ~]# systemctl start cobblerd
[root@cobbler-server ~]# systemctl enable cobblerd
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@cobbler-server ~]# systemctl start httpd
[root@cobbler-server ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
2.4 檢查cobbler配置
[root@cobbler-server ~]# 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 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : 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
7 : 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.
2.5 解決檢查cobbler配置出現的問題
#備份cobbler主配置文件 [root@cobbler-server ~]# cp -a /etc/cobbler/settings{,.ori} [root@cobbler-server ~]# ls -ld /etc/cobbler/settings* -rw-r--r-- 1 root root 19648 Sep 18 2017 /etc/cobbler/settings -rw-r--r-- 1 root root 19648 Sep 18 2017 /etc/cobbler/settings.ori #第1個問題修改server字段(cobbler服務器IP地址) [root@cobbler-server ~]# sed -i 's#server: 127.0.0.1#server: 172.16.0.2#g' /etc/cobbler/settings #第2個問題修改next_server字段(Cobbler管理DHCP,修改本項為cobbler IP地址) [root@cobbler-server ~]# sed -i 's#next_server: 127.0.0.1#next_server: 172.16.0.2#g' /etc/cobbler/settings #第3個問題,從cobbler官網下載內容存放到/var/lib/cobbler/loaders目錄 [root@cobbler-server ~]# cobbler get-loaders task started: 2018-05-23_213102_get_loaders task started (id=Download Bootloader Content, time=Wed May 23 21:31:02 2018) downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0 downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32 downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi *** TASK COMPLETE *** [root@cobbler-server ~]# cd /var/lib/cobbler/loaders [root@cobbler-server loaders]# ls COPYING.elilo COPYING.syslinux COPYING.yaboot elilo-ia64.efi grub-x86_64.efi grub-x86.efi menu.c32 pxelinux.0 README yaboot #第4個問題,開啟rsyncd服務並加入到開機啟動 [root@cobbler-server ~]# systemctl start rsyncd [root@cobbler-server ~]# systemctl enable rsyncd Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service. #第6個問題,設置默認新裝系統的默認root密碼為gh@19910310,'random-phrase-here'干擾項,可自行設置 [root@cobbler-server ~]# openssl passwd -1 -salt 'cobbler' 'input your passwd' $1$cobbler$PiDtVqlUOm0wm2Hx9YKiq0 [root@cobbler-server ~]# vi /etc/cobbler/settings default_password_crypted: "$1$cobbler$PiDtVqlUOm0wm2Hx9YKiq0" #啟用cobbler管理dhcp [root@cobbler-server ~]# sed -i 's#manage_dhcp: 0#manage_dhcp: 1#g' /etc/cobbler/settings #防止循環裝系統,適用於服務器第一啟動項是pxe啟動(自動進行安裝) [root@cobbler-server ~]# sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings #解決完以上問題,重啟cobblerd服務 [root@cobbler-server ~]# systemctl restart cobblerd #再次執行cobbler check檢查cobbler配置 [root@cobbler-server ~]# cobbler check The following are potential configuration items that you may want to fix: 1 : debmirror package is not installed, it will be required to manage debian deployments and repositories #和debian系統相關,忽略它 2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them #fence設備相關,忽略它 Restart cobblerd and then run 'cobbler sync' to apply changes.
2.6 配置DHCP
[root@cobbler-server ~]# cp -a /etc/cobbler/dhcp.template{,.ori} [root@cobbler-server ~]# vi /etc/cobbler/dhcp.template subnet 172.16.0.0 netmask 255.255.255.0 { option routers 172.16.0.1; option domain-name-servers 172.16.0.1; option subnet-mask 255.255.255.0; range dynamic-bootp 172.16.1.100 172.16.1.200; default-lease-time 21600; max-lease-time 43200; next-server $next_server; }
2.7 同步cobbler配置
[root@cobbler-server ~]# cobbler sync task started: 2018-05-23_222414_sync task started (id=Sync, time=Wed May 23 22:24:14 2018) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/pxelinux.cfg/default removing: /var/lib/tftpboot/grub/images removing: /var/lib/tftpboot/grub/grub-x86.efi removing: /var/lib/tftpboot/grub/grub-x86_64.efi removing: /var/lib/tftpboot/grub/efidefault removing: /var/lib/tftpboot/s390x/profile_list copying bootloaders trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi copying distros to tftpboot copying images generating PXE configuration files generating PXE menu structure rendering DHCP files generating /etc/dhcp/dhcpd.conf rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches running post-sync triggers running python triggers from /var/lib/cobbler/triggers/sync/post/* running python trigger cobbler.modules.sync_post_restart_services running: dhcpd -t -q received on stdout: received on stderr: dhcpd -t failed Exception occured: <class 'cobbler.cexceptions.CX'> Exception value: 'cobbler trigger failed: cobbler.modules.sync_post_restart_services' Exception Info: File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 82, in run rc = self._run(self) File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 181, in runner return self.remote.api.sync(self.options.get("verbose",False),logger=self.logger) File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 763, in sync return sync.run() File "/usr/lib/python2.7/site-packages/cobbler/action_sync.py", line 144, in run utils.run_triggers(self.api, None, "/var/lib/cobbler/triggers/sync/post/*", logger=self.logger) File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 928, in run_triggers raise CX("cobbler trigger failed: %s" % m.__name__) !!! TASK FAILED !!!
報錯處理:出現“!!! TASK FAILED !!!”,查看/var/log/messages日志,發現是DHCP配置文件中地址池網段配置有問題,更改/etc/cobbler/dhcp.template中的172.16.1.0為172.16.0.0
[root@cobbler-server ~]# tail -100 /var/log/messages
May 23 22:21:00 server dhcpd:
May 23 22:21:00 server dhcpd: exiting.
May 23 22:24:15 server dhcpd: bad range, address 172.16.1.100 not in subnet 172.16.0.0 netmask 255.255.255.0
May 23 22:24:15 server dhcpd:
May 23 22:24:15 server dhcpd: This version of ISC DHCP is based on the release available
May 23 22:24:15 server dhcpd: on ftp.isc.org. Features have been added and other changes
May 23 22:24:15 server dhcpd: have been made to the base software release in order to make
May 23 22:24:15 server dhcpd: it work better with this distribution.
May 23 22:24:15 server dhcpd:
May 23 22:24:15 server dhcpd: Please report for this software via the CentOS Bugs Database:
May 23 22:24:15 server dhcpd: http://bugs.centos.org/
May 23 22:24:15 server dhcpd:
May 23 22:24:15 server dhcpd: exiting.
2.8 再次重啟cobblerd服務並執行cobbler sync成功
[root@cobbler-server ~]# systemctl restart cobblerd [root@cobbler-server ~]# cobbler sync task started: 2018-05-23_222742_sync task started (id=Sync, time=Wed May 23 22:27:42 2018) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/pxelinux.cfg/default removing: /var/lib/tftpboot/grub/images removing: /var/lib/tftpboot/grub/grub-x86.efi removing: /var/lib/tftpboot/grub/grub-x86_64.efi removing: /var/lib/tftpboot/grub/efidefault removing: /var/lib/tftpboot/s390x/profile_list copying bootloaders trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi copying distros to tftpboot copying images generating PXE configuration files generating PXE menu structure rendering DHCP files generating /etc/dhcp/dhcpd.conf rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches running post-sync triggers running python triggers from /var/lib/cobbler/triggers/sync/post/* running python trigger cobbler.modules.sync_post_restart_services running: dhcpd -t -q received on stdout: received on stderr: running: service dhcpd restart received on stdout: received on stderr: Redirecting to /bin/systemctl restart dhcpd.service running shell triggers from /var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.scm_track running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
2.9 查看DHCP服務配置文件(cobbler會覆蓋系統默認的DHCP配置文件)
[root@cobbler-server ~]# less /etc/dhcp/dhcpd.conf # ****************************************************************** # Cobbler managed dhcpd.conf file # generated from cobbler dhcp.conf template (Wed May 23 14:27:43 2018) # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be # overwritten. # ****************************************************************** ddns-update-style interim; allow booting; allow bootp; ignore client-updates; set vendorclass = option vendor-class-identifier; option pxe-system-type code 93 = unsigned integer 16; subnet 172.16.0.0 netmask 255.255.255.0 { option routers 172.16.0.1; option domain-name-servers 172.16.0.1; option subnet-mask 255.255.255.0; range dynamic-bootp 172.16.0.100 172.16.0.200; default-lease-time 21600; max-lease-time 43200; next-server 172.16.0.2; }
2.10 檢查cobbler組件服務是否啟動
[root@cobbler-server ~]# systemctl list-unit-files | egrep "cobblerd|\bdhcpd\b|httpd|xinetd"
cobblerd.service enabled
dhcpd.service enabled
httpd.service enabled
xinetd.service enabled
3 cobbler命令行配置管理
3.1 導入系統鏡像
#掛載光盤鏡像到/mnt目錄下 [root@cobbler-server ~]# mount /dev/sr0 /mnt mount: /dev/sr0 is write-protected, mounting read-only [root@cobbler-server ~]# cd /mnt/ [root@cobbler-server mnt]# ls CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7 EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL #運行cobbler import導入系統鏡像 [root@cobbler-server mnt]# cobbler import --name=CentOS-7-x86_64 --arch=x86_64 --path=/mnt #列出導入的發行版鏡像 [root@cobbler-server mnt]# cobbler distro list CentOS-7-x86_64 #列出導入的配置文件 [root@cobbler-server mnt]# cobbler profile list CentOS-7-x86_64 #導入系統鏡像存放目錄位置 [root@cobbler-server mnt]# cd /var/www/cobbler/ks_mirror/ [root@cobbler-server ks_mirror]# ls CentOS-7-x86_64 config #查看指定導入發行版鏡像詳細信息 [root@cobbler-server ks_mirror]# cobbler distro report --name CentOS-7-x86_64 Name : CentOS-7-x86_64 Architecture : x86_64 TFTP Boot Files : {} Breed : redhat Comment : Fetchable Files : {} Initrd : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/initrd.img Kernel : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/vmlinuz Kernel Options : {} Kernel Options (Post Install) : {} Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS-7-x86_64'} Management Classes : [] OS Version : rhel7 Owners : ['admin'] Red Hat Management Key : <<inherit>> Red Hat Management Server : <<inherit>> Template Files : {}
4 客戶端安裝操作系統
4.1 創建一個新的虛擬機,開機進入以下界面
#顯示的網址不是我們想要的,可以通過修改/etc/cobbler/pxe/pxedefault.template配置文件
[root@cobbler-server ~]# vi /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/ #->http://www.wolf_dreams.com
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENU end
4.2 執行cobbler sync同步配置,並重啟客戶機
[root@cobbler-server ~]# cobbler sync
4.3 重啟客戶機,再次查看開機畫面
5 Cobbler Web管理界面安裝配置
5.1 基本設置
1、安裝cobbler-web軟件包 #yum -y install cobbler-web
2、訪問網址:https://172.16.0.2/cobbler_web or https://cobbler-server/cobbler-web
3、修改C:\Windows\System32\drivers\etc\hosts

#添加如下內容,即可通過cobbler主機名的方式訪問web界面
172.16.0.2 cobbler-server
4、cobbler Web服務主要配置文件說明
/etc/cobbler/users.conf # Web服務授權配置文件
/etc/cobbler/users.digest # 用於web訪問的用戶名密碼配置文件
5、更改用戶cobbler的登錄密碼
[root@cobbler-server ~]# cat /etc/cobbler/users.digest
cobbler:Cobbler:d446222780e11f9a547d0579ed2bdc3e
[root@cobbler-server ~]#htdigest /etc/cobbler/users.digest "Cobbler" cobbler
Changing password for user cobbler in realm Cobbler
New password: input your password
Re-type new password: input your password
6、重啟Apache和Cobblerd服務
[root@cobbler-server ~]# systemctl restart cobblerd
[root@cobbler-server ~]# systemctl restart httpd
5.2 Cobbler登錄界面
用戶名:cobbler
密碼:input your password(htdigest /etc/cobbler/users.digest "Cobbler" cobbler設置)
5.3 Cobbler導入的發行版鏡像
5.4 Cobbler導入的發行版配置文件