其他分享
首页 > 其他分享> > cobbler

cobbler

作者:互联网

 


1. cobbler简介

Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCPDNS等。

Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。

Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。

Cobbler官网

cobbler集成的服务

cobbler配置文件详解
cobbler配置文件目录在/etc/cobbler

配置文件作用
/etc/cobbler/settings cobbler 主配置文件
/etc/cobbler/iso/ iso模板配置文件
/etc/cobbler/pxe pxe模板配置文件
/etc/cobbler/power 电源配置文件
/etc/cobbler/user.conf web服务授权配置文件
/etc/cobbler/users.digest web访问的用户名密码配置文件
/etc/cobbler/dhcp.template dhcp服务器的的配置模板
/etc/cobbler/dnsmasq.template dns服务器的配置模板
/etc/cobbler/tftpd.template tftp服务的配置模板
/etc/cobbler/modules.conf 模块的配置文件

cobbler数据目录

目录作用
/var/lib/cobbler/config/ 用于存放distros,system,profiles等信息配置文件
/var/lib/cobbler/triggers/ 用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstart/ 默认存放kickstart文件
/var/lib/cobbler/loaders/ 存放各种引导程序以及镜像目录
/var/www/cobbler/ks_mirror/ 导入的发行版系统的所有数据
/var/www/cobbler/images/ 导入发行版的kernel和initrd镜像用于远程网络启动
/var/www/cobbler/repo_mirror/ yum仓库存储目录

cobbler日志文件

日志文件路径说明
/var/log/cobbler/installing 客户端安装日志
/var/log/cobbler/cobbler.log cobbler日志

cobbler命令详解

cobbler check       //核对当前设置是否有问题
cobbler list        //列出所有的cobbler元素
cobbler report      //列出元素的详细信息
cobbler sync        //同步配置到数据目录,更改配置最好都要执行下
cobbler reposync    //同步yum仓库
cobbler distro      //查看导入的发行版系统信息
cobbler system      //查看添加的系统信息
cobbler profile     //查看配置信息

cobbler服务端部署

