IP:192.168.6.90
    操作系统:

    1. [root@cobber-server ~]# uname -ra
    2. 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
    3. [root@cobber-server ~]# cat /proc/version
    4. 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
    5. [root@cobber-server ~]# cat /etc/redhat-release
    6. CentOS Linux release 7.8.2003 (Core)
    7. [root@cobber-server ~]# cat /proc/cpuinfo
    8. processor : 0
    9. vendor_id : GenuineIntel
    10. cpu family : 6
    11. model : 45
    12. model name : Intel(R) Xeon(R) CPU E5-2407 0 @ 2.20GHz
    13. stepping : 7
    14. microcode : 0x718
    15. cpu MHz : 2200.000
    16. cache size : 10240 KB
    17. physical id : 0
    18. siblings : 1
    19. core id : 0
    20. cpu cores : 1
    21. apicid : 0
    22. initial apicid : 0
    23. fpu : yes
    24. fpu_exception : yes
    25. cpuid level : 13
    26. wp : yes
    27. 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
    28. bogomips : 4400.00
    29. clflush size : 64
    30. cache_alignment : 64
    31. address sizes : 45 bits physical, 48 bits virtual
    32. power management:
    33. processor : 1
    34. vendor_id : GenuineIntel
    35. cpu family : 6
    36. model : 45
    37. model name : Intel(R) Xeon(R) CPU E5-2407 0 @ 2.20GHz
    38. stepping : 7
    39. microcode : 0x718
    40. cpu MHz : 2200.000
    41. cache size : 10240 KB
    42. physical id : 2
    43. siblings : 1
    44. core id : 0
    45. cpu cores : 1
    46. apicid : 2
    47. initial apicid : 2
    48. fpu : yes
    49. fpu_exception : yes
    50. cpuid level : 13
    51. wp : yes
    52. 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
    53. bogomips : 4400.00
    54. clflush size : 64
    55. cache_alignment : 64
    56. address sizes : 45 bits physical, 48 bits virtual
    57. power management:
    58. [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源:

    1. wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

    添加在线阿里云源

    1. wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    2. 或者
    3. curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

    部署 cobbler服务

    1. yum install dhcp cobbler -y

    配置 cobbler-dhcp独立服务

    1. [root@cobber-server ~]# cat /etc/dhcp/dhcpd.conf
    2. option domain-name "scholar.com";
    3. option domain-name-servers 192.168.6.1;
    4. default-lease-time 43200;
    5. max-lease-time 86400;
    6. log-facility local7;
    7. subnet 192.168.6.0 netmask 255.255.255.0 {
    8. range 192.168.6.90 192.168.6.240;
    9. option routers 192.168.6.1;
    10. next-server 192.168.6.90;
    11. filename "pxelinux.0";
    12. }
    13. [root@cobber-server ~]#
    14. [root@cobber-server ~]# systemctl restart dhcpd.service
    15. [root@cobber-server ~]# systemctl enable dhcpd.service
    16. Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
    17. [root@cobber-server ~]# systemctl status dhcpd.service
    18. dhcpd.service - DHCPv4 Server Daemon
    19. Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
    20. Active: active (running) since Thu 2020-10-08 17:35:44 CST; 11s ago
    21. Docs: man:dhcpd(8)
    22. man:dhcpd.conf(5)
    23. Main PID: 16594 (dhcpd)
    24. Status: "Dispatching packets..."
    25. CGroup: /system.slice/dhcpd.service
    26. └─16594 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
    27. 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
    28. Oct 08 17:35:44 cobber-server dhcpd[16594]: Internet Systems Consortium DHCP Server 4.2.5
    29. Oct 08 17:35:44 cobber-server dhcpd[16594]: Copyright 2004-2013 Internet Systems Consortium.
    30. Oct 08 17:35:44 cobber-server dhcpd[16594]: All rights reserved.
    31. Oct 08 17:35:44 cobber-server dhcpd[16594]: For info, please visit https://www.isc.org/software/dhcp/
    32. Oct 08 17:35:44 cobber-server dhcpd[16594]: Wrote 0 leases to leases file.
    33. Oct 08 17:35:44 cobber-server dhcpd[16594]: Listening on LPF/ens192/00:0c:29:b3:83:f8/192.168.6.0/24
    34. Oct 08 17:35:44 cobber-server dhcpd[16594]: Sending on LPF/ens192/00:0c:29:b3:83:f8/192.168.6.0/24
    35. Oct 08 17:35:44 cobber-server dhcpd[16594]: Sending on Socket/fallback/fallback-net
    36. Oct 08 17:35:44 cobber-server systemd[1]: Started DHCPv4 Server Daemon.
    37. Hint: Some lines were ellipsized, use -l to show in full.
    38. [root@cobber-server ~]#

    启动其他服务

    1. [root@cobber-server ~]# systemctl enable tftp.service rsyncd.service
    2. Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
    3. Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
    4. [root@cobber-server ~]# systemctl restart tftp.service rsyncd.service
    5. [root@cobber-server ~]# systemctl status tftp.service rsyncd.service
    6. tftp.service - Tftp Server
    7. Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: disabled)
    8. Active: active (running) since Thu 2020-10-08 17:38:25 CST; 5s ago
    9. Docs: man:in.tftpd
    10. Main PID: 16829 (in.tftpd)
    11. CGroup: /system.slice/tftp.service
    12. └─16829 /usr/sbin/in.tftpd -s /var/lib/tftpboot
    13. Oct 08 17:38:25 cobber-server systemd[1]: Started Tftp Server.
    14. rsyncd.service - fast remote file copy program daemon
    15. Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; enabled; vendor preset: disabled)
    16. Active: active (running) since Thu 2020-10-08 17:38:25 CST; 5s ago
    17. Main PID: 16830 (rsync)
    18. CGroup: /system.slice/rsyncd.service
    19. └─16830 /usr/bin/rsync --daemon --no-detach
    20. Oct 08 17:38:25 cobber-server systemd[1]: Started fast remote file copy program daemon.
    21. Oct 08 17:38:25 cobber-server rsyncd[16830]: rsyncd version 3.1.2 starting, listening on port 873
    22. [root@cobber-server ~]#
    1. [root@cobber-server ~]# systemctl enable httpd.service
    2. Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
    3. [root@cobber-server ~]# systemctl restart httpd.service
    4. [root@cobber-server ~]# systemctl status httpd.service
    5. httpd.service - The Apache HTTP Server
    6. Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
    7. Active: active (running) since Thu 2020-10-08 17:40:45 CST; 5s ago
    8. Docs: man:httpd(8)
    9. man:apachectl(8)
    10. Main PID: 16927 (httpd)
    11. Status: "Processing requests..."
    12. CGroup: /system.slice/httpd.service
    13. ├─16927 /usr/sbin/httpd -DFOREGROUND
    14. ├─16928 /usr/sbin/httpd -DFOREGROUND
    15. ├─16929 /usr/sbin/httpd -DFOREGROUND
    16. ├─16930 /usr/sbin/httpd -DFOREGROUND
    17. ├─16931 /usr/sbin/httpd -DFOREGROUND
    18. └─16932 /usr/sbin/httpd -DFOREGROUND
    19. Oct 08 17:40:45 cobber-server systemd[1]: Starting The Apache HTTP Server...
    20. Oct 08 17:40:45 cobber-server httpd[16927]: AH00558: httpd: Could not reliably determine the server's fully qualified domain ...message
    21. Oct 08 17:40:45 cobber-server systemd[1]: Started The Apache HTTP Server.
    22. Hint: Some lines were ellipsized, use -l to show in full.
    23. [root@cobber-server ~]#

    启动cobbble服务

    1. [root@cobber-server ~]# systemctl enable cobblerd.service
    2. Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
    3. [root@cobber-server ~]# systemctl restart cobblerd.service
    4. [root@cobber-server ~]# systemctl status cobblerd.service
    5. cobblerd.service - Cobbler Helper Daemon
    6. Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; enabled; vendor preset: disabled)
    7. Active: active (running) since Thu 2020-10-08 17:39:35 CST; 6s ago
    8. Process: 16876 ExecStartPost=/usr/bin/touch /usr/share/cobbler/web/cobbler.wsgi (code=exited, status=1/FAILURE)
    9. Main PID: 16875 (cobblerd)
    10. CGroup: /system.slice/cobblerd.service
    11. └─16875 /usr/bin/python2 -s /usr/bin/cobblerd -F
    12. Oct 08 17:39:35 cobber-server systemd[1]: Starting Cobbler Helper Daemon...
    13. Oct 08 17:39:35 cobber-server touch[16876]: /usr/bin/touch: cannot touch ‘/usr/share/cobbler/web/cobbler.wsgi’: No such file directory
    14. Oct 08 17:39:35 cobber-server systemd[1]: Started Cobbler Helper Daemon.
    15. Hint: Some lines were ellipsized, use -l to show in full.
    16. [root@cobber-server ~]#

    配置cobble 服务

    根据提示修改这8个配置

    1. [root@cobber-server ~]# cobbler check
    2. The following are potential configuration items that you may want to fix:
    3. 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.
    4. 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.
    5. 3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
    6. 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.
    7. 5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
    8. 6 : ksvalidator was not found, install pykickstart
    9. 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
    10. 8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
    11. Restart cobblerd and then run 'cobbler sync' to apply changes.
    12. [root@cobber-server ~]#
    1. 1.修改/etc/cobbler/settings文件中的server参数的值为提供cobbler服务的主机相应的IP地址或主机名,如server: 192.168.6.90
    2. sed -i 's/server: 127.0.0.1/server: 192.168.6.90/' /etc/cobbler/settings
    3. 2.修改/etc/cobbler/settings文件中的next_server参数的值为提供PXE服务的主机相应的IP地址,如next_server:192.168.6.90
    4. sed -i 's/next_server: 127.0.0.1/next_server: 192.168.6.90/' /etc/cobbler/settings
    5. 3.修改/etc/xinetd.d/tftp文件中的disable参数修改为disable = no
    6. 4.执行cobbler get-loaders命令即可;否则,需要安装syslinux程序包,而后复制/usr/share/syslinux/{pxelinux.0,memu.c32}等文件至/var/lib/cobbler/loaders/目录中;
    7. cobbler get-loaders
    8. 5.执行systemctl enable rsyncd命令即可;
    9. 6.如果有强迫症可以选择yum y install debmirror然后根据错误进行解决,一般错误如下。
    10. ## 注释/etc/dedmirror.conf文件中的@dists=”sid”;@arches=”i386”;
    11. 7.[root@cobbler-node1 ~]# openssl passwd -1 -salt '$(openssl rand -hex 4)' 'EC' $1$$(openss$yWzTjLjGmjQJUbnsOQnx8/
    12. [root@cobbler-node1 ~]# grep "default_password_crypted" /etc/cobbler/settings #替换/etc/cobbler/setting内的default_password_crypted
    13. default_password_crypted: "$1$$(openss$yWzTjLjGmjQJUbnsOQnx8/"
    14. 8.yum y install cman fence-agents
    15. systemctl restart cobblerd #最后重启Cobbler
    1. [root@cobber-server ~]# mount /dev/sr0 /mnt/
    2. mount: /dev/sr0 is write-protected, mounting read-only
    3. [root@cobber-server ~]#
    4. [root@cobber-server ~]# df -TH
    5. Filesystem Type Size Used Avail Use% Mounted on
    6. devtmpfs devtmpfs 1.1G 0 1.1G 0% /dev
    7. tmpfs tmpfs 1.1G 0 1.1G 0% /dev/shm
    8. tmpfs tmpfs 1.1G 9.3M 1.1G 1% /run
    9. tmpfs tmpfs 1.1G 0 1.1G 0% /sys/fs/cgroup
    10. /dev/mapper/centos-root xfs 29G 2.1G 27G 8% /
    11. /dev/sda1 xfs 1.1G 175M 889M 17% /boot
    12. tmpfs tmpfs 210M 0 210M 0% /run/user/0
    13. /dev/sr0 iso9660 4.8G 4.8G 0 100% /mnt
    14. [root@cobber-server ~]# cobbler import --name=CentOS-7.8-x86_64 --path=/mnt/
    15. task started: 2020-10-08_200351_import
    16. task started (id=Media import, time=Thu Oct 8 20:03:51 2020)
    17. Found a candidate signature: breed=redhat, version=rhel6
    18. Found a candidate signature: breed=redhat, version=rhel7
    19. Found a matching signature: breed=redhat, version=rhel7
    20. Adding distros from path /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64:
    21. creating new distro: CentOS-7.8-x86_64
    22. trying symlink: /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64 -> /var/www/cobbler/links/CentOS-7.8-x86_64
    23. creating new profile: CentOS-7.8-x86_64
    24. associating repos
    25. checking for rsync repo(s)
    26. checking for rhn repo(s)
    27. checking for yum repo(s)
    28. starting descent into /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64 for CentOS-7.8-x86_64
    29. processing repo at : /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64
    30. need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64
    31. looking for /var/www/cobbler/ks_mirror/CentOS-7.8-x86_64/repodata/*comps*.xml
    32. Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS-7.8-x86_64/repodata
    33. *** TASK COMPLETE ***
    34. [root@cobber-server ~]# cobbler distro list
    35. CentOS-7.8-x86_64
    36. [root@cobber-server ~]#