cobbler
部署cobbler
安装
[root@cobbler ~]# yum -y install httpd tftp cobbler xinetd cobbler-web pykickstart
[root@cobbler ~]# yum -y install dhcp*
启动apache和cobbler
[root@cobbler ~]# systemctl enable --now httpd cobblerd
改配置
[root@cobbler ~]# cd /etc/cobbler/
[root@cobbler cobbler]# ls
auth.conf dnsmasq.template logging_config.conf ndjbdns.template secondary.template users.digest
boot_loader_conf genders.template modules.conf reporting settings version
cheetah_macros import_rsync_whitelist mongodb.conf rsync.exclude settings.d zone.template
dhcp.template iso named.template rsync.template users.conf zone_templates
[root@cobbler cobbler]# vim settings
//修改server的ip地址为本机ip
server: 192.168.100.3
//设置tftp的ip地址为本机ip
next_server: 192.168.100.3
开启tftp
[root@cobbler cobbler]# systemctl enable --now tftp
下载缺失文件
[root@cobbler cobbler]# cobbler get-loaders
task started: 2023-12-22_142739_get_loaders
task started (id=Download Bootloader Content, time=Fri Dec 22 14:27:39 2023)
running python triggers from /var/lib/cobbler/triggers/task/get_loaders/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/get_loaders/pre/*
shell triggers finished successfully
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
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/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]#
安装rsync-daemon并开机自启
[root@cobbler cobbler]# yum -y install rsync-daemon
[root@cobbler cobbler]# systemctl enable --now rsyncd
设置密码
//生成加密的密码
[root@cobbler cobbler]# openssl passwd -1 -salt "$RANDOM" 'uos@2023'
$1$15547$Qwn/hF9XCNtw6LXzKOUJ7.
//将新生成的加密密码加入到配置文件
[root@cobbler cobbler]# pwd
/etc/cobbler
[root@cobbler cobbler]# ls
auth.conf dnsmasq.template logging_config.conf ndjbdns.template secondary.template users.digest
boot_loader_conf genders.template modules.conf reporting settings version
cheetah_macros import_rsync_whitelist mongodb.conf rsync.exclude settings.d zone.template
dhcp.template iso named.template rsync.template users.conf zone_templates
[root@cobbler cobbler]# vim settings
default_password_crypted: "$1$15547$Qwn/hF9XCNtw6LXzKOUJ7."
重启cobbler
[root@cobbler cobbler]# systemctl restart cobblerd
[root@cobbler cobbler]# 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:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 5 127.0.0.1:631 0.0.0.0:*
LISTEN 0 5 127.0.0.1:25151 0.0.0.0:*
LISTEN 0 5 [::]:873 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 511 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 5 [::1]:631 [::]:*
LISTEN 0 511 *:443 *:*
[root@cobbler cobbler]#
通过cobbler check 核对当前设置是否有问题
[root@cobbler cobbler]# cobbler check
The following are potential configuration items that you may want to fix:
1: reposync is not installed, install yum-utils or dnf-plugins-core
2: yumdownloader is not installed, install yum-utils or dnf-plugins-core
3: debmirror package is not installed, it will be required to manage debian deployments and repositories
4: 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.
[root@cobbler cobbler]#
解决
[root@cobbler cobbler]# yum -y install yum-utils
修改cobbler配置文件,让cobbler控制dhcp
[root@cobbler ~]# vim /etc/cobbler/settings
manage_dhcp: 1
配置dhcp
[root@cobbler ~]# cd /etc/cobbler/
[root@cobbler cobbler]# vim dhcp.template
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.3;
option domain-name-servers 192.168.100.254;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.100.10 192.168.100.50;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
filename "pxelinux.0";
}
}
同步
[root@cobbler ~]# systemctl restart cobblerd
[root@cobbler ~]# cobbler sync
[root@cobbler ~]# ss -aun| grep 67
UNCONN 0 0 0.0.0.0:67 0.0.0.0:*
[root@cobbler ~]#
uos8
//导入镜像
[root@cobbler ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 26M 1.9G 2% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/uos-root 70G 7.5G 63G 11% /
tmpfs 1.9G 4.0K 1.9G 1% /tmp
/dev/sda1 1014M 284M 731M 28% /boot
/dev/mapper/uos-home 27G 225M 27G 1% /home
tmpfs 375M 4.0K 375M 1% /run/user/987
tmpfs 375M 0 375M 0% /run/user/0
[root@cobbler ~]# mount /dev/cdrom /mnt
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt/
AppStream BaseOS EFI extra_files.json images isolinux kernel419 kernel510 media.repo RPM-GPG-KEY-uos-release TRANS.TBL
[root@cobbler ~]# cobbler import --path=/mnt --name=uos20 --arch=x86_64
查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
uos20-x86_64
profiles:
uos20-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@cobbler ~]#
//创建kickstarts自动安装脚本
text 是文本模式
url 是镜像
rootpw --iscrypted 后面的密码在anaconda-ks.cfg里面
[root@cobbler ~]# cd /var/lib/cobbler/templates/
[root@cobbler templates]# touch uos20.ks
[root@cobbler templates]# cp sample.ks uos20.ks
[root@cobbler templates]# vim uos20.ks
# Sample kickstart file for current EL, Fedora based distributions.
ignoredisk --only-use=sda
autopart --type=lvm
clearpart --all
text
url --url=http://192.168.100.3/cobbler/distro_mirror/uos20-x86_64/
keyboard --vckeymap=cn --xlayouts='cn'
lang zh_CN.UTF-8
network --bootproto=dhcp --device=ens33 --ipv6=auto --activate
network --hostname=localhost.localdomain
rootpw --iscrypted $6$DG6NqvFMqZZw9kon$a5EVHsDlJ1JIYplBtNnAK3za9tIdB8YbxV.z3xWBkLo7Q9JZw2aQUJhaszSKlToqZPvxA0M8ysdkbUltXcPnE/
xconfig --startxonboot
firstboot --disable
services --enabled="chronyd"
timezone --isUtc Asia/Shanghai
reboot
eula --agreed
%packages
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=8 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy user --minlen=8 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
//检查ks文件语法是否有误
[root@cobbler templates]# cobbler validate-autoinstalls
task started: 2023-12-22_154040_validate_autoinstall_files
task started (id=Automated installation files validation, time=Fri Dec 22 15:40:40 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@cobbler templates]#
//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cobbler ~]# cobbler profile edit --name uos20-x86_64 --autoinstall=uos20.ks
//配置网卡名称为传统网卡名称eth0
[root@cobbler ~]# cobbler profile edit --name uos20-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
//检查当前系统cobbler配置文件信息
[root@cobbler ~]# 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
[root@cobbler ~]#
同步cobbler
[root@cobbler ~]# cobbler sync
覆盖错误文件
[root@cobbler ~]# 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
[root@cobbler ~]#
重启服务
[root@cobbler ~]# systemctl restart tftp httpd cobblerd
验证
centos7
镜像导入
[root@cobbler ~]# mount /dev/cdrom /mnt/
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt/
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
[root@cobbler ~]#
[root@cobbler ~]# cobbler import --path=/mnt --name=centos-7 --arch=x86_64
查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
centos-7-x86_64
uos20-x86_64
profiles:
centos-7-x86_64
uos20-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@cobbler ~]#
//创建kickstarts自动安装脚本
[root@cobbler ~]# cd /var/lib/cobbler/
[root@cobbler cobbler]# ls
collections distro_signatures.json grub_config loaders lock scripts snippets templates triggers web.ss webui_sessions
[root@cobbler cobbler]# cd templates/
[root@cobbler templates]# vim centos7.ks
[root@cobbler 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.100.3/cobbler/links/centos-7-x86_64/
$yum_repo_stanza
reboot
rootpw --iscrypted $6$DG6NqvFMqZZw9kon$a5EVHsDlJ1JIYplBtNnAK3za9tIdB8YbxV.z3xWBkLo7Q9JZw2aQUJhaszSKlToqZPvxA0M8ysdkbUltXcPnE/
selinux --disabled
skipx
timezone Asia/Shanghai --isUtc --nontp
install
zerombr
%packages
@^minimal
@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@cobbler templates]#
//检查ks文件语法是否有误
[root@cobbler templates]# cobbler validate-autoinstalls
task started: 2023-12-14_173916_validate_autoinstall_files
task started (id=Automated installation files validation, time=Thu Dec 14 17:39:16 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@cobbler templates]#
查看当前有那些配置文件
[root@cobbler ~]# cobbler profile list
centos-7-x86_64
uos20-x86_64
[root@cobbler ~]#
//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cobbler ~]# cobbler profile edit --name centos-7-x86_64 --autoinstall=centos7.ks
//配置网卡名称为传统网卡名称eth0
[root@cobbler ~]# cobbler profile edit --name centos-7-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
//检查当前系统cobbler配置文件信息
[root@cobbler ~]# cobbler profile report
Name : centos-7-x86_64
Automatic Installation Template : centos7.ks
Automatic Installation Metadata : {}
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : centos-7-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 : {'/var/lib/cobbler/templates/centos7.ks': '~'}
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@cobbler ~]#
同步cobbler
[root@cobbler ~]# cobbler sync
覆盖错误文件
[root@cobbler ~]# 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
[root@cobbler ~]#
重启服务
[root@cobbler ~]# systemctl restart tftp httpd cobblerd
验证
Rockylinux9
导入镜像
//9版本需要升级签名
[root@cobbler ~]# cobbler signature update
task started: 2023-12-14_185742_sigupdate
task started (id=Updating Signatures, time=Thu Dec 14 18:57:42 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@cobbler ~]#
[root@cobbler ~]# mount /dev/cdrom /mnt/
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt/
AppStream BaseOS EFI images isolinux LICENSE media.repo
[root@cobbler ~]# cobbler import --path=/mnt --name=rockylinux9 --arch=x86_64
查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
centos-7-x86_64
rockylinux9-x86_64
uos20-x86_64
profiles:
centos-7-x86_64
rockylinux9-x86_64
uos20-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@cobbler ~]#
//创建kickstarts自动安装脚本
[root@cobbler ~]# cd /var/lib/cobbler/templates/
[root@cobbler templates]# vim rockylinux9.ks
[root@cobbler templates]# cat 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.100.3/cobbler/links/rockylinux9-x86_64/
$yum_repo_stanza
reboot
rootpw --iscrypted $6$DG6NqvFMqZZw9kon$a5EVHsDlJ1JIYplBtNnAK3za9tIdB8YbxV.z3xWBkLo7Q9JZw2aQUJhaszSKlToqZPvxA0M8ysdkbUltXcPnE/
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@cobbler templates]#
//检查ks文件语法是否有误
[root@cobbler templates]# cobbler validate-autoinstalls
task started: 2023-12-14_190419_validate_autoinstall_files
task started (id=Automated installation files validation, time=Thu Dec 14 19:04:19 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@cobbler templates]#
查看当前有那些配置文件
[root@cobbler ~]# cobbler profile list
centos-7-x86_64
rockylinux9-x86_64
uos20-x86_64
[root@cobbler ~]#
//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cobbler templates]# cobbler profile edit --name rockylinux9-x86_64 --autoinstall=rockylinux9.ks
//配置网卡名称为传统网卡名称eth0
[root@cobbler templates]# cobbler profile edit --name rockylinux9-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
//检查当前系统cobbler配置文件信息
[root@cobbler templates]# cobbler profile report
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@cobbler templates]#
修改配置文件
[root@cobbler ~]# cd /usr/lib/python3.6/site-packages/cobbler
[root@cobbler cobbler]# vim tftpgen.py
append_line += " inst.kssendmac"
append_line = "%s inst.ks=%s"(append_line,autoinstall_path)
[root@cobbler cobbler]# cd /var/lib/tftpboot/
[root@cobbler tftpboot]# ls
boot COPYING.yaboot grub grub-x86_64.efi images ldlinux.c32 menu.c32 pxelinux.0 README yaboot
COPYING.syslinux etc grub.cfg grub-x86.efi images2 libutil.c32 ppc pxelinux.cfg s390x
[root@cobbler tftpboot]# cd pxelinux.cfg/
[root@cobbler pxelinux.cfg]# ls
default
[root@cobbler pxelinux.cfg]# vim default
LABEL rockylinux9-x86_64
kernel /images/rockylinux9-x86_64/vmlinuz
MENU LABEL rockylinux9-x86_64
append initrd=/images/rockylinux9-x86_64/initrd.img net.ifnames=0 biosdevname=0 isnt.kssendmac inst.ks=http://192.168.100.3/cblr/svc/op/autoinstall/profile/rockylinux9-x86_64
ipappend 2
验证
centos8
导入镜像
[root@cobbler ~]# mount /dev/cdrom /mnt/
mount: /mnt: WARNING: source write-protected, mounted read-only.
[root@cobbler ~]# ls /mnt
AppStream BaseOS EFI EULA extra_files.json GPL images isolinux LICENSE media.repo
[root@cobbler ~]# cobbler import --path=/mnt --name=centos-8 --arch=x86_64
task started: 2023-12-14_201853_import
task started (id=Media import, time=Thu Dec 14 20:18:53 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/centos-8-x86_64:
creating new distro: centos-8-x86_64
trying symlink: /var/www/cobbler/distro_mirror/centos-8-x86_64 -> /var/www/cobbler/links/centos-8-x86_64
creating new profile: centos-8-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/centos-8-x86_64 for centos-8-x86_64
processing repo at : /var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream
need to process repo/comps: /var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream
looking for /var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos-8-x86_64/AppStream/repodata
processing repo at : /var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS
need to process repo/comps: /var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS
looking for /var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/distro_mirror/centos-8-x86_64/BaseOS/repodata
*** TASK COMPLETE ***
[root@cobbler ~]#
查看cobbler镜像列表
[root@cobbler ~]# cobbler list
distros:
centos-7-x86_64
centos-8-x86_64
rockylinux9-x86_64
uos20-x86_64
profiles:
centos-7-x86_64
centos-8-x86_64
rockylinux9-x86_64
uos20-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@cobbler ~]#
//创建kickstarts自动安装脚本
[root@cobbler templates]# vim centos8.ks
[root@cobbler 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.100.3/cobbler/links/centos-8-x86_64/
$yum_repo_stanza
reboot
rootpw --iscrypted $6$DG6NqvFMqZZw9kon$a5EVHsDlJ1JIYplBtNnAK3za9tIdB8YbxV.z3xWBkLo7Q9JZw2aQUJhaszSKlToqZPvxA0M8ysdkbUltXcPnE/
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@cobbler templates]#
//检查ks文件语法是否有误
[root@cobbler templates]# cobbler validate-autoinstalls
task started: 2023-12-14_202642_validate_autoinstall_files
task started (id=Automated installation files validation, time=Thu Dec 14 20:26:42 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@cobbler templates]#
查看当前有那些配置文件
[root@cobbler templates]# cobbler profile list
centos-7-x86_64
centos-8-x86_64
rockylinux9-x86_64
uos20-x86_64
[root@cobbler templates]#
//修改profile,将我们新建的ks文件设为默认的kickstarts安装文件
[root@cobbler templates]# cobbler profile edit --name centos-8-x86_64 --autoinstall=centos8.ks
//配置网卡名称为传统网卡名称eth0
[root@cobbler templates]# cobbler profile edit --name centos-8-x86_64 --kernel-options='net.ifnames=0 biosdevname=0'
//检查当前系统cobbler配置文件信息
[root@cobbler templates]# cobbler profile report
Name : centos-8-x86_64
Automatic Installation Template : centos8.ks
Automatic Installation Metadata : {}
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : centos-8-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@cobbler templates]#
修改配置
验证
定制安装