cobbler服务端部署,Centos8系统

cobbler简介

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

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

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

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

Cobbler官网

cobbler集成的服务

  • PXE服务支持
  • DHCP服务管理
  • DNS服务管理(可选bind,dnsmasq)
  • 电源管理
  • Kickstart服务支持
  • YUM仓库管理
  • TFTP(PXE启动时需要)
  • Apache(提供kickstart的安装源,并提供定制化的kickstart配置)
    cobbler配置文件详解
    cobbler配置文件目录在/etc/cobbler
配置文件作用
/etc/cobbler/settings.ymlcobbler 主配置文件
/etc/cobbler/iso/iso模板配置文件
/etc/cobbler/user.confweb服务授权配置文件
/etc/cobbler/dhcp.templatedhcp服务器的的配置模板
/etc/cobbler/modules.conf模块的配置文件

cobbler数据目录

目录作用
/var/lib/cobbler/triggers/用于存放用户定义的cobbler命令
/var/lib/cobbler/templates/默认放模板文件的,ks文件
/var/lib/cobbler/loaders/存放各种引导程序以及镜像目录
/var/www/cobbler/distro_mirror/导入的发行版系统的所有数据
/var/www/cobbler/images/导入发行版的kernel和initrd镜像用于远程网络启动
/var/www/cobbler/repo_mirror/yum仓库存储目录

cobbler日志文件

日志文件路径说明
/var/log/cobbler/cobbler.logcobbler日志
cobbler check       //核对当前设置是否有问题
cobbler list        //列出所有的cobbler元素
cobbler report      //列出元素的详细信息
cobbler sync        //同步配置到数据目录,更改配置最好都要执行下
cobbler reposync    //同步yum仓库
cobbler distro      //查看导入的发行版系统信息
cobbler system      //查看添加的系统信息,用这个命令就可以看所有常用命令
cobbler profile     //查看配置信息

cobbler服务端部署

#准备工作
#注意少要给5-10G给镜像用
[root@localhost cobbler]# df -h
Filesystem           Size  Used Avail Use% Mounted on
devtmpfs             1.8G     0  1.8G   0% /dev
tmpfs                1.9G     0  1.9G   0% /dev/shm
tmpfs                1.9G  9.0M  1.9G   1% /run
tmpfs                1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/mapper/cs-root   36G  3.7G   32G  11% /   这个
/dev/sda1           1014M  222M  793M  22% /boot
tmpfs                371M     0  371M   0% /run/user/0

#注意用centos8,本来的源
[root@localhost ~]# dnf -y install epel-release
//下载官方源

[root@localhost ~]# dnf module list | grep cobbler
Failed to set locale, defaulting to C.UTF-8
cobbler              3               default [d]                              Versatile Linux deployment server                                                                                                                                                                                                
cobbler              3.3             default                                  Versatile Linux deployment server 
[root@localhost ~]# dnf module enable cobbler:3 -y
[root@localhost ~]# yum -y install httpd dhcp* tftp tftp-server cobbler cobbler-web pykickstart

