如何使用cobbler定制安装

cobbler批量安装

客户端安装

新建虚拟机从pxe启动,若出现以下界面则表示成功:

uos9安装

在这里插入图片描述

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

rockylinux9安装:

切换镜像
[root@cjy ~]# umount /mnt
[root@cjy ~]# mount /dev/cdrom /mnt
升级
[root@cjy ~]# cobbler signature update
task started: 2023-12-25_151906_sigupdate
task started (id=Updating Signatures, time=Mon Dec 25 15:19:06 2023)
running python triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
shell triggers finished successfully
Successfully got file from https://cobbler.github.io/signatures/3.0.x/latest.json
*** TASK COMPLETE ***

[root@cjy ~]# cobbler import --path=/mnt --name=rockylinux9 --arch=x86_64
task started: 2023-12-25_152306_import
task started (id=Media import, time=Mon Dec 25 16:50:06 2023)
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 candidate signature: breed=redhat, version=rhel9
Found a matching signature: breed=redhat, version=rhel9
Adding distros from path /var/www/cobbler/distro_mirror/rockylinux-9-x86_64:
skipping import, as distro name already exists: rockylinux-9-x86_64
No distros imported, bailing out
*** TASK COMPLETE ***
写ks文件
[root@cjy ~]# vim /var/lib/cobbler/templates/rockylinux9.ks 
[root@cjy ~]# cat /var/lib/cobbler/templates/rockylinux9.ks 
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.159.148/cobbler/links/rockylinux9-x86_64/
$yum_repo_stanza
reboot

rootpw --iscrypted "$6$BhgpUy/vf7qCaTU5$nl7uR.wgWxo/nuah8zeYsJRXGEYUUaTg//Njihb3lSKrvFRqZJQ9E1a83vAZ0K/HTROWEV3HB..1qZBMHd/E3."


selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
zerombr

%packages
@core
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
[root@cjy ~]# cobbler validate-autoinstalls
task started: 2023-12-25_153833_validate_autoinstall_files
task started (id=Automated installation files validation, time=Mon Dec 25 16:58:33 2023)
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@cjy ~]# cobbler profile edit --name rockylinux9-x86_64 --autoinstall=rockylinux9.ks
[root@cjy ~]# cobbler profile list 
   rockylinux9-x86_64
   uos20-x86_64
[root@cjy ~]# cobbler profile edit --name rockylinux9-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
[root@cjy ~]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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

Name                           : rockylinux9-x86_64
Automatic Installation Template : rockylinux9.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rockylinux9-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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@cjy ~]# cd /var/lib/tftpboot/
[root@cjy tftpboot]# vim grub/x86_64_menu_items.cfg
..................................................
append initrd=/images/rockylinux9-x86_64/initrd.img net.ifnames=0 biosdevname=0  inst.kssendmac inst.ks=http://192.168.159.148/cblr/svc/op/autoinstall/profile/rockylinux9-x86_64
...................................................
更改kssendmac、ks为inst.kssendmac 、inst.ks
[root@cjy tftpboot]# vim /usr/lib/python3.6/site-packages/cobbler/tftpgen.py
..................................................
 append_line += " inst.kssendmac"
                append_line = "%s inst.ks=%s" % (append_line, autoinstall_path)
...................................................
更改kssendmac、ks为inst.kssendmac 、inst.ks
[root@cjy tftpboot]# vim pxelinux.cfg/default
...................................................
append initrd=/images/rockylinux9-x86_64/initrd.img net.ifnames=0 biosdevname=0  inst.kssendmac inst.ks=http://192.168.159.148/cblr/svc/op/autoinstall/profile/rockylinux9-x86_64
...................................................
更改kssendmac、ks为inst.kssendmac 、inst.ks

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

centos8安装

