基于Centos7.2搭建Cobbler自动化批量部署操作系统服务
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导入的发行版配置文件
基于Centos7.2搭建Cobbler自动化批量部署操作系统服务的更多相关文章
- Cobbler自动化批量部署CentOS6.5系统
Cobbler作为一个预备工具,使批量部署Red Hat/Centos/Fedora系统更容易,同时也支持Suse和Debian系统的部署. 它提供以下服务集成: * PXE服务支持 * DHCP服务 ...
- Jenkins +svn +maven +tomcat+ ansible 自动化批量部署
Jenkins +svn +maven +tomcat+ ansible 自动化批量部署 一.部署svn yum install subversion 先创建目录 mkdir /home/svn 创建 ...
- 进阶!基于CentOS7系统使用cobbler实现单台服务器批量自动化安装不同版本系统(week3_day5_part2)-技术流ken
前言 在上一篇博文<cobbler批量安装系统使用详解-技术流ken>中已经详细讲解了cobbler的使用以及安装,本篇博文将会使用单台cobbler实现自动化批量安装不同版本的操作系统. ...
- Cobbler自动化批量安装Linux操作系统 - 运维总结
一.Cobbler简述 Cobbler是一个自动化和简化系统安装的工具,通过使用网络引导来控制和启动安装.Cobbler的特性包括存储库镜像.Kickstart模板和连接电源管理系统.Cobbler通 ...
- Cobbler自动化安装部署系统
自动化安装部署 https://www.cnblogs.com/nulige/p/6796593.html PXE+Kickstart工作原理 pxe+kickstart工作流程 网卡上的pxe芯片有 ...
- 基于Centos7.4搭建prometheus+grafana+altertManger监控Spring Boot微服务(docker版)
目的:给我们项目的微服务应用都加上监控告警.在这之前你需要将 Spring Boot Actuator引入 本章主要介绍 如何集成监控告警系统Prometheus 和图形化界面Grafana 如何自定 ...
- Cobbler自动化批量安装linux服务器的操作记录
Cobbler为何物?Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命 ...
- 基于centos7+nginx+uwsgi+python3+django2.0部署Django项目
0.序言 本文讲解如何基于centos7+nginx+uwsgi+python3+django2.0把windows上的本地项目部署到云服务器上. 本文服务器上的django项目和虚拟环境的路径将建立 ...
- 基于Centos7.2使用Cobbler工具定制化批量安装Centos7.2系统
1.1 定制Centos_7_x86_64.ks文件内容 # Cobbler for Kickstart Configurator for CentOS 7.2.1511 by Wolf_Dre ...
随机推荐
- Sass 愿景
在最近的一个 CSS 见面会上,我向与会者提问,“有人会在日常的工作流中使用 Sass 吗?”回答结果压倒性的表示肯定——保守谨慎地使用 Sass 已经成为过去式.Sass 正迅速成长为编写 CSS ...
- bzoj 5393 [HAOI2018] 反色游戏
bzoj 5393 [HAOI2018] 反色游戏 Link Solution 最简单的性质:如果一个连通块黑点个数是奇数个,那么就是零(每次只能改变 \(0/2\) 个黑点) 所以我们只考虑偶数个黑 ...
- 长春理工大学第十四届程序设计竞赛(重现赛)F.Successione di Fixoracci
链接:https://ac.nowcoder.com/acm/contest/912/F 题意: 动态规划(Dynamic programming,简称dp)是一种通过把原问题分解为相对简单的子问题的 ...
- 不可见类有抽象父类,spring配置子类bean,注入父类,aop就可以切父类的方法
public class TestBeanChild { int b = 1; public TestBean createDefault() { return new TestBeanDefault ...
- java Integer
Java 中的数据类型分为基本数据类型和引用数据类型 int是基本数据类型,Integer是引用数据类型: Ingeter是int的包装类,int的初值为0,Ingeter的初值为null. 初始化 ...
- High waits on control file sequential read
High waits on control file sequential read (文档 ID 2277867.1) In case we run into an issue where cont ...
- 对于es线程池使用的思考
es有内置的线程池 在实际项目中,发现 使用client框架关闭连接太慢(其实是把连接归还到池子里),采用异步关闭. 随着连接的关闭,计算机内存在不断下降 ------------------- ...
- A. Arya and Bran
A. Arya and Bran time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- 点权生成树(gentree)
点权生成树(gentree) 题目背景 Awson是某国际学校信竞组的一只菜鸡.终于弄明白边权最小生成树后,然而又被大神嘲笑了.大神深邃的眼光中透露了些睿智,说道:“你会求点权最小生成树么?”Awso ...
- 图解css3のborder-radius
早期制作圆角都是使用图片来实现.通过用1px 的水平线条来堆叠出圆角或者利用JavaScript等等方法,但是都是需要增加多个无意义的标签来实现,造成代码亢余.如今有了CSS3的圆角属性——borde ...