//设置开机开机自启
[root@localhost ~]# ss -antl
State    Recv-Q   Send-Q     Local Address:Port      Peer Address:Port   Process   
LISTEN   0        128              0.0.0.0:111            0.0.0.0:*                
LISTEN   0        32         192.168.122.1:53             0.0.0.0:*                
LISTEN   0        128              0.0.0.0:22             0.0.0.0:*                
LISTEN   0        128                 [::]:111               [::]:*                
LISTEN   0        128                 [::]:22                [::]:*                
[root@localhost ~]# systemctl enable --now httpd cobblerd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/cobblerd.service → /usr/lib/systemd/system/cobblerd.service.
[root@localhost ~]# systemctl status cobblerd
● cobblerd.service - Cobbler Helper Daemon
   Loaded: loaded (/usr/lib/systemd/system/cobblerd.service; enabled; vendor prese>
   Active: active (running) since Sat 2022-08-13 04:34:03 EDT; 17s ago
  Process: 61560 ExecStartPost=/usr/bin/touch /usr/share/cobbler/web/cobbler.wsgi >
 Main PID: 61559 (cobblerd)
    Tasks: 1 (limit: 23448)
   Memory: 33.2M
   CGroup: /system.slice/cobblerd.service
           └─61559 /usr/bin/python3.6 -s /usr/bin/cobblerd -F

Aug 13 04:34:03 localhost.localdomain systemd[1]: Starting Cobbler Helper Daemon...
Aug 13 04:34:03 localhost.localdomain systemd[1]: Started Cobbler Helper Daemon.
[root@localhost ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: >
   Active: active (running) since Sat 2022-08-13 04:34:04 EDT; 1min 53s ago
     Docs: man:httpd.service(8)
 Main PID: 61600 (httpd)
   Status: "Running, listening on: port 443, port 80"
    Tasks: 231 (limit: 23448)

[root@localhost ~]# ss -antl
State    Recv-Q   Send-Q     Local Address:Port      Peer Address:Port   Process   
LISTEN   0        128              0.0.0.0:111            0.0.0.0:*                
LISTEN   0        32         192.168.122.1:53             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        128                 [::]:111               [::]:*                
LISTEN   0        128                    *:80                   *:*                
LISTEN   0        128                 [::]:22                [::]:*                
LISTEN   0        128                    *:443                  *:*                
//关闭selinux和防火墙
//重启让主机属于cobblerd状态
[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 ~]# vim /etc/selinux/config 
[root@localhost ~]# reboot

#改配置
//生成加密的密码
[root@localhost ~]# openssl passwd -1 -salt "$RANDOM" '123456'
$1$dFqbQIBk$sKZjBKRr4kdcLXKL/X.3C1
[root@localhost ~]# cd /etc/cobbler
[root@localhost cobbler]# ls
auth.conf         import_rsync_whitelist  ndjbdns.template    settings.yaml
boot_loader_conf  iso                     reporting           users.conf
cheetah_macros    logging_config.conf     rsync.exclude       users.digest
dhcp.template     modules.conf            rsync.template      version
dnsmasq.template  mongodb.conf            secondary.template  zone.template
genders.template  named.template          settings.d          zone_templates
[root@localhost cobbler]# vim settings.yaml 

default_password_crypted: "$1$dFqbQIBk$sKZjBKRr4kdcLXKL/X.3C1"   //替换成刚刚生成的密码

server: 192.168.70.131    //改成当前主机的IP

next_server: 192.168.70.131    //改成当前主机的IP

//打开管理dhcp功能
manage_dhcp: true     //改成这样

//更改模板文件
[root@localhost cobbler]# vim dhcp.template
subnet 192.168.70.0 netmask 255.255.255.0 {
     option routers             192.168.70.2;  //网关
     option domain-name-servers 8.8.8.8;  //网卡设置的DNS
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.70.10 192.168.70.20;   //10个的范围
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                192.168.70.131;  //改成当前主机的IP,前面配置文件设置的IP
     class "pxeclients" {
[root@localhost cobbler]# systemctl restart httpd cobblerd
[root@localhost cobbler]# rpm -qa|grep rsync
rsync-3.1.3-14.el8.x86_64   
[root@localhost cobbler]# dnf -y install rsync-daemon  
[root@localhost cobbler]# systemctl enable --now rsyncd
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service → /usr/lib/systemd/system/rsyncd.service.
[root@localhost cobbler]# systemctl status rsyncd
● rsyncd.service - fast remote file copy program daemon
   Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; enabled; vendor preset:>
   Active: active (running) since Sat 2022-08-13 05:06:49 EDT; 25s ago
 Main PID: 54278 (rsync)
    Tasks: 1 (limit: 23448)
   Memory: 304.0K

#通过cobbler check 核对当前设置是否有问题
#修改安装修改这个文件,关闭selinux,让核对的时候不会报错
[root@localhost cobbler]# dnf -y install yum-utils  syslinux  //安装依赖包
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 can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, and yaboot.   //安装了syslinux包就可以忽略这个警告
2: debmirror package is not installed, it will be required to manage debian deployments and repositories
3: 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.
//以上俩行是关于debian系统的错误,请忽略

[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/
[root@localhost ~]# ls /var/lib/cobbler/loaders
menu.c32  pxelinux.0

//同步
[root@localhost ~]# cobbler sync
task started: 2022-08-13_052518_sync
task started (id=Sync, time=Sat Aug 13 05:25:18 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 ***  //看到这个就成功

#导入镜像,格式必须是"full DVD",或者"Live CD" 的ISO文件
#因为我用的系统文件,就不用传镜像进来,
#连接光盘,然后挂载
[root@localhost ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@localhost ~]# ls /mnt
AppStream  BaseOS  EFI  LICENSE  TRANS.TBL  images  isolinux  media.repo

//导入
[root@localhost ~]# cobbler import --path=/mnt --name=CentOS8 --arch=x86_64
task started: 2022-08-13_055242_import
task started (id=Media import, time=Sat Aug 13 05:52:42 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 ~]# cobbler list
distros:
   CentOS8-x86_64

profiles:
   CentOS8-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:

//查看详细信息
//如果有多个镜像,后面加 --name=名字
[root@localhost ~]# cobbler distro report
Name                           : CentOS8-x86_64
Architecture                   : x86_64
Automatic Installation Template Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS8-x86_64'}
TFTP Boot Files                : {}
Boot loader                    : grub
Breed                          : redhat
Comment                        : 
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/distro_mirror/CentOS8-x86_64/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/distro_mirror/CentOS8-x86_64/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Management Classes             : []
OS Version                     : rhel8  
Owners                         : ['admin']
Redhat Management Key          : 
Remote Boot Initrd             : ~
Remote Boot Kernel             : ~
Template Files                 : {}

//检查dhcp是否正常
[root@localhost ~]# netstat -anulp|grep dhcp
udp        0      0 0.0.0.0:60311           0.0.0.0:*                           4543/dhcpd          
udp        0      0 0.0.0.0:67              0.0.0.0:*                           4543/dhcpd          
udp6       0      0 :::36507                :::*                                4543/dhcpd          

//自动生成kickstarts
[root@localhost ~]# cobbler profile get-autoinstall --name CentOS8-x86_64
//将刷出的类容,放到
[root@localhost ~]# cd /var/lib/cobbler/templates/
[root@localhost templates]# vim centos8.ks //创建一个文件,放到里面更改配置
[root@localhost templates]# cat centos8.ks
auth  --useshadow  --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled    //改成disabled
firstboot --disable
keyboard us
lang en_US
# Use network installation
url --url=http://192.168.70.131/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.70.131/cobbler/distro_mirror/CentOS8-x86_64/AppStream
repo --name=source-2 --baseurl=http://192.168.70.131/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$dFqbQIBk$sKZjBKRr4kdcLXKL/X.3C1
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone  America/New_York --isUtc   //Asia/Shanghai --isUtc --nontp   时区改成,设置成当前系统一样,在anaconda-ks.cfg文件可以看到
# 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
@^virtualization-host-environment   //设置成当前系统一样,在anaconda-ks.cfg文件可以看到
%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.70.131/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.70.131" > /etc/profile.d/cobbler.sh
echo "setenv COBBLER_SERVER 192.168.70.131" > /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.70.131/cblr/svc/op/autoinstall/profile/CentOS8-x86_64" -o /root/cobbler.ks
# End final steps
%end

//eth0   回归重命名
//autopart    自动分区
//packages     安装的包


#检查ks文件语法是否有误
[root@localhost templates]# cobbler validate-autoinstalls
task started: 2022-08-13_063420_validate_autoinstall_files
task started (id=Automated installation files validation, time=Sat Aug 13 06:34:20 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 ***

/查看当前cobbler有哪些配置文件
[root@localhost templates]# cobbler profile list
   CentOS8-x86_64
[root@localhost templates]# cobbler profile report --name CentOS8-x86_64
Name                           : CentOS8-x86_64
Automatic Installation Template : sample.ks   //用的不是我创建的ks文件,改
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : CentOS8-x86_64
Enable gPXE?                   : False

//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@localhost ~]# cobbler profile edit --name CentOS8-x86_64 --autoinstall centos8.ks
[root@localhost ~]# cobbler profile report --name CentOS8-x86_64
Name                           : CentOS8-x86_64
Automatic Installation Template : centos8.ks   
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 

//配置网卡名称为传统网卡名称eth0
[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
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       : []

//同步cobbler
[root@localhost ~]# cobbler sync
task started: 2022-08-13_065132_sync
task started (id=Sync, time=Sat Aug 13 06:51:32 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/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 httpd cobblerd rsyncd dhcpd
[root@localhost ~]# systemctl restart httpd cobblerd rsyncd dhcpd
[root@localhost ~]# systemctl status tftp
● tftp.service - Tftp Server
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: >
   Active: inactive (dead)
     Docs: man:in.tftpd
[root@localhost ~]# systemctl enable --now tftp
Created symlink /etc/systemd/system/sockets.target.wants/tftp.socket → /usr/lib/systemd/system/tftp.socket.
[root@localhost ~]# systemctl status tftp
● tftp.service - Tftp Server
   Loaded: loaded (/usr/lib/systemd/system/tftp.service; indirect; vendor preset: >
   Active: active (running) since Sat 2022-08-13 07:00:35 EDT; 1s ago
     Docs: man:in.tftpd
 Main PID: 221989 (in.tftpd)
    Tasks: 1 (limit: 23448)
   Memory: 240.0K
   CGroup: /system.slice/tftp.service
           └─221989 /usr/sbin/in.tftpd -s /var/lib/tftpboot
[root@localhost ~]# ls /var/lib/cobbler/loaders/
menu.c32  pxelinux.0  //缺一个引导程序,和一个grp菜单
[root@localhost ~]# ls /usr/share/cobbler/bin/
migrate-data-v2-to-v3.py  mkgrub.sh
migrate-settings.sh       settings-migration-v1-to-v2.sh
[root@localhost ~]# /usr/share/cobbler/bin/mkgrub.sh 
+ grub2-mkimage -O arm64-efi -o /var/lib/cobbler/loaders/grub/grubaa64.efi --prefix= all_video boot cat configfile echo true font gfxmenu gfxterm gzio halt iso9660 jpeg minicmd normal part_apple part_msdos part_gpt password_pbkdf2 png reboot search search_fs_uuid search_fs_file search_label sleep test video fat loadenv linux btrfs ext2 xfs jfs reiserfs tftp http luks gcry_rijndael gcry_sha1 gcry_sha256 mdraid09 mdraid1x lvm serial regexp tr efinet
grub2-mkimage: error: cannot open  `/usr/lib/grub/arm64-efi/moddep.lst': No such file or directory.   ///这个报错不用管他
+ set +x
[root@localhost ~]# ls /var/lib/cobbler/loaders/
grub  ldlinux.c32  menu.c32  pxelinux.0   //多了俩个文件就可以了
//做了操作同步一下
[root@localhost ~]# cobbler sync
task started: 2022-08-13_070827_sync
task started (id=Sync, time=Sat Aug 13 07:08:27 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/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 ***


创建个虚拟机测试

出现这个界面
挪到下一个,回车俩下
在这里插入图片描述
在这里插入图片描述
成功

定制安装

定制安装步骤:

  • 统计服务器mac地址
  • 配置cobbler
  • 安装
    统计mac地址此处就不赘述了,直接最重要的配置
    在 cobbler 的web界面上配置:

访问填:https://192.168.70.131/cobbler_web
账号和密码都是cobbler
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

创建虚拟机个虚拟机,把他的IP地址,和cobbler做个绑定

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
然后开启那台虚拟机,就不需要自己手动的点配置
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值