IP:192.168.6.90
操作系统:
[root@cobber-server ~]# uname -ra
Linux cobber-server 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@cobber-server ~]# cat /proc/version
Linux version 3.10.0-1127.19.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Aug 25 17:23:54 UTC 2020
[root@cobber-server ~]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
[root@cobber-server ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2407 0 @ 2.20GHz
stepping : 7
microcode : 0x718
cpu MHz : 2200.000
cache size : 10240 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm ssbd ibrs ibpb stibp tsc_adjust arat md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips : 4400.00
clflush size : 64
cache_alignment : 64
address sizes : 45 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2407 0 @ 2.20GHz
stepping : 7
microcode : 0x718
cpu MHz : 2200.000
cache size : 10240 KB
physical id : 2
siblings : 1
core id : 0
cpu cores : 1
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx hypervisor lahf_lm ssbd ibrs ibpb stibp tsc_adjust arat md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips : 4400.00
clflush size : 64
cache_alignment : 64
address sizes : 45 bits physical, 48 bits virtual
power management:
[root@cobber-server ~]#
安装依赖服务
cobbler的运行依赖于dhcp、tftp、rsync及dns服务,其中dhcp可由dhcpd提供,也可由dnsmasq提供,tftp可由tftp-server程序包提供,也可由cobbler功能提供,rsync有rsync程序包提供,dns可由bind提供,也可由dnsmasq提供,此处独立管理,即不通过cobbler来管理这些服务
#cobbler在安装时会将依赖包tftp-server和xinetd安装,dns服务非必需,所以还要手动安装dhcp
添加epel源:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
添加在线阿里云源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
部署 cobbler服务
yum install dhcp cobbler -y
配置 cobbler-dhcp独立服务
[root@cobber-server ~]# cat /etc/dhcp/dhcpd.conf
option domain-name "scholar.com";
option domain-name-servers 192.168.6.1;
default-lease-time 43200;
max-lease-time 86400;
log-facility local7;
subnet 192.168.6.0 netmask 255.255.255.0 {
range 192.168.6.90 192.168.6.240;
option routers 192.168.6.1;
next-server 192.168.6.90;
filename "pxelinux.0";
}
[root@cobber-server ~]#
[root@cobber-server ~]# systemctl restart dhcpd.service
[root@cobber-server ~]# systemctl enable dhcpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
[root@cobber-server ~]# systemctl status dhcpd.service
● dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-10-08 17:35:44 CST; 11s ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Main PID: 16594 (dhcpd)
Status: "Dispatching packets..."
CGroup: /system.slice/dhcpd.service
└─16594 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
Oct 08 17:35:44 cobber-server dhcpd[16594]: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specifi...ig file
Oct 08 17:35:44 cobber-server dhcpd[16594]: Internet Systems Consortium DHCP Server 4.2.5
Oct 08 17:35:44 cobber-server dhcpd[16594]: Copyright 2004-2013 Internet Systems Consortium.
Oct 08 17:35:44 cobber-server dhcpd[16594]: All rights reserved.
Oct 08 17:35:44 cobber-server dhcpd[16594]: For info, please visit https://www.isc.org/software/dhcp/
Oct 08 17:35:44 cobber-server dhcpd[16594]: Wrote 0 leases to leases file.
Oct 08 17:35:44 cobber-server dhcpd[16594]: Listening on LPF/ens192/00:0c:29:b3:83:f8/192.168.6.0/24
Oct 08 17:35:44 cobber-server dhcpd[16594]: Sending on LPF/ens192/00:0c:29:b3:83:f8/192.168.6.0/24
Oct 08 17:35:44 cobber-server dhcpd[16594]: Sending on Socket/fallback/fallback-net
Oct 08 17:35:44 cobber-server systemd[1]: Started DHCPv4 Server Daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@cobber-server ~]#
启动其他服务
[root@cobber-server ~]# systemctl enable tftp.service rsyncd.service
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
[root@cobber-server ~]# systemctl restart tftp.service rsyncd.service
[root@cobber-server ~]# systemctl status tftp.service rsyncd.service
● tftp.service - Tftp Server
Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: disabled)
Active: active (running) since Thu 2020-10-08 17:38:25 CST; 5s ago
Docs: man:in.tftpd
Main PID: 16829 (in.tftpd)
CGroup: /system.slice/tftp.service
└─16829 /usr/sbin/in.tftpd -s /var/lib/tftpboot
Oct 08 17:38:25 cobber-server systemd[1]: Started Tftp Server.
● rsyncd.service - fast remote file copy program daemon
Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-10-08 17:38:25 CST; 5s ago
Main PID: 16830 (rsync)
CGroup: /system.slice/rsyncd.service
└─16830 /usr/bin/rsync --daemon --no-detach
Oct 08 17:38:25 cobber-server systemd[1]: Started fast remote file copy program daemon.
Oct 08 17:38:25 cobber-server rsyncd[16830]: rsyncd version 3.1.2 starting, listening on port 873
[root@cobber-server ~]#
[root@cobber-server ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@cobber-server ~]# systemctl restart httpd.service
[root@cobber-server ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-10-08 17:40:45 CST; 5s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 16927 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─16927 /usr/sbin/httpd -DFOREGROUND
├─16928 /usr/sbin/httpd -DFOREGROUND
├─16929 /usr/sbin/httpd -DFOREGROUND
├─16930 /usr/sbin/httpd -DFOREGROUND
├─16931 /usr/sbin/httpd -DFOREGROUND
└─16932 /usr/sbin/httpd -DFOREGROUND
Oct 08 17:40:45 cobber-server systemd[1]: Starting The Apache HTTP Server...
Oct 08 17:40:45 cobber-server httpd[16927]: AH00558: httpd: Could not reliably determine the server's fully qualified domain ...message
Oct 08 17:40:45 cobber-server systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@cobber-server ~]#
启动cobbble服务
[root@cobber-server ~]# systemctl enable cobblerd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@cobber-server ~]# systemctl restart cobblerd.service
[root@cobber-server ~]# systemctl status cobblerd.service
● cobblerd.service - Cobbler Helper Daemon
Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-10-08 17:39:35 CST; 6s ago
Process: 16876 ExecStartPost=/usr/bin/touch /usr/share/cobbler/web/cobbler.wsgi (code=exited, status=1/FAILURE)
Main PID: 16875 (cobblerd)
CGroup: /system.slice/cobblerd.service
└─16875 /usr/bin/python2 -s /usr/bin/cobblerd -F
Oct 08 17:39:35 cobber-server systemd[1]: Starting Cobbler Helper Daemon...
Oct 08 17:39:35 cobber-server touch[16876]: /usr/bin/touch: cannot touch ‘/usr/share/cobbler/web/cobbler.wsgi’: No such file …directory
Oct 08 17:39:35 cobber-server systemd[1]: Started Cobbler Helper Daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@cobber-server ~]#
配置cobble 服务
根据提示修改这8个配置
[root@cobber-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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : 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.
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : ksvalidator was not found, install pykickstart
7 : 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
8 : 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.
[root@cobber-server ~]#
1.修改/etc/cobbler/settings文件中的server参数的值为提供cobbler服务的主机相应的IP地址或主机名,如server: 192.168.6.90;
sed -i 's/server: 127.0.0.1/server: 192.168.6.90/' /etc/cobbler/settings
2.修改/etc/cobbler/settings文件中的next_server参数的值为提供PXE服务的主机相应的IP地址,如next_server:192.168.6.90 ;
sed -i 's/next_server: 127.0.0.1/next_server: 192.168.6.90/' /etc/cobbler/settings
3.修改/etc/xinetd.d/tftp文件中的disable参数修改为disable = no
4.执行cobbler get-loaders命令即可;否则,需要安装syslinux程序包,而后复制/usr/share/syslinux/{pxelinux.0,memu.c32}等文件至/var/lib/cobbler/loaders/目录中;
cobbler get-loaders
5.执行systemctl enable rsyncd命令即可;
6.如果有强迫症可以选择yum –y install debmirror然后根据错误进行解决,一般错误如下。
## 注释/etc/dedmirror.conf文件中的@dists=”sid”;@arches=”i386”;
7.[root@cobbler-node1 ~]# openssl passwd -1 -salt '$(openssl rand -hex 4)' 'EC' $1$$(openss$yWzTjLjGmjQJUbnsOQnx8/
[root@cobbler-node1 ~]# grep "default_password_crypted" /etc/cobbler/settings #替换/etc/cobbler/setting内的default_password_crypted
default_password_crypted: "$1$$(openss$yWzTjLjGmjQJUbnsOQnx8/"
8.yum –y install cman fence-agents
systemctl restart cobblerd #最后重启Cobbler
[root@cobber-server ~]# mount /dev/sr0 /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@cobber-server ~]#
[root@cobber-server ~]# df -TH
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.1G 0 1.1G 0% /dev
tmpfs tmpfs 1.1G 0 1.1G 0% /dev/shm
tmpfs tmpfs 1.1G 9.3M 1.1G 1% /run
tmpfs tmpfs 1.1G 0 1.1G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 29G 2.1G 27G 8% /
/dev/sda1 xfs 1.1G 175M 889M 17% /boot
tmpfs tmpfs 210M 0 210M 0% /run/user/0
/dev/sr0 iso9660 4.8G 4.8G 0 100% /mnt
[root@cobber-server ~]# cobbler import --name=CentOS-7.8-x86_64 --path=/mnt/
task started: 2020-10-08_200351_import
task started (id=Media import, time=Thu Oct 8 20:03:51 2020)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64:
creating new distro: CentOS-7.8-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64 -> /var/www/cobbler/links/CentOS-7.8-x86_64
creating new profile: CentOS-7.8-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64 for CentOS-7.8-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64
looking for /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS-7.8-x86_64/repodata
*** TASK COMPLETE ***
[root@cobber-server ~]# cobbler distro list
CentOS-7.8-x86_64
[root@cobber-server ~]#