Cobbler 是一個開源的 Linux 安裝和配置工具,用于自動化部署和管理大量的 Linux 操作系統實例。以下是在 CentOS 上使用 Cobbler 實現自動化安裝的基本步驟:
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/SELINUXenforcing/SELINUXdisabled/g' /etc/selinux/config
setenforce 0
yum install epel-release -y
reboot
yum install cobbler cobbler-web httpd tftp-server dhcp xinetd pykickstart -y
systemctl enable cobblerd
systemctl start cobblerd
systemctl enable httpd
systemctl start httpd
/etc/cobbler/settings 文件:設置 server 和 next_server 為本機 IP 地址。/etc/cobbler/dhcp.template 文件,設置 subnet 和 option routers 為本機 IP 地址。/etc/xinetd.d/tftp 文件,設置 server_args 參數。cobbler sync
cat > /var/lib/cobbler/kickstarts/centos7.ks << EOL
install url --url "http://192.168.52.202/cobbler/ks_mirror/centos7"
rootpw --iscrypted your_encrypted_password
bootloader --location mbr
clearpart --all --initlabel
part / --fstype ext4 --asprimary --size 1024
part swap --asprimary --size 2048
volgroup centos --pesize 4096 pv.008006 --grow --size 200
logvol /opt --fstype ext4 --name lv_opt --vgname centos --grow --size 200
%packages
@base@core
%end
EOL
cobbler system add 命令創建新的系統配置。cobbler system add --name centos7 --profile centos7 --netboot-enabled true
通過上述步驟,您可以在 CentOS 系統中使用 Cobbler 實現自動化的系統部署。根據您的實際環境和需求調整上述步驟。