前言
Cobbler 是一款 Linux 系统安装与配置软件
Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between many various commands and applications when deploying new systems, and, in some cases, changing existing ones. Cobbler can help with provisioning, managing DNS and DHCP, package updates, power management, configuration management orchestration, and much more.
可以实现 Linux 的自动化部署与初始化配置,在需要安装大量 OS 的场景下,可以极大提升效率
这里分享一下 Cobbler 的安装方法
参考 Cobbler Quickstart Guide
Tip: 当前的版本为 LATEST VERSION: 2.8.2 released on Sep 16th 2017
操作
环境
代码语言:javascript复制[root@56-201 ~]# hostnamectl
Static hostname: 56-201
Icon name: computer-vm
Chassis: vm
Machine ID: 33dc28f7e76c4903ad9b603b77e29a7c
Boot ID: f2d8e34edfd34fae951f7404c7e6d928
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-514.21.1.el7.x86_64
Architecture: x86-64
[root@56-201 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:0e:38:94 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
valid_lft 84615sec preferred_lft 84615sec
inet6 fe80::2bb7:5b3:9584:d8eb/64 scope link
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:bb:5d:54 brd ff:ff:ff:ff:ff:ff
inet 192.168.56.201/24 brd 192.168.56.255 scope global enp0s8
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:febb:5d54/64 scope link
valid_lft forever preferred_lft forever
4: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:16:5e:11 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
5: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:16:5e:11 brd ff:ff:ff:ff:ff:ff
[root@56-201 ~]# hostname
56-201
[root@56-201 ~]#
查看包
代码语言:javascript复制[root@56-201 ~]# yum list all | grep cobbler
cobbler.x86_64 2.8.2-1.el7 epel
cobbler-web.noarch 2.8.2-1.el7 epel
[root@56-201 ~]#
默认情况下 cobbler 已经被添加到了 epel-release 的软件仓库中
查看依赖
cobbler-web 依赖于 cobbler
代码语言:javascript复制[root@56-201 ~]# yum deplist cobbler-web.noarch
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.pregi.net
* c7-media:
* epel: mirror.pregi.net
* extras: mirror.pregi.net
* updates: mirror.pregi.net
package: cobbler-web.noarch 2.8.2-1.el7
dependency: /bin/sh
provider: bash.x86_64 4.2.46-29.el7_4
dependency: cobbler
provider: cobbler.x86_64 2.8.2-1.el7
dependency: mod_ssl
provider: mod_ssl.x86_64 1:2.4.6-67.el7.centos.6
dependency: mod_wsgi
provider: mod_wsgi.x86_64 3.4-12.el7_0
dependency: openssl
provider: openssl.x86_64 1:1.0.2k-8.el7
dependency: python-django
provider: python2-django.noarch 1.6.11.6-16.el7
provider: python-django.noarch 1.6.11.6-1.el7
[root@56-201 ~]#
cobbler-web 是 cobbler 的 web 管理界面,是基于 python-django 构建的,需要 ssl 的支持
cobbler 依赖于 httpd rsync tftp-server yum-utils
代码语言:javascript复制[root@56-201 ~]# yum deplist cobbler.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.pregi.net
* c7-media:
* epel: mirror.pregi.net
* extras: mirror.pregi.net
* updates: mirror.pregi.net
package: cobbler.x86_64 2.8.2-1.el7
dependency: /bin/sh
provider: bash.x86_64 4.2.46-29.el7_4
dependency: /usr/bin/python
provider: python.x86_64 2.7.5-58.el7
dependency: /usr/bin/python2
provider: python.x86_64 2.7.5-58.el7
dependency: PyYAML
provider: PyYAML.x86_64 3.10-11.el7
dependency: createrepo
provider: createrepo.noarch 0.9.9-28.el7
dependency: genisoimage
provider: genisoimage.x86_64 1.1.11-23.el7
dependency: httpd
provider: httpd.x86_64 2.4.6-67.el7.centos.6
dependency: mod_wsgi
provider: mod_wsgi.x86_64 3.4-12.el7_0
dependency: python(abi) = 2.7
provider: python.x86_64 2.7.5-58.el7
dependency: python-cheetah
provider: python-cheetah.x86_64 2.4.4-5.el7.centos
dependency: python-netaddr
provider: python-netaddr.noarch 0.7.5-7.el7
dependency: python-simplejson
provider: python2-simplejson.x86_64 3.10.0-1.el7
dependency: python-urlgrabber
provider: python-urlgrabber.noarch 3.10-8.el7
dependency: rsync
provider: rsync.x86_64 3.0.9-18.el7
dependency: syslinux
provider: syslinux.x86_64 4.05-13.el7
dependency: systemd
provider: systemd.x86_64 219-42.el7_4.10
dependency: tftp-server
provider: tftp-server.x86_64 5.2-13.el7
dependency: yum-utils
provider: yum-utils.noarch 1.1.31-42.el7
[root@56-201 ~]#
cobbler 的核心功能需要以上软件的支持
rsync yum-utils 用来进行软件库的更新同步
tftp-server 用来提供 bootstrap 和 相关镜像的下载
httpd 来提供软件库的下载
createrepo 用来构建本地仓库
关闭 SELINUX
代码语言:javascript复制[root@56-201 ~]# getenforce
Enforcing
[root@56-201 ~]# setenforce 0
[root@56-201 ~]# getenforce
Permissive
[root@56-201 ~]#
修改 /etc/selinux/config
配置文件可以在下次 OS 重启禁用掉 selinux
[root@56-201 ~]# vim /etc/selinux/config
[root@56-201 ~]# grep disabled /etc/selinux/config
# disabled - No SELinux policy is loaded.
SELINUX=disabled
[root@56-201 ~]#
安装 cobbler
代码语言:javascript复制[root@56-201 ~]# yum install cobbler
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00
c7-media | 3.6 kB 00:00
centos-openshift-origin15 | 2.9 kB 00:00
epel/x86_64/metalink | 6.3 kB 00:00
epel | 4.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/2): epel/x86_64/updateinfo | 902 kB 00:18
(2/2): epel/x86_64/primary_db | 6.3 MB 00:26
Loading mirror speeds from cached hostfile
* base: mirror.pregi.net
* c7-media:
* epel: mirror.pregi.net
* extras: mirror.pregi.net
* updates: mirror.pregi.net
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: 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-simplejson for package: cobbler-2.8.2-1.el7.x86_64
--> Processing Dependency: tftp-server for package: cobbler-2.8.2-1.el7.x86_64
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 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 python2-simplejson.x86_64 0:3.10.0-1.el7 will be installed
---> Package tftp-server.x86_64 0:5.2-13.el7 will be installed
--> Running transaction check
---> 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-imaging for package: python-pygments-1.4-10.el7.noarch
--> Running transaction check
---> Package python-pillow.x86_64 0:2.0.0-19.gitd1c6db8.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
Installing for dependencies:
PyYAML x86_64 3.10-11.el7 base 153 k
mod_wsgi x86_64 3.4-12.el7_0 base 76 k
python-cheetah x86_64 2.4.4-5.el7.centos extras 341 k
python-markdown noarch 2.4.1-2.el7 epel 186 k
python-pillow x86_64 2.0.0-19.gitd1c6db8.el7 base 438 k
python-pygments noarch 1.4-10.el7 base 599 k
python2-simplejson x86_64 3.10.0-1.el7 epel 188 k
tftp-server x86_64 5.2-13.el7 base 44 k
Transaction Summary
================================================================================
Install 1 Package ( 8 Dependent packages)
Total download size: 2.5 M
Installed size: 11 M
Is this ok [y/d/N]: y
Downloading packages:
(1/9): PyYAML-3.10-11.el7.x86_64.rpm | 153 kB 00:00
(2/9): python-cheetah-2.4.4-5.el7.centos.x86_64.rpm | 341 kB 00:00
(3/9): mod_wsgi-3.4-12.el7_0.x86_64.rpm | 76 kB 00:00
(4/9): cobbler-2.8.2-1.el7.x86_64.rpm | 574 kB 00:10
(5/9): python-pillow-2.0.0-19.gitd1c6db8.el7.x86_64.rpm | 438 kB 00:00
(6/9): python-pygments-1.4-10.el7.noarch.rpm | 599 kB 00:01
python-markdown-2.4.1-2.el7.no FAILED
https://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/p/python-markdown-2.4.1-2.el7.noarch.rpm: [Errno 12] Timeout on https://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/p/python-markdown-2.4.1-2.el7.noarch.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(7/9): tftp-server-5.2-13.el7.x86_64.rpm | 44 kB 00:00
(8/9): python-markdown-2.4.1-2.el7.noarch.rpm | 186 kB 00:02
python2-simplejson-3.10.0-1.el FAILED
https://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/p/python2-simplejson-3.10.0-1.el7.x86_64.rpm: [Errno 12] Timeout on https://mirrors.ustc.edu.cn/epel/7/x86_64/Packages/p/python2-simplejson-3.10.0-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(9/9): python2-simplejson-3.10.0-1.el7.x86_64.rpm | 188 kB 00:02
--------------------------------------------------------------------------------
Total 33 kB/s | 2.5 MB 01:19
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : tftp-server-5.2-13.el7.x86_64 1/9
Installing : PyYAML-3.10-11.el7.x86_64 2/9
Installing : python-pillow-2.0.0-19.gitd1c6db8.el7.x86_64 3/9
Installing : python-pygments-1.4-10.el7.noarch 4/9
Installing : python-markdown-2.4.1-2.el7.noarch 5/9
Installing : python-cheetah-2.4.4-5.el7.centos.x86_64 6/9
Installing : python2-simplejson-3.10.0-1.el7.x86_64 7/9
Installing : mod_wsgi-3.4-12.el7_0.x86_64 8/9
Installing : cobbler-2.8.2-1.el7.x86_64 9/9
Verifying : mod_wsgi-3.4-12.el7_0.x86_64 1/9
Verifying : python-pygments-1.4-10.el7.noarch 2/9
Verifying : python-cheetah-2.4.4-5.el7.centos.x86_64 3/9
Verifying : cobbler-2.8.2-1.el7.x86_64 4/9
Verifying : python2-simplejson-3.10.0-1.el7.x86_64 5/9
Verifying : python-markdown-2.4.1-2.el7.noarch 6/9
Verifying : python-pillow-2.0.0-19.gitd1c6db8.el7.x86_64 7/9
Verifying : PyYAML-3.10-11.el7.x86_64 8/9
Verifying : tftp-server-5.2-13.el7.x86_64 9/9
Installed:
cobbler.x86_64 0:2.8.2-1.el7
Dependency Installed:
PyYAML.x86_64 0:3.10-11.el7
mod_wsgi.x86_64 0:3.4-12.el7_0
python-cheetah.x86_64 0:2.4.4-5.el7.centos
python-markdown.noarch 0:2.4.1-2.el7
python-pillow.x86_64 0:2.0.0-19.gitd1c6db8.el7
python-pygments.noarch 0:1.4-10.el7
python2-simplejson.x86_64 0:3.10.0-1.el7
tftp-server.x86_64 0:5.2-13.el7
Complete!
[root@56-201 ~]# echo $?
0
[root@56-201 ~]#
修改密码
代码语言:javascript复制[root@56-201 cobbler]# openssl passwd -1
Password:
Verifying - Password:
$1$BAj5Akia$3PiP6Kl10RpuRuY/B25fV.
[root@56-201 cobbler]# vim settings
[root@56-201 cobbler]# grep default_password_crypted settings
#default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."
default_password_crypted: "$1$BAj5Akia$3PiP6Kl10RpuRuY/B25fV."
[root@56-201 cobbler]#
使用 openssl passwd -1
生成密码来替代原有的密码
这个密码是 kickstart 中的 root 密码
修改服务地址
修改 cobbler 服务地址
代码语言:javascript复制[root@56-201 cobbler]# vim settings
[root@56-201 cobbler]# grep -B 8 '^server' settings
# this is the address of the cobbler server -- as it is used
# by systems during the install process, it must be the address
# or hostname of the system as those systems can see the server.
# if you have a server that appears differently to different subnets
# (dual homed, etc), you need to read the --server-override section
# of the manpage for how that works.
#server: 127.0.0.1
server: 192.168.56.201
[root@56-201 cobbler]#
修改 dhcp 服务地址
代码语言:javascript复制[root@56-201 cobbler]# vim settings
[root@56-201 cobbler]# grep -B 5 '^next_server' settings
# if using cobbler with manage_dhcp, put the IP address
# of the cobbler server here so that PXE booting guests can find it
# if you do not set this correctly, this will be manifested in TFTP open timeouts.
#next_server: 127.0.0.1
next_server: 192.168.56.201
[root@56-201 cobbler]#
由于在 PXE 引导的过程中 dhcp 服务器可以作为一个独立的角色与 cobbler 分别布到不同的节点上,因此这里的 IP 不一定是本机 IP,但是为了方便,我希望 cobbler 一同管理 dhcp,所以我也准备将 dhcp 服务与 cobbler 放在一起 (cobbler 已经集成了直接管理 dhcp 的功能)
管理 dhcp
代码语言:javascript复制[root@56-201 cobbler]# vim settings
[root@56-201 cobbler]# grep -B 4 '^manage_dhcp' settings
# set to 1 to enable Cobbler's DHCP management features.
# the choice of DHCP management engine is in /etc/cobbler/modules.conf
#manage_dhcp: 0
manage_dhcp: 1
[root@56-201 cobbler]#
默认 cobbler 是不管理 dhcp 的
但是我们通过配置 manage_dhcp 选项,可以打开管理
修改模板
代码语言:javascript复制[root@56-201 cobbler]# grep -v "#" dhcp.template
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 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.5;
option domain-name-servers 192.168.1.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.254;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else if option pxe-system-type = 00:09 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
group {
host $iface.name {
option dhcp-client-identifier = $mac;
hardware ethernet $mac;
fixed-address $iface.ip_address;
option host-name "$iface.hostname";
option subnet-mask $iface.netmask;
option routers $iface.gateway;
if exists user-class and option user-class = "gPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else if exists user-class and option user-class = "iPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else {
filename "undionly.kpxe";
}
filename "$iface.filename";
next-server $next_server;
}
}
[root@56-201 cobbler]# vim dhcp.template
[root@56-201 cobbler]# grep -v "#" dhcp.template
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 192.168.56.0 netmask 255.255.255.0 {
option routers 192.168.56.201;
option domain-name-servers 192.168.56.201;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.56.230 192.168.56.235;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else if option pxe-system-type = 00:09 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
group {
host $iface.name {
option dhcp-client-identifier = $mac;
hardware ethernet $mac;
fixed-address $iface.ip_address;
option host-name "$iface.hostname";
option subnet-mask $iface.netmask;
option routers $iface.gateway;
if exists user-class and option user-class = "gPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else if exists user-class and option user-class = "iPXE" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else {
filename "undionly.kpxe";
}
filename "$iface.filename";
next-server $next_server;
}
}
[root@56-201 cobbler]#
安装 dhcp 服务端
系统默认情况下只安装了 dhcp 客户端需要的包和库,我们需要明确地安装 dhcp 服务端软件
代码语言:javascript复制[root@56-201 cobbler]# rpm -qa | grep dhcp
dhcp-libs-4.2.5-47.el7.centos.x86_64
dhcp-common-4.2.5-47.el7.centos.x86_64
[root@56-201 cobbler]# yum install dhcp.x86_64
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.pregi.net
* c7-media:
* epel: mirror.pregi.net
* extras: mirror.pregi.net
* updates: mirror.pregi.net
Resolving Dependencies
--> Running transaction check
---> Package dhcp.x86_64 12:4.2.5-58.el7.centos.1 will be installed
--> Processing Dependency: dhcp-libs(x86-64) = 12:4.2.5-58.el7.centos.1 for package: 12:dhcp-4.2.5-58.el7.centos.1.x86_64
--> Processing Dependency: dhcp-common = 12:4.2.5-58.el7.centos.1 for package: 12:dhcp-4.2.5-58.el7.centos.1.x86_64
--> Running transaction check
---> Package dhcp-common.x86_64 12:4.2.5-47.el7.centos will be updated
--> Processing Dependency: dhcp-common = 12:4.2.5-47.el7.centos for package: 12:dhclient-4.2.5-47.el7.centos.x86_64
---> Package dhcp-common.x86_64 12:4.2.5-58.el7.centos.1 will be an update
---> Package dhcp-libs.x86_64 12:4.2.5-47.el7.centos will be updated
---> Package dhcp-libs.x86_64 12:4.2.5-58.el7.centos.1 will be an update
--> Running transaction check
---> Package dhclient.x86_64 12:4.2.5-47.el7.centos will be updated
---> Package dhclient.x86_64 12:4.2.5-58.el7.centos.1 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
dhcp x86_64 12:4.2.5-58.el7.centos.1 updates 513 k
Updating for dependencies:
dhclient x86_64 12:4.2.5-58.el7.centos.1 updates 282 k
dhcp-common x86_64 12:4.2.5-58.el7.centos.1 updates 174 k
dhcp-libs x86_64 12:4.2.5-58.el7.centos.1 updates 130 k
Transaction Summary
================================================================================
Install 1 Package
Upgrade ( 3 Dependent packages)
Total download size: 1.1 M
Is this ok [y/d/N]: y
Downloading packages:
Not downloading deltainfo for updates, MD is 954 k and rpms are 586 k
(1/4): dhclient-4.2.5-58.el7.centos.1.x86_64.rpm | 282 kB 00:00
(2/4): dhcp-libs-4.2.5-58.el7.centos.1.x86_64.rpm | 130 kB 00:00
(3/4): dhcp-common-4.2.5-58.el7.centos.1.x86_64.rpm | 174 kB 00:00
(4/4): dhcp-4.2.5-58.el7.centos.1.x86_64.rpm | 513 kB 00:01
--------------------------------------------------------------------------------
Total 982 kB/s | 1.1 MB 00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : 12:dhcp-libs-4.2.5-58.el7.centos.1.x86_64 1/7
Updating : 12:dhcp-common-4.2.5-58.el7.centos.1.x86_64 2/7
Updating : 12:dhclient-4.2.5-58.el7.centos.1.x86_64 3/7
Installing : 12:dhcp-4.2.5-58.el7.centos.1.x86_64 4/7
Cleanup : 12:dhclient-4.2.5-47.el7.centos.x86_64 5/7
Cleanup : 12:dhcp-common-4.2.5-47.el7.centos.x86_64 6/7
Cleanup : 12:dhcp-libs-4.2.5-47.el7.centos.x86_64 7/7
Verifying : 12:dhcp-common-4.2.5-58.el7.centos.1.x86_64 1/7
Verifying : 12:dhcp-libs-4.2.5-58.el7.centos.1.x86_64 2/7
Verifying : 12:dhclient-4.2.5-58.el7.centos.1.x86_64 3/7
Verifying : 12:dhcp-4.2.5-58.el7.centos.1.x86_64 4/7
Verifying : 12:dhcp-libs-4.2.5-47.el7.centos.x86_64 5/7
Verifying : 12:dhclient-4.2.5-47.el7.centos.x86_64 6/7
Verifying : 12:dhcp-common-4.2.5-47.el7.centos.x86_64 7/7
Installed:
dhcp.x86_64 12:4.2.5-58.el7.centos.1
Dependency Updated:
dhclient.x86_64 12:4.2.5-58.el7.centos.1
dhcp-common.x86_64 12:4.2.5-58.el7.centos.1
dhcp-libs.x86_64 12:4.2.5-58.el7.centos.1
Complete!
[root@56-201 cobbler]# rpm -qa | grep dhcp
dhcp-common-4.2.5-58.el7.centos.1.x86_64
dhcp-4.2.5-58.el7.centos.1.x86_64
dhcp-libs-4.2.5-58.el7.centos.1.x86_64
[root@56-201 cobbler]#
启动 cobbler 服务
代码语言:javascript复制[root@56-201 cobbler]# systemctl status cobblerd.service
● cobblerd.service - Cobbler Helper Daemon
Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@56-201 cobbler]# systemctl start cobblerd.service
[root@56-201 cobbler]# systemctl status cobblerd.service
● cobblerd.service - Cobbler Helper Daemon
Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; disabled; vendor preset: disabled)
Active: active (running) since 二 2018-03-13 00:57:46 CST; 3s ago
Process: 4096 ExecStartPost=/usr/bin/touch /usr/share/cobbler/web/cobbler.wsgi (code=exited, status=1/FAILURE)
Main PID: 4095 (cobblerd)
CGroup: /system.slice/cobblerd.service
└─4095 /usr/bin/python2 -s /usr/bin/cobblerd -F
3月 13 00:57:46 56-201 systemd[1]: Starting Cobbler Helper Daemon...
3月 13 00:57:46 56-201 touch[4096]: /usr/bin/touch: cannot touch ‘/usr/sha…tory
3月 13 00:57:46 56-201 systemd[1]: Started Cobbler Helper Daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@56-201 cobbler]#
[root@56-201 cobbler]# ps faux | grep cobbler
root 4202 0.0 0.0 112648 1016 pts/0 S 01:00 0:00 _ grep --color=auto cobbler
root 4095 0.1 1.4 364992 29468 ? Ss 00:57 0:00 /usr/bin/python2 -s /usr/bin/cobblerd -F
[root@56-201 cobbler]#
检查环境与配置
使用 cobbler check
来进行环境与配置检查
[root@56-201 cobbler]# cobbler check
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cobbler/cli.py", line 251, in check_setup
s.ping()
File "/usr/lib64/python2.7/xmlrpclib.py", line 1233, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1587, in __request
verbose=self.__verbose
File "/usr/lib64/python2.7/xmlrpclib.py", line 1273, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1301, in single_request
self.send_content(h, request_body)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1448, in send_content
connection.endheaders(request_body)
File "/usr/lib64/python2.7/httplib.py", line 1013, in endheaders
self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 864, in _send_output
self.send(msg)
File "/usr/lib64/python2.7/httplib.py", line 826, in send
self.connect()
File "/usr/lib64/python2.7/httplib.py", line 807, in connect
self.timeout, self.source_address)
File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 111] Connection refused
[root@56-201 cobbler]#
[root@56-201 cobbler]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)
[root@56-201 cobbler]# systemctl start httpd.service
[root@56-201 cobbler]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 二 2018-03-13 01:07:07 CST; 3s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 4298 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─4298 /usr/sbin/httpd -DFOREGROUND
├─4301 /usr/sbin/httpd -DFOREGROUND
├─4302 /usr/sbin/httpd -DFOREGROUND
├─4303 /usr/sbin/httpd -DFOREGROUND
├─4304 /usr/sbin/httpd -DFOREGROUND
├─4305 /usr/sbin/httpd -DFOREGROUND
└─4306 /usr/sbin/httpd -DFOREGROUND
Restart cobblerd and then run 'cobbler sync' to apply changes.
[root@56-201 cobbler]#
这些多是建议,服务类型的比如 tftp 和 rsync 是需要遵从的,否则 cobbler 可能会工作不正常,但是其它,比如 debmirror 和 fence 如果用不上,是可以不用理会的
SELinux 在重启 OS 后会自动满足条件,可以忽略掉