切换镜像
[root@cjy ~]# umount /mnt
[root@cjy ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
升级
[root@cjy ~]# cobbler signature update
task started: 2023-12-25_182428_sigupdate
task started (id=Updating Signatures, time=Mon Dec 25 18:24:28 2023)
running python triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sigupdate/pre/*
shell triggers finished successfully
Successfully got file from https://cobbler.github.io/signatures/3.0.x/latest.json
*** TASK COMPLETE ***
上传镜像
[root@cjy ~]# cobbler import --path=/mnt --name=centos8 --arch=x86_64
task started: 2023-12-25_182631_import
task started (id=Media import, time=Mon Dec 25 18:26:31 2023)
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@cjy ~]# cobbler profile list
   centos8-x86_64
   rockylinux9-x86_64
   uos20-x86_64
[root@cjy ~]# cd /var/lib/cobbler/templates/
[root@cjy templates]# vim centos8.ks
[root@cjy templates]# cat centos8.ks 
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.159.148/cobbler/links/centos8-x86_64/
$yum_repo_stanza
reboot
rootpw --iscrypted "$6$BhgpUy/vf7qCaTU5$nl7uR.wgWxo/nuah8zeYsJRXGEYUUaTg//Njihb3lSKrvFRqZJQ9E1a83vAZ0K/HTROWEV3HB..1qZBMHd/E3."
selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr
%packages
@core
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
[root@cjy templates]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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

Name                           : rockylinux9-x86_64
Automatic Installation Template : rockylinux9.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rockylinux9-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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

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?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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@cjy templates]# cobbler profile edit --name centos8-x86_64 --autoinstall=centos8.ks
[root@cjy templates]# cobbler profile edit --name centos8-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
[root@cjy templates]# cobbler sync
task started: 2023-12-25_183954_sync
task started (id=Sync, time=Mon Dec 25 18:39:54 2023)
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/uos20-x86_64
removing: /var/www/cobbler/images/rockylinux9-x86_64
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/aarch64_menu_items.cfg
removing: /var/lib/tftpboot/grub/i386_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64le_menu_items.cfg
removing: /var/lib/tftpboot/grub/loongarch64_menu_items.cfg
removing: /var/lib/tftpboot/grub/amd64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64el_menu_items.cfg
removing: /var/lib/tftpboot/grub/ia64_menu_items.cfg
removing: /var/lib/tftpboot/grub/s390_menu_items.cfg
removing: /var/lib/tftpboot/grub/s390x_menu_items.cfg
removing: /var/lib/tftpboot/grub/i586_menu_items.cfg
removing: /var/lib/tftpboot/grub/arm_menu_items.cfg
removing: /var/lib/tftpboot/grub/armhfp_menu_items.cfg
removing: /var/lib/tftpboot/grub/x86_menu_items.cfg
removing: /var/lib/tftpboot/grub/ARM64_menu_items.cfg
removing: /var/lib/tftpboot/grub/x86_64_menu_items.cfg
removing: /var/lib/tftpboot/images/uos20-x86_64
removing: /var/lib/tftpboot/images/rockylinux9-x86_64
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: uos20-x86_64
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/uos20-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/uos20-x86_64/initrd.img
copying files for distro: rockylinux9-x86_64
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/rockylinux9-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/rockylinux9-x86_64/initrd.img
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: uos20-x86_64
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/uos20-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/uos20-x86_64/initrd.img
Writing template files for uos20-x86_64
copying files for distro: rockylinux9-x86_64
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rockylinux9-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/rockylinux9-x86_64/initrd.img
Writing template files for rockylinux9-x86_64
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: uos20-x86_64
processing boot_files for distro: rockylinux9-x86_64
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: 重定向至 /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@cjy templates]# cp /usr/share/syslinux/{pxelinux.0,menu.c32,ldlinux.c32,libutil.c32} /var/lib/tftpboot/

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

centos7安装

切换镜像
[root@cjy templates]# umount /mnt
[root@cjy templates]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
上传镜像
[root@cjy templates]# cobbler import --path=/mnt --name=centos7 --arch=x86_64
task started: 2023-12-25_185636_import
task started (id=Media import, time=Mon Dec 25 18:56:36 2023)
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=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/distro_mirror/centos7-x86_64:
creating new distro: centos7-x86_64
trying symlink: /var/www/cobbler/distro_mirror/centos7-x86_64 -> /var/www/cobbler/links/centos7-x86_64
creating new profile: centos7-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/centos7-x86_64 for centos7-x86_64
processing repo at : /var/www/cobbler/distro_mirror/centos7-x86_64
need to process repo/comps: /var/www/cobbler/distro_mirror/centos7-x86_64
looking for /var/www/cobbler/distro_mirror/centos7-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos7-x86_64/repodata
*** TASK COMPLETE ***
查看镜像
[root@cjy templates]# cobbler profile list
   centos7-x86_64
   centos8-x86_64
   rockylinux9-x86_64
   uos20-x86_64
配置ks文件
[root@cjy templates]# vim centos7.ks
[root@cjy templates]# cat centos7.ks 
auth --enableshadow --passalgo=sha512
bootloader --location=mbr
clearpart --all --initlabel
part /boot --asprimary --fstype="ext4" --size=500
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=15000
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
url --url=http://192.168.159.148/cobbler/links/centos7-x86_64/
$yum_repo_stanza
reboot
rootpw --iscrypted "$6$BhgpUy/vf7qCaTU5$nl7uR.wgWxo/nuah8zeYsJRXGEYUUaTg//Njihb3lSKrvFRqZJQ9E1a83vAZ0K/HTROWEV3HB..1qZBMHd/E3."
selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr
%packages
@core
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
查看配置信息
[root@cjy templates]# cobbler profile report
Name                           : uos20-x86_64
Automatic Installation Template : uos20.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : uos20-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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

Name                           : rockylinux9-x86_64
Automatic Installation Template : rockylinux9.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : rockylinux9-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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

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?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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

Name                           : centos7-x86_64
Automatic Installation Template : sample.ks
Automatic Installation Metadata : {}
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : centos7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
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                 : 1
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
修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cjy templates]# cobbler profile edit --name centos7-x86_64 --autoinstall=centos7.ks
配置网卡名称为传统网卡名称eth0
[root@cjy templates]# cobbler profile edit --name centos7-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
[root@cjy templates]# cobbler sync
task started: 2023-12-25_190303_sync
task started (id=Sync, time=Mon Dec 25 19:03:03 2023)
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/uos20-x86_64
removing: /var/www/cobbler/images/rockylinux9-x86_64
removing: /var/www/cobbler/images/centos8-x86_64
removing: /var/www/cobbler/images/centos7-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/i386_menu_items.cfg
removing: /var/lib/tftpboot/grub/ia64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc_menu_items.cfg
removing: /var/lib/tftpboot/grub/s390_menu_items.cfg
removing: /var/lib/tftpboot/grub/s390x_menu_items.cfg
removing: /var/lib/tftpboot/grub/x86_64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64_menu_items.cfg
removing: /var/lib/tftpboot/grub/aarch64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64le_menu_items.cfg
removing: /var/lib/tftpboot/grub/arm_menu_items.cfg
removing: /var/lib/tftpboot/grub/armhfp_menu_items.cfg
removing: /var/lib/tftpboot/grub/amd64_menu_items.cfg
removing: /var/lib/tftpboot/grub/ppc64el_menu_items.cfg
removing: /var/lib/tftpboot/grub/i586_menu_items.cfg
removing: /var/lib/tftpboot/grub/x86_menu_items.cfg
removing: /var/lib/tftpboot/grub/ARM64_menu_items.cfg
removing: /var/lib/tftpboot/images/uos20-x86_64
removing: /var/lib/tftpboot/images/rockylinux9-x86_64
removing: /var/lib/tftpboot/images/centos8-x86_64
removing: /var/lib/tftpboot/images/centos7-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: uos20-x86_64
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/uos20-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/uos20-x86_64/initrd.img
copying files for distro: rockylinux9-x86_64
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/rockylinux9-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/rockylinux9-x86_64/initrd.img
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 files for distro: centos7-x86_64
trying hardlink /var/www/cobbler/distro_mirror/centos7-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/centos7-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos7-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: uos20-x86_64
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/uos20-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/uos20-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/uos20-x86_64/initrd.img
Writing template files for uos20-x86_64
copying files for distro: rockylinux9-x86_64
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rockylinux9-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/rockylinux9-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/rockylinux9-x86_64/initrd.img
Writing template files for rockylinux9-x86_64
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
copying files for distro: centos7-x86_64
trying hardlink /var/www/cobbler/distro_mirror/centos7-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos7-x86_64/vmlinuz
trying hardlink /var/www/cobbler/distro_mirror/centos7-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos7-x86_64/initrd.img
Writing template files for centos7-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
processing boot_files for distro: uos20-x86_64
processing boot_files for distro: rockylinux9-x86_64
processing boot_files for distro: centos8-x86_64
processing boot_files for distro: centos7-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: 重定向至 /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@cjy templates]# cp /usr/share/syslinux/{pxelinux.0,menu.c32,ldlinux.c32,libutil.c32} /var/lib/tftpboot/
cp:是否覆盖'/var/lib/tftpboot/pxelinux.0'? y
cp:是否覆盖'/var/lib/tftpboot/menu.c32'? y
cp:是否覆盖'/var/lib/tftpboot/ldlinux.c32'? y
cp:是否覆盖'/var/lib/tftpboot/libutil.c32'? y

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

4. 定制安装

定制安装步骤:

  • 统计服务器mac地址
  • 配置cobbler
  • 安装

输入主机IP地址https://192.168.159.148/cobbler_web进入登录界面
在这里插入图片描述

用户名和密码都是cobbler_web

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

在 cobbler 的web界面上配置:

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

同步配置并重启相关服务:

[root@cjy ~]# cobbler sync
[root@cjy ~]# systemctl restart httpd
[root@cjy ~]# systemctl restart cobblerd
[root@cjy ~]# systemctl restart xinetd

最后开机自动会安装系统

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值