官网:Welcome to Cobbler’s documentation! — Cobbler 3.4.0 documentation
安装启动cobbler
yum install -y epel-release
yum install -y cobbler cobbler-web tftp-server dhcp httpd xinetd syslinux fence-agents
systemctl restart httpd cobblerd
systemctl enable httpd cobblerd
配置cobbler
# 检查当前配置是否存在问题
cobbler check
# 允许命令行动态配置
sed -ri '/allow_dynamic_settings:/c\allow_dynamic_settings: 1' /etc/cobbler/settings
语法:cobbler setting edit --name=key --value=value
实例:cobbler setting edit --name=server --value=192.168.2.2
根据check提示修改问题即可,最后check结果如下
[root@cobbler kickstarts]# 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 can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot.
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run 'cobbler sync' to apply changes.
1: 已经安装syslinux,2:debian系统需要 都忽略即可
配置tftp
sed -ri '/disable/c\disable = no' /etc/xinetd.d/tftp
systemctl restart xinetd
systemctl enable xinetd
配置默认密码
openssl passwd -1 -salt `openssl rand -hex 4` '123456'
# 将openssl输出结果填到--value= 后面
cobbler setting edit --name=default_password_crypted --value=
执行同步操作
cobbler sync
配置DHCP
cobbler setting edit --name=manage_dhcp --value=1
# 根据实际网络情况修改即可
vim /etc/cobbler/dhcp.template
subnet 172.30.100.0 netmask 255.255.255.0 {
option routers 172.30.100.254;
option domain-name-servers 172.30.100.254;
option subnet-mask 255.255.255.0;
range dynamic-bootp 172.30.100.10 172.30.100.20;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else if option pxe-system-type = 00:09 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
}
cobbler sync
配置镜像
将镜像上传至服务器
mkdir /mnt/centos7.6
mount -t loop /root/CentOS-7-x86_64-Minimal-1810.iso /mnt/centos7.6
cobbler import --path=/mnt/centos7.6 --name=centos7.6--arch=x86_64
cobbler distro report --name=centos7.6-x86_64 查看导入后镜像信息
cobbler sync
重启服务
systemctl restart httpd cobblerd xinetd rsyncd tftp dhcpd
安装系统
启动进入biso改成network启动,选择镜像安装即可
配置LVM
cd /var/lib/cobbler/kickstarts
cp sample_end.ks centos.ks
# 找到autopart 注释掉。添加以下内容
# /boot 2G /swap 2G 剩下的都给/分区
# --grow 剩下的都分配
part /boot --fstype='xfs' --size=2048
part pv.01 --size=1 --grow
volgroup myvg pv.01 # --ondisk=sdb 指定pv在哪块盘
logvol swap --vgname=myvg --size=2048 --name=swap
logvol / --vgname=myvg --size=1 --grow --name=root