美文网首页
六.Cobbler服务安装

六.Cobbler服务安装

作者: 妄语莫言 | 来源:发表于2019-02-23 03:25 被阅读0次

    一.环境准备
    操作系统:最小化安装centos7系统

    #安装一些必要工具
    [root@cobbler /]#  yum install -y vim
    [root@cobbler /]#  yum install -y tree
    [root@cobbler /]#  yum install -y net-tools
    [root@cobbler /]# yum install -y wget
    #修改seliunx
    [root@cobbler /]# vim /etc/selinux/config
    SELINUX=disabled
    #关闭防火墙
    [root@cobbler /]# systemctl disable firewalld
    Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
    Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
    #备份源文件更换阿里网易源及epel扩展源
    [root@cobbler /]# cd /etc/yum.repos.d/
    [root@cobbler yum.repos.d]# mkdir repo_bak
    [root@cobbler yum.repos.d]# mv *.repo repo_bak/
    [root@cobbler yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
    [root@cobbler yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
    [root@cobbler yum.repos.d]# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
    [root@cobbler yum.repos.d]# yum clean all
    [root@cobbler yum.repos.d]# yum makecache
    [root@cobbler yum.repos.d]# yum install -y epel-release
    [root@cobbler yum.repos.d]# yum repolist enabled
    Loaded plugins: fastestmirror
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Repository centosplus is listed more than once in the configuration
    Repository epel is listed more than once in the configuration
    Repository epel-debuginfo is listed more than once in the configuration
    Repository epel-source is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
    repo id                              repo name                                                          status
    base/7/x86_64                        CentOS-7 - Base - 163.com                                          10,019
    epel/x86_64                          Extra Packages for Enterprise Linux 7 - x86_64                     12,911
    extras/7/x86_64                      CentOS-7 - Extras - 163.com                                           364
    updates/7/x86_64                     CentOS-7 - Updates - 163.com                                        1,067
    repolist: 24,361
    [root@cobbler yum.repos.d]# yum repolist all
    Loaded plugins: fastestmirror
    Repository base is listed more than once in the configuration
    Repository updates is listed more than once in the configuration
    Repository extras is listed more than once in the configuration
    Repository centosplus is listed more than once in the configuration
    Repository epel is listed more than once in the configuration
    Repository epel-debuginfo is listed more than once in the configuration
    Repository epel-source is listed more than once in the configuration
    Loading mirror speeds from cached hostfile
    repo id                       repo name                                                        status
    base/7/x86_64                 CentOS-7 - Base - 163.com                                        enabled: 10,019
    centosplus/7/x86_64           CentOS-7 - Plus - 163.com                                        disabled
    contrib/7/x86_64              CentOS-7 - Contrib - mirrors.aliyun.com                          disabled
    epel/x86_64                   Extra Packages for Enterprise Linux 7 - x86_64                   enabled: 12,911
    epel-debuginfo/x86_64         Extra Packages for Enterprise Linux 7 - x86_64 - Debug           disabled
    epel-source                   Extra Packages for Enterprise Linux 7 - x86_64 - Source          disabled
    epel-testing/x86_64           Extra Packages for Enterprise Linux 7 - Testing - x86_64         disabled
    epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug disabled
    epel-testing-source/x86_64    Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Sourc disabled
    extras/7/x86_64               CentOS-7 - Extras - 163.com                                      enabled:    364
    updates/7/x86_64              CentOS-7 - Updates - 163.com                                     enabled:  1,067
    repolist: 24,361
    [root@cobbler yum.repos.d]# ls
    CentOS7-Base-163.repo  Centos-7.repo  epel-7.repo  epel.repo  epel-testing.repo  repo_bak
    

    关于centos7防火墙操作补充

    启动: systemctl start firewalld
    关闭: systemctl stop firewalld
    查看状态: systemctl status firewalld 
    开机禁用  : systemctl disable firewalld
    开机启用  : systemctl enable firewalld
    查看服务是否开机启动:systemctl is-enabled firewalld.service
    查看已启动的服务列表:systemctl list-unit-files|grep enabled
    查看启动失败的服务列表:systemctl --failed
    [root@turingvideo ~]# systemctl is-enabled firewalld.service
    disabled
    查看版本: firewall-cmd --version
    查看帮助: firewall-cmd --help
    显示状态: firewall-cmd --state
    查看所有打开的端口: firewall-cmd --zone=public --list-ports
    更新防火墙规则: firewall-cmd --reload
    查看区域信息:  firewall-cmd --get-active-zones
    查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
    拒绝所有包:firewall-cmd --panic-on
    取消拒绝状态: firewall-cmd --panic-off
    查看是否拒绝: firewall-cmd --query-panic
    添加
    firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
    重新载入
    firewall-cmd --reload
    查看
    firewall-cmd --zone= public --query-port=80/tcp
    删除
    firewall-cmd --zone= public --remove-port=80/tcp --permanent
    

    系统环境检查

    [root@cobbler ~]# cat /etc/redhat-release      #系统版本
    CentOS Linux release 7.6.1810 (Core)  
    [root@cobbler ~]# uname -r                     #内核版本
    3.10.0-957.el7.x86_64
    [root@cobbler ~]# getenforce                   #selinux
    Disabled
    [root@v ~]# systemctl status firewalld   #防火墙状态
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
       Active: inactive (dead)
         Docs: man:firewalld(1)
    [root@cobbler ~]# hostname                      #检查主机名
    cobbler
    [root@cobbler ~]# ifconfig|grep broadcast
            inet 192.168.28.90  netmask 255.255.255.0  broadcast 192.168.28.255
    

    二.安装cobbler及相关组件并修改配置文件整合资源

    #yum安装相关组件
    [root@cobbler ~]# yum install cobbler cobbler-web pykickstart httpd dhcp tftp-server -y
    cobbler            #cobbler程序包
    cobbler-web        #cobbler的web服务包
    pykickstart        #cobbler检查kickstart语法错误
    httpd              #Apache web服务
    dhcp               #dhcp服务
    tftp-server        #tftp服务
    #cobbler配置文件简介
    /etc/cobbler                   # 配置文件目录
    /etc/cobbler/settings         # cobbler主配置文件
    /etc/cobbler/dhcp.template    # DHCP服务的配置模板
    /etc/cobbler/tftpd.template   # tftp服务的配置模板
    /etc/cobbler/rsync.template   # rsync服务的配置模板
    /etc/cobbler/iso              # iso模板配置文件目录
    /etc/cobbler/pxe              # pxe模板文件目录
    /etc/cobbler/power            # 电源的配置文件目录
    /etc/cobbler/users.conf       # Web服务授权配置文件
    /etc/cobbler/users.digest     # web访问的用户名密码配置文件
    /etc/cobbler/dnsmasq.template # DNS服务的配置模板
    /etc/cobbler/modules.conf     # Cobbler模块配置文件
    /var/lib/cobbler               # Cobbler数据目录
    /var/lib/cobbler/config       # 配置文件
    /var/lib/cobbler/kickstarts   # 默认存放kickstart文件
    /var/lib/cobbler/loaders      # 存放的各种引导程序
    /var/www/cobbler               # 系统安装镜像目录
    /var/www/cobbler/ks_mirror    # 导入的系统镜像列表
    /var/www/cobbler/images       # 导入的系统镜像启动文件
    /var/www/cobbler/repo_mirror  # yum源存储目录
    /var/log/cobbler               # 日志目录
    /var/log/cobbler/install.log  # 客户端系统安装日志
    /var/log/cobbler/cobbler.log  # cobbler日志
    

    检测cobbler
    cobbler的运行依赖于dhcp、tftp、rsync及dns服务,其中dhcp可由dhcpd(isc)提供,也可由dnsmasq提供;tftp可由tftp-server程序包提供,也可由cobbler功能提供,rsync有rsync程序包提供,dns可由bind提供,也可由dnsmasq提供
       cobbler可自行管理这些服务中的部分甚至是全部,但需要配置/etc/cobbler/settings文件中的“manange_dhcp”、“manager_tftpd”、“manager_rsync”、“manager_dns”分别来进行定义,另外,由于各种服务都有着不同的实现方式,如若需要进行自定义,需要通过修改/etc/cobbler/modules.conf配置文件中各服务的模块参数的值来实现

    #重启httpd服务及cobbler服务后进行检测
    [root@cobbler ~]# systemctl restart httpd
    [root@cobbler ~]# systemctl restart cobblerd
    [root@cobbler ~]# 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 : enable and start rsyncd.service with systemctl
    6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
    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.
    

    修改配置文件逐条解决上述8个问题

    #先备份cobbler主配置文件
    [root@cobbler ~]# cd  /etc/cobbler/
    [root@cobbler cobbler]# cp settings settings.bak
    [root@cobbler cobbler]# ls
    auth.conf       dnsmasq.template        modules.conf    reporting           settings.bak    zone.template
    cheetah_macros  genders.template        mongodb.conf    rsync.exclude       tftpd.template  zone_templates
    cobbler_bash    import_rsync_whitelist  named.template  rsync.template      users.conf
    completions     iso                     power           secondary.template  users.digest
    dhcp.template   ldap                    pxe             settings            version
    
    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.
    解决方法:
    [root@cobbler cobbler]# vim  /etc/cobbler/setting
    378 # this is the address of the cobbler server -- as it is used
    379 # by systems during the install process, it must be the address
    380 # or hostname of the system as those systems can see the server.
    381 # if you have a server that appears differently to different subnets
    382 # (dual homed, etc), you need to read the --server-override section
    383 # of the manpage for how that works.
    384 server: 192.168.28.90   #将384行127.0.0.1修改为本机IP地址
    
    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.
    解决方法:
    [root@cobbler cobbler]# vim  /etc/cobbler/setting
    269 # if using cobbler with manage_dhcp, put the IP address
    270 # of the cobbler server here so that PXE booting guests can find it
    271 # if you do not set this correctly, this will be manifested in TFTP open timeouts.
    272 next_server: 192.168.28.90  #将272行127.0.0.1修改为本机IP地址,pxe服务器的IP,用Cobbler管理DHCP,所以填Cobbler服务器的IP
    
    3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
    解决方法
    [root@cobbler cobbler]# vim /etc/xinetd.d/tftp
    # default: off
    # description: The tftp server serves files using the trivial file transfer \
    #       protocol.  The tftp protocol is often used to boot diskless \
    #       workstations, download configuration files to network-aware printers, \
    #       and to start the installation process for some operating systems.
    service tftp
    {
            socket_type             = dgram
            protocol                = udp
            wait                    = yes
            user                    = root
            server                  = /usr/sbin/in.tftpd
            server_args             = -s /var/lib/tftpboot
            disable                 = no       #将默认yes改为no
            per_source              = 11
            cps                     = 100 2
            flags                   = IPv4
    }
    
    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.
    解决方法:
    [root@cobbler cobbler]#  cobbler get-loaders
    task started: 2019-02-22_151023_get_loaders
    task started (id=Download Bootloader Content, time=Fri Feb 22 15:10:23 2019)
    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 cobbler]# ls /var/lib/cobbler/loaders/
    COPYING.elilo     COPYING.yaboot  grub-x86_64.efi  menu.c32    README
    COPYING.syslinux  elilo-ia64.efi  grub-x86.efi     pxelinux.0  yaboot
    #不执行该命令需要安装syslinux程序包,而后复制/usr/share/syslinux/{pxelinux.0,memu.c32}等文件至/var/lib/cobbler/loaders/目录中;
    
    5 : enable and start rsyncd.service with systemctl
    解决方法:
    #启动rsync服务
    [root@cobbler cobbler]# systemctl status rsyncd              #默认rsync服务是关闭的
    ● rsyncd.service - fast remote file copy program daemon
       Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; disabled; vendor preset: disabled)
       Active: inactive (dead)
    [root@cobbler cobbler]# systemctl enable rsyncd             #加入开机自 启动
    Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
    [root@cobbler cobbler]# systemctl start rsyncd                #开启rsync服务
    [root@cobbler cobbler]# systemctl status rsyncd              #检查rsync服务状态
    ● rsyncd.service - fast remote file copy program daemon
       Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; enabled; vendor preset: disabled)
       Active: active (running) since Fri 2019-02-22 15:29:54 CST; 5s ago
     Main PID: 9854 (rsync)
       CGroup: /system.slice/rsyncd.service
               └─9854 /usr/bin/rsync --daemon --no-detach
    
    Feb 22 15:29:54 cobbler systemd[1]: Started fast remote file copy program daemon.
    Feb 22 15:29:54 cobbler rsyncd[9854]: rsyncd version 3.1.2 starting, listening on port 873
    
    6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
    解决办法:
    提示说debmirror没安装
    [root@cobbler cobbler]#  yum install debmirror -y
    
    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
    解决办法:
    #生成密码来取代默认的密码,更安全
    [root@cobbler cobbler]# openssl passwd -1 -salt 'root' '1234qwer'
    $1$root$TTyJXKDRPSOyf1qm53dFA0
    #将生成的密码粘贴到setting配置文件的101行
     92 # cobbler has various sample kickstart templates stored
     93 # in /var/lib/cobbler/kickstarts/.  This controls
     94 # what install (root) password is set up for those
     95 # systems that reference this variable.  The factory
     96 # default is "cobbler" and cobbler check will warn if
     97 # this is not changed.
     98 # The simplest way to change the password is to run 
     99 # openssl passwd -1
    100 # and put the output between the "" below.
    101 default_password_crypted: "$1$root$TTyJXKDRPSOyf1qm53dFA0"
    
    8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
    解决办法:
    [root@cobbler cobbler]#   yum install fence-agents -y
    

    其他一些配置文件上参数修改

    [root@cobbler ~]# vim /etc/cobbler/settings
    # 用Cobbler管理DHCP将242行默认值从0改为1
    240 # set to 1 to enable Cobbler's DHCP management features.
    241 # the choice of DHCP management engine is in /etc/cobbler/modules.conf
    242 manage_dhcp: 1
    #防止循环装系统,适用于服务器第一启动项是PXE启动,将29行默认值改为1
    285 # if this setting is set to 1, cobbler systems that pxe boot
    286 # will request at the end of their installation to toggle the 
    287 # --netboot-enabled record in the cobbler system record.  This eliminates
    288 # the potential for a PXE boot loop if the system is set to PXE
    289 # first in it's BIOS order.  Enable this if PXE is first in your BIOS
    290 # boot order, otherwise leave this disabled.   See the manpage
    291 # for --netboot-enabled.
    292 pxe_just_once: 1
    

    重启cobbler服务检测

    [root@cobbler ~]# systemctl restart httpd
    [root@cobbler ~]# systemctl restart cobblerd
    [root@cobbler ~]# cobbler check
    The following are potential configuration items that you may want to fix:
    
    1 : comment out 'dists' on /etc/debmirror.conf for proper debian support
    2 : comment out 'arches' on /etc/debmirror.conf for proper debian support
    
    Restart cobblerd and then run 'cobbler sync' to apply changes.
    解决办法:
    #注释掉/etc/debmirror.conf文件中的28行30行
    [root@cobbler ~]# vim  /etc/debmirror.conf
     28 #@dists="sid";
     29 @sections="main,main/debian-installer,contrib,non-free";
     30 #@arches="i386";
    [root@cobbler ~]# cobbler check
    No configuration problems found.  All systems go.
    #cobbler配置基本完成
    

    配置DHCP模板并进行同步

    #备份dhcp模板文件
    [root@cobbler cobbler]# cp dhcp.template dhcp.template.bak
    [root@cobbler cobbler]# vim /etc/cobbler/dhcp.template 
     11 ddns-update-style interim;
     12 
     13 allow booting;
     14 allow bootp;
     15 
     16 ignore client-updates;
     17 set vendorclass = option vendor-class-identifier;
     18 
     19 option pxe-system-type code 93 = unsigned integer 16;
     20 
     21 subnet 192.168.28.0 netmask 255.255.255.0 {
     22      option routers             192.168.28.1;
     23      option domain-name-servers 192.168.28.1;
     24      option subnet-mask         255.255.255.0;
     25      range dynamic-bootp        192.168.28.100 192.168.28.254;
     26      default-lease-time         21600;
     27      max-lease-time             43200;
     28      next-server                $next_server;
     29      class "pxeclients" {
     30           match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
     31           if option pxe-system-type = 00:02 {
     32                   filename "ia64/elilo.efi";
     33           } else if option pxe-system-type = 00:06 {
     34                   filename "grub/grub-x86.efi";
     35           } else if option pxe-system-type = 00:07 {
     36                   filename "grub/grub-x86_64.efi";
     37           } else if option pxe-system-type = 00:09 {
     38                   filename "grub/grub-x86_64.efi";
     39           } else {
     40                   filename "pxelinux.0";
     41           }
     42      }
     43 
     44 }
    #重启服务后同步
    [root@cobbler cobbler]# systemctl restart httpd
    [root@cobbler cobbler]# systemctl restart cobblerd
    [root@cobbler cobbler]# cobbler sync
    task started: 2019-02-22_170039_sync
    task started (id=Sync, time=Fri Feb 22 17:00:39 2019)
    running pre-sync triggers
    cleaning trees
    removing: /var/lib/tftpboot/grub/images
    copying bootloaders
    trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
    trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
    trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
    trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
    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.manage_genders
    running python trigger cobbler.modules.scm_track
    running shell triggers from /var/lib/cobbler/triggers/change/*
    *** TASK COMPLETE ***
    #查看dhcp同步配置文件
    [root@cobbler cobbler]# cat /etc/dhcp/dhcpd.conf 
    # ******************************************************************
    # Cobbler managed dhcpd.conf file
    # generated from cobbler dhcp.conf template (Fri Feb 22 09:00:40 2019)
    # 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 192.168.28.0 netmask 255.255.255.0 {
         option routers             192.168.28.1;
         option domain-name-servers 192.168.28.1;
         option subnet-mask         255.255.255.0;
         range dynamic-bootp        192.168.28.100 192.168.28.254;
         default-lease-time         21600;
         max-lease-time             43200;
         next-server                192.168.28.90;
         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 for Cobbler DHCP tag: default
    group {
    }
    

    将各个组件服务加入开机自动

    [root@cobbler cobbler]# systemctl enable httpd
    Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
    [root@cobbler cobbler]# systemctl enable dhcpd
    Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
    [root@cobbler cobbler]# systemctl enable rsyncd
    [root@cobbler cobbler]# systemctl enable tftp
    Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
    [root@cobbler cobbler]# systemctl enable cobblerd
    Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
    [root@cobbler cobbler]# systemctl  list-unit-files |grep enable|grep httpd
    httpd.service                                 enabled 
    [root@cobbler cobbler]# systemctl  list-unit-files |grep enable|grep rsync
    rsyncd.service                                enabled 
    [root@cobbler cobbler]# systemctl  list-unit-files |grep enable|grep  dhcp
    dhcpd.service                                 enabled 
    [root@cobbler cobbler]# systemctl  list-unit-files |grep enable|grep  tftp
    tftp.socket                                   enabled 
    [root@cobbler cobbler]# systemctl  list-unit-files |grep enable|grep  cobbler
    cobblerd.service                              enabled 
    [root@cobbler cobbler]# systemctl restart rsyncd
    [root@cobbler cobbler]# systemctl restart tftp
    [root@cobbler cobbler]# systemctl restart  httpd
    [root@cobbler cobbler]# systemctl restart  dhcpd
    [root@cobbler cobbler]# systemctl restart  cobblerd
    

    以上完成cobbler服务安装完成

    相关文章

      网友评论

          本文标题:六.Cobbler服务安装

          本文链接:https://www.haomeiwen.com/subject/ptqsyqtx.html