# 关闭selinux和防火墙,配置yum源
[root@localhost ~]# systemctl disable --now firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service
[root@localhost ~]# setenforce 0
[root@localhost ~]# vi /etc/selinux/config
SELINUX=disabled
[root@localhost ~]# reboot  #从起生效
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Stream-AppStream.repo  CentOS-Stream-HighAvailability.repo
CentOS-Stream-BaseOS.repo     CentOS-Stream-Media.repo
CentOS-Stream-Debuginfo.repo  CentOS-Stream-PowerTools.repo
CentOS-Stream-Extras.repo     CentOS-Stream-RealTime.repo
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# ls
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--100  2495  100  2495    0     0  12794      0 --:--:-- --:--:-- --:--:-- 1100  2495  100  2495    0     0  12794      0 --:--:-- --:--:-- --:--:-- 12729
[root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# dnf clean all
38 files removed
[root@localhost yum.repos.d]# dnf makecache
# 开启cobbler源,然后再继续安装软件包
[root@localhost ~]# yum module list|grep cobbler  #查找开启服务需要的源
cobbler              3               default [d]    Versatile Linux deployment server
cobbler              3.3             default    Versatile Linux deployment server
[root@localhost ~]# yum -y module enable cobbler:3  #  下载
Last metadata expiration check: 0:10:11 ago on Sun 14 Aug 2022 06:47:04 AM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Dependencies resolved.
==========================================================================
 Package          Architecture    Version          Repository        Size
==========================================================================
Enabling module streams:
 cobbler                          3

Transaction Summary
==========================================================================

Complete!
#下载服务和依赖包
[root@localhost ~]# yum -y install rsync rsync-daemon httpd dhcp* tftp pykickstart cobbler cobbler-web wget vim 
#  启动http、cobblerd、rsync、tftp并设置开机自启
[root@localhost ~]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service→ /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl enable --now cobblerd
Created symlink /etc/systemd/system/multi-user.target.wants/cobblerd.service → /usr/lib/systemd/system/cobblerd.service.
[root@localhost ~]# systemctl enable --now rsyncd
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service → /usr/lib/systemd/system/rsyncd.service.
[root@localhost ~]# systemctl enable --now tftp
Created symlink /etc/systemd/system/sockets.target.wants/tftp.socket → /usr/lib/systemd/system/tftp.socket.
[root@localhost ~]# ss -antl
State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port Process
LISTEN  0       5              0.0.0.0:873          0.0.0.0:*
LISTEN  0       128            0.0.0.0:22           0.0.0.0:*
LISTEN  0       5            127.0.0.1:25151        0.0.0.0:*
LISTEN  0       5                 [::]:873             [::]:*
LISTEN  0       128                  *:80                 *:*
LISTEN  0       128               [::]:22              [::]:*
LISTEN  0       128                  *:443                *:*
#  生成一个加密的密码,写入到配置文件中 更改配置文件中的IP地址,改成本机的IP地址
[root@localhost ~]#  openssl passwd -1  #密码是给服务用的
Password:
Verifying - Password:
$1$IMGpvxw.$b.bIxf136TQbwIykwbwTV.
[root@localhost ~]# cd /etc/cobbler/
[root@localhost cobbler]# vim settings.yaml
server: 192.168.6.142
next_server: 192.168.6.142
default_password_crypted: "$1$IMGpvxw.$b.bIxf136TQbwIykwbwTV."
#打开DHCP功能,并配置DHCP模板文件
[root@localhost ~]# cd /etc/cobbler/
manage_dhcp: true
[root@localhost cobbler]# vim dhcp.template
subnet 192.168.6.0 netmask 255.255.255.0 {
     option routers             192.168.6.2;
     option domain-name-servers 114.114.114.114;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.6.100 192.168.6.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";
#重启cobbler
[root@localhost cobbler]# systemctl restart cobblerd
#执行检查环境命令
[root@localhost cobbler]# cobbler check
The following are potential configuration items that you may want to fix:

1: some network boot-loaders are missing from /var/lib/cobbler/loaders. 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 canignore this message entirely. Files in this directory, should you want tosupport all architectures, should include pxelinux.0, menu.c32, and yaboot.
2: reposync is not installed, install yum-utils or dnf-plugins-core
3: yumdownloader is not installed, install yum-utils or dnf-plugins-core
4: debmirror package is not installed, it will be required to manage debian deployments and repositories
5: 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.
#解决办法
1.[root@localhost loaders]# yum -y install syslinux  # 下载这个包
[root@localhost cobbler]# cd /var/lib/cobbler/loaders  #进到这个目录
[root@localhost loaders]# ls
复制这两个文件过来,执行那个脚本
[root@localhost loaders]# cp /usr/share/syslinux/pxelinux.0 .  
[root@localhost loaders]# cp /usr/share/syslinux/menu.c32 .
[root@localhost loaders]# /usr/share/cobbler/bin/mkgrub.sh
[root@localhost loaders]# ls
grub  ldlinux.c32  menu.c32  pxelinux.0
2.3[root@localhost loaders]# yum -y install yum-utils
4.5为debian系统错误可以忽略
# 重启并同步一下
[root@localhost loaders]# systemctl restart cobblerd
[root@localhost loaders]# cobbler sync
task started: 2022-08-14_080257_sync
task started (id=Sync, time=Sun Aug 14 08:02:57 2022)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/images
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig','/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
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/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***
#查看DHCP是否打开
[root@localhost loaders]# ss -anulp|grep dhcpd
UNCONN 0      0            0.0.0.0:67         0.0.0.0:*    users:(("dhcpd",pid=14068,fd=10))
UNCONN 0      0            0.0.0.0:54027      0.0.0.0:*    users:(("dhcpd",pid=14068,fd=20))
UNCONN 0      0               [::]:60843         [::]:*    users:(("dhcpd",pid=14068,fd=21))
# 挂载光盘
[root@localhost loaders]# mount /dev/cdrom /mnt/
mount: /mnt: WARNING: device write-protected, mounted read-only.

#选项
#   --path      //镜像路径
#    --name      //为安装源定义一个名字
#    --arch      //指定安装源平台
[root@localhost loaders]# cobbler import --path=/mnt --name=centos8 --arch=x86_64
task started: 2022-08-14_081203_import
task started (id=Media import, time=Sun Aug 14 08:12:03 2022)
running python triggers from /var/lib/cobbler/triggers/task/import/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/import/pre/*
shell triggers finished successfully
Found a candidate signature: breed=redhat, version=rhel8
Found a matching signature: breed=redhat, version=rhel8
Adding distros from path /var/www/cobbler/distro_mirror/centos8-x86_64:
creating new distro: centos8-x86_64
trying symlink: /var/www/cobbler/distro_mirror/centos8-x86_64 -> /var/www/cobbler/links/centos8-x86_64
creating new profile: centos8-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/distro_mirror/centos8-x86_64 for centos8-x86_64
processing repo at : /var/www/cobbler/distro_mirror/centos8-x86_64/AppStream
need to process repo/comps: /var/www/cobbler/distro_mirror/centos8-x86_64/AppStream
looking for /var/www/cobbler/distro_mirror/centos8-x86_64/AppStream/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos8-x86_64/AppStream/repodata
processing repo at : /var/www/cobbler/distro_mirror/centos8-x86_64/BaseOS
need to process repo/comps: /var/www/cobbler/distro_mirror/centos8-x86_64/BaseOS
looking for /var/www/cobbler/distro_mirror/centos8-x86_64/BaseOS/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos8-x86_64/BaseOS/repodata
*** TASK COMPLETE ***
#查看镜像列表,当中列着发行版和配置文件
[root@localhost loaders]# cobbler list
distros:
   centos8-x86_64

profiles:
   centos8-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:
#创建kickstarts自动安装脚本
这个脚本是系统安装时的操作,也就是装系统的时候让你设置的时区、密码、最小化等等。这里写成了一个脚本
[root@localhost templates]# cobbler profile get-autoinstall --name centos8-x86_64
# Sample kickstart file for current EL, Fedora based distributions.

#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=http://192.168.6.142/cblr/links/centos8-x86_64
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
repo --name=source-1 --baseurl=http://192.168.6.142/cobbler/distro_mirror/centos8-x86_64/AppStream
repo --name=source-2 --baseurl=http://192.168.6.142/cobbler/distro_mirror/centos8-x86_64/BaseOS

# Network information
network --bootproto=dhcp --device=eth0 --onboot=on

# Reboot after installation
reboot

#Root password
rootpw --iscrypted $1$mP8v5yD2$bXKYEI0Mo4jdZEc6u8oEw1
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone  America/New_York
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
autopart

%pre
set -x -v
exec 1>/tmp/ks-pre.log 2>&1

# Once root's homedir is there, copy over the log.
while : ; do
    sleep 10
    if [ -d /mnt/sysimage/root ]; then
        cp /tmp/ks-pre.log /mnt/sysimage/root/
        logger "Copied %pre section log to system"
        break
    fi
done &



# Enable installation monitoring

%end

%packages
%end

%post --nochroot
set -x -v
exec 1>/mnt/sysimage/root/ks-post-nochroot.log 2>&1

%end

%post
set -x -v
exec 1>/root/ks-post.log 2>&1

# Start yum configuration
curl "http://192.168.6.142/cblr/svc/op/yum/profile/centos8-x86_64" --output /etc/yum.repos.d/cobbler-config.repo

# End yum configuration



# Start post_install_network_config generated code
# End post_install_network_config generated code

# Start download cobbler managed config files (if applicable)
# End download cobbler managed config files (if applicable)

# Start koan environment setup
echo "export COBBLER_SERVER=192.168.6.142" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER 192.168.6.142" > /etc/profile.d/cobbler.csh
# End koan environment setup

$SNIPPET('redhat_register')
# Begin cobbler registration
# cobbler registration is disabled in /etc/cobbler/settings.yaml
# End cobbler registration

# Enable post-install boot notification

# Start final steps

curl "http://192.168.6.142/cblr/svc/op/autoinstall/profile/centos8-x86_64" -o /root/cobbler.ks
# End final steps
%end
[root@localhost templates]# vim centos8.ks

[root@localhost templates]# cat centos8.ks
auth  --useshadow  --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled //修改为关闭
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.6.142/cblr/links/centos8-x86_64
repo --name=source-1 --baseurl=http://192.168.6.142/cobbler/distro_mirror/centos8-x86_64/AppStream
repo --name=source-2 --baseurl=http://192.168.6.142/cobbler/distro_mirror/centos8-x86_64/BaseOS

network --bootproto=dhcp --device=eth0 --onboot=on

reboot

rootpw --iscrypted $1$mP8v5yD2$bXKYEI0Mo4jdZEc6u8oEw1
selinux --disabled
skipx
timezone  Asia/Shanghai --isUtc --nontp  //修改时区
install
zerombr
autopart

%pre
set -x -v
exec 1>/tmp/ks-pre.log 2>&1

while : ; do
    sleep 10
    if [ -d /mnt/sysimage/root ]; then
        cp /tmp/ks-pre.log /mnt/sysimage/root/
        logger "Copied %pre section log to system"
        break
    fi
done &




%end

%packages
@^minimal-environment  //最小化安装
%end

%post --nochroot
set -x -v
exec 1>/mnt/sysimage/root/ks-post-nochroot.log 2>&1

%end

%post
set -x -v
exec 1>/root/ks-post.log 2>&1

curl "http://192.168.6.142/cblr/svc/op/yum/profile/centos8-x86_64" --output /etc/yum.repos.d/cobbler-config.repo




echo "export COBBLER_SERVER=192.168.6.142" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER 192.168.6.142" > /etc/profile.d/cobbler.csh

$SNIPPET('redhat_register')

curl "http://192.168.6.142/cblr/svc/op/autoinstall/profile/centos8-x86_64" -o /root/cobbler.ks
%end
#检查ks文件是否有语法等问题
[root@localhost templates]# cobbler validate-autoinstalls
task started: 2022-08-14_082417_validate_autoinstall_files
task started (id=Automated installation files validation, time=Sun Aug 1408:24:17 2022)
running python triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/validate_autoinstall_files/pre/*
shell triggers finished successfully
*** TASK COMPLETE ***
#查看当前系统使用的配置文件是不是刚刚创建的脚本,如果不是要修改
[root@localhost ~]# cobbler profile report
Name                           : centos8-x86_64
Automatic Installation Template : sample.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : centos8-x86_64
Enable gPXE?                   : False
Enable PXE Menu?               : True
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 :
Proxy                          :
Red Hat Management Key         : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : True
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      :
Virt RAM (MB)                  : 512
Virt Type                      : kvm
#修改成刚才创建的
[root@localhost ~]# cobbler profile edit --name centos8-x86_64 --autoinstall centos8.ks
# 设置网卡,设置成传统命名网卡eth,这样网卡的名字就都一样了便于日后统一管理
[root@localhost ~]# cobbler profile edit --name centos8-x86_64 --kernel-options 'net.ifnames=0 biosdevname=0'
[root@localhost ~]# cobbler profile edit --name centos8-x86_64 --kernel-options 'net.ifnames=0 biosdevname=0'
[root@localhost ~]# cobbler profile report
Name                           : centos8-x86_64
Automatic Installation Template : centos8.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : centos8-x86_64
Enable gPXE?                   : False
Enable PXE Menu?               : True
Fetchable Files                : {}
DHCP Filename Override         : <<inherit>>
Kernel Options                 : {'net.ifnames': '0', 'biosdevname': '0'}
Kernel Options (Post Install)  : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Next Server Override           : <<inherit>>
Owners                         : ['admin']
Parent Profile                 :
Proxy                          :
Red Hat Management Key         : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : True
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      :
Virt RAM (MB)                  : 512
Virt Type                      : kvm
[root@localhost ~]# cobbler sync
task started: 2022-08-14_083317_sync
task started (id=Sync, time=Sun Aug 14 08:33:17 2022)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos8-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub.0
removing: /var/lib/tftpboot/grub/grub.ppc64le
removing: /var/lib/tftpboot/grub/grubaa64.efi
removing: /var/lib/tftpboot/grub/grubx64.efi
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/grub.cfg
removing: /var/lib/tftpboot/grub/local_efi.cfg
removing: /var/lib/tftpboot/grub/local_legacy.cfg
removing: /var/lib/tftpboot/grub/local_powerpc-ieee1275.cfg
removing: /var/lib/tftpboot/grub/x86_64_menu_items.cfg
removing: /var/lib/tftpboot/images/centos8-x86_64
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig','/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
copying distros to tftpboot
copying files for distro: centos8-x86_64
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos8-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos8-x86_64
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos8-x86_64/initrd.img
Writing template files for centos8-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
processing boot_files for distro: centos8-x86_64
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/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***
# 重启所有服务
[root@localhost ~]# systemctl restart tftp dhcpd rsyncd httpd cobblerd
[root@localhost ~]# ss -antl
State   Recv-Q  Send-Q   Local Address:Port    Peer Address:Port Process
LISTEN  0       5              0.0.0.0:873          0.0.0.0:*
LISTEN  0       128            0.0.0.0:22           0.0.0.0:*
LISTEN  0       5            127.0.0.1:25151        0.0.0.0:*
LISTEN  0       5                 [::]:873             [::]:*
LISTEN  0       128                  *:80                 *:*
LISTEN  0       128               [::]:22              [::]:*
LISTEN  0       128                  *:443                *:*

 

 

 

 

 

 

 

 

 

 

 

 

# 同步
[root@localhost ~]# cobbler sync
task started: 2022-08-14_085954_sync
task started (id=Sync, time=Sun Aug 14 08:59:54 2022)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos8-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/pxelinux.cfg/01-00-50-56-26-e5-2b
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub.0
removing: /var/lib/tftpboot/grub/grub.ppc64le
removing: /var/lib/tftpboot/grub/grubaa64.efi
removing: /var/lib/tftpboot/grub/grubx64.efi
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/grub.cfg
removing: /var/lib/tftpboot/grub/local_efi.cfg
removing: /var/lib/tftpboot/grub/local_legacy.cfg
removing: /var/lib/tftpboot/grub/local_powerpc-ieee1275.cfg
removing: /var/lib/tftpboot/grub/x86_64_menu_items.cfg
removing: /var/lib/tftpboot/images/centos8-x86_64
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig','/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout:
received on stderr:
copying distros to tftpboot
copying files for distro: centos8-x86_64
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos8-x86_64/initrd.img
copying images
generating PXE configuration files
generating: /var/lib/tftpboot/pxelinux.cfg/01-00-50-56-26-e5-2b
generating: /var/lib/tftpboot/grub/system/00:50:56:26:e5:2b
generating PXE menu structure
copying files for distro: centos8-x86_64
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos8-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/centos8-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos8-x86_64/initrd.img
Writing template files for centos8-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
processing boot_files for distro: centos8-x86_64
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/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***

 

 

 

标签:x86,lib,--,cobbler,var,centos8
来源: https://www.cnblogs.com/sunyiming023654/p/16584697.html