博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
基于Centos7.2搭建Cobbler自动化批量部署操作系统服务
阅读量:7112 次
发布时间:2019-06-28

本文共 30851 字,大约阅读时间需要 102 分钟。

1       Cobbler服务器端系统环境配置

1.1     系统基本环境准备

[root@cobbler-server ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@cobbler-server ~]# uname -r3.10.0-327.el7.x86_64[root@cobbler-server ~]# getenforceDisabled[root@cobbler-server ~]# hostnamecobbler-server[root@cobbler-server ~]# python -VPython 2.7.5[root@cobbler-server ~]# firewall-cmd --statenot 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-serverPING 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 ms64 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.rpmRetrieving https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpmwarning: /var/tmp/rpm-tmp.BkU6SS: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEYPreparing...                          ################################# [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 httpdLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.cn99.com * epel: mirrors.tongji.edu.cn * extras: ftp.sjtu.edu.cn * updates: mirrors.cn99.comResolving 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 ResolutionDependencies 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 kUpdating: 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 kInstalling 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 kUpdating 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 MTransaction 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 httpddhcp-4.2.5-68.el7.centos.1.x86_64httpd-2.4.6-80.el7.centos.x86_64cobbler-2.8.2-1.el7.x86_64pykickstart-1.99.66.18-1.el7.noarchtftp-server-5.2-22.el7.x86_64cobbler-web-2.8.2-1.el7.noarch

2.3     启动cobblerd、httpd服务并加入到开机启动

[root@cobbler-server ~]# systemctl start cobblerd[root@cobbler-server ~]# systemctl enable cobblerdCreated 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 httpdCreated 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 checkThe 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 systemctl5 : debmirror package is not installed, it will be required to manage debian deployments and repositories6 : 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 one7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use themRestart 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-loaderstask started: 2018-05-23_213102_get_loaderstask 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/READMEdownloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilodownloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yabootdownloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinuxdownloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efidownloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yabootdownloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efidownloading 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]# lsCOPYING.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 rsyncdCreated 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/settingsdefault_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 checkThe 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.templatesubnet 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_synctask started (id=Sync, time=Wed May 23 22:24:14 2018)running pre-sync triggerscleaning treesremoving: /var/lib/tftpboot/pxelinux.cfg/defaultremoving: /var/lib/tftpboot/grub/imagesremoving: /var/lib/tftpboot/grub/grub-x86.efiremoving: /var/lib/tftpboot/grub/grub-x86_64.efiremoving: /var/lib/tftpboot/grub/efidefaultremoving: /var/lib/tftpboot/s390x/profile_listcopying bootloaderstrying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efitrying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.eficopying distros to tftpbootcopying imagesgenerating PXE configuration filesgenerating PXE menu structurerendering DHCP filesgenerating /etc/dhcp/dhcpd.confrendering TFTPD filesgenerating /etc/xinetd.d/tftpcleaning link cachesrunning post-sync triggersrunning python triggers from /var/lib/cobbler/triggers/sync/post/*running python trigger cobbler.modules.sync_post_restart_servicesrunning: dhcpd -t -qreceived on stdout: received on stderr: dhcpd -t failedException occured: 
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/messagesMay 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.0May 23 22:24:15 server dhcpd: May 23 22:24:15 server dhcpd: This version of ISC DHCP is based on the release availableMay 23 22:24:15 server dhcpd: on ftp.isc.org.  Features have been added and other changesMay 23 22:24:15 server dhcpd: have been made to the base software release in order to makeMay 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 synctask started: 2018-05-23_222742_synctask started (id=Sync, time=Wed May 23 22:27:42 2018)running pre-sync triggerscleaning treesremoving: /var/lib/tftpboot/pxelinux.cfg/defaultremoving: /var/lib/tftpboot/grub/imagesremoving: /var/lib/tftpboot/grub/grub-x86.efiremoving: /var/lib/tftpboot/grub/grub-x86_64.efiremoving: /var/lib/tftpboot/grub/efidefaultremoving: /var/lib/tftpboot/s390x/profile_listcopying bootloaderstrying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efitrying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.eficopying distros to tftpbootcopying imagesgenerating PXE configuration filesgenerating PXE menu structurerendering DHCP filesgenerating /etc/dhcp/dhcpd.confrendering TFTPD filesgenerating /etc/xinetd.d/tftpcleaning link cachesrunning post-sync triggersrunning python triggers from /var/lib/cobbler/triggers/sync/post/*running python trigger cobbler.modules.sync_post_restart_servicesrunning: dhcpd -t -qreceived on stdout: received on stderr: running: service dhcpd restartreceived on stdout: received on stderr: Redirecting to /bin/systemctl restart  dhcpd.servicerunning shell triggers from /var/lib/cobbler/triggers/sync/post/*running python triggers from /var/lib/cobbler/triggers/change/*running python trigger cobbler.modules.scm_trackrunning 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 /mntmount: /dev/sr0 is write-protected, mounting read-only[root@cobbler-server ~]# cd /mnt/[root@cobbler-server mnt]# lsCentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7EFI              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]# lsCentOS-7-x86_64  config#查看指定导入发行版镜像详细信息[root@cobbler-server ks_mirror]# cobbler distro report --name CentOS-7-x86_64Name                           : CentOS-7-x86_64Architecture                   : x86_64TFTP Boot Files                : {}Breed                          : redhatComment                        : Fetchable Files                : {}Initrd                         : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/initrd.imgKernel                         : /var/www/cobbler/ks_mirror/CentOS-7-x86_64/images/pxeboot/vmlinuzKernel Options                 : {}Kernel Options (Post Install)  : {}Kickstart Metadata             : {
'tree': 'http://@@http_server@@/cblr/links/CentOS-7-x86_64'}Management Classes : []OS Version : rhel7Owners : ['admin']Red Hat Management Key : <
>Red Hat Management Server : <
>Template Files : {}

4       客户端安装操作系统

4.1     创建一个新的虚拟机,开机进入以下界面

#显示的网址不是我们想要的,可以通过修改/etc/cobbler/pxe/pxedefault.template配置文件[root@cobbler-server ~]# vi /etc/cobbler/pxe/pxedefault.template  DEFAULT menuPROMPT 0MENU TITLE Cobbler | http://cobbler.github.io/   #->http://www.wolf_dreams.comTIMEOUT 200TOTALTIMEOUT 6000ONTIMEOUT $pxe_timeout_profileLABEL local        MENU LABEL (local)        MENU DEFAULT        LOCALBOOT -1$pxe_menu_itemsMENU end

4.2     执行cobbler sync同步配置,并重启客户机

[root@cobbler-server ~]# cobbler sync

4.3     重启客户机,再次查看开机画面

5       Cobbler Web管理界面安装配置

5.1     基本设置

1、安装cobbler-web软件包 #yum -y install cobbler-web2、访问网址:https://172.16.0.2/cobbler_web or https://cobbler-server/cobbler-web3、修改C:\Windows\System32\drivers\etc\hosts
#添加如下内容,即可通过cobbler主机名的方式访问web界面172.16.0.2 cobbler-server4、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" cobblerChanging password for user cobbler in realm CobblerNew password: input your passwordRe-type new password: input your password6、重启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导入的发行版配置文件

 

转载于:https://www.cnblogs.com/Wolf-Dreams/p/9090696.html

你可能感兴趣的文章
Java系列之EJB
查看>>
change和onchange、click和onclick的区别
查看>>
EF架构~有时使用SQL更方便
查看>>
Docker部署zabbix3.2监控系统
查看>>
[zt]OpenCV如何获取视频当前的一帧图像
查看>>
Jenkins内置环境变量的使用
查看>>
《微信生活白皮书》发布微信用户数据
查看>>
The frequent used operation in Linux system
查看>>
PyQt5 结合 matplotlib 时,如何显示其 NavigationToolbar
查看>>
&#9733;一名“标题党”自我修炼的10…
查看>>
Redis基础知识之————使用技巧(持续更新中.....)
查看>>
python 反模式
查看>>
企业级LNMP架构搭建实例(基于Centos6.x)
查看>>
(转) 深度强化学习综述:从AlphaGo背后的力量到学习资源分享(附论文)
查看>>
Nim教程【一】
查看>>
[20150226]热备份问题.txt
查看>>
JavaScript 性能优化技巧分享
查看>>
JavaScript入门详解
查看>>
MySQL分布式集群之MyCAT(三)rule的分析
查看>>
nginx编译安装优化
查看>>