本文以 CentOS 6.8 最小化安裝為基礎撰寫,適用於 RedHat 6 與 CentOS 6;Ubuntu 等其他發行版可參照操作。
CentOS-6.8-x86_64-minimal.iso CentOS-6.8-x86_64-bin-DVD1.iso ubuntu-14.04.3-server-amd64.iso epel-release-latest-6.noarch.rpm Python 2.7、VMware 12.1.1
在 Cobbler 問世之前,裝機是個純體力活。Red Hat 推出 Kickstart 之後,只要搞定 PXE、DHCP、TFTP 與那一大串 Kickstart 腳本,就能一次批量安裝上百台伺服器——但門檻不低。Cobbler(補鞋匠)把這套流程整合成一個套件,大幅降低了 Linux 網路安裝的技術門檻。

建議用最小化映像安裝,並將 IP 設為 192.168.136.3,先更新系統:
yum update rpm -Uvh https://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm yum install cobbler cobbler_web dhcp
Cobbler 的新元件需要 Python 2.7,最小化安裝缺少若干相依套件,先補齊:
yum install wget xz gcc nano Django cman pykickstart
若還要部署 Ubuntu,再裝:
yum install ed patch perl perl-Compress-Zlib perl-Cwd perl-Digest-MD5 perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-per rpm -Uvh https://mirrors.ustc.edu.cn/epel/6Server/x86_64/debmirror-2.14-2.el6.noarch.rpm --nodeps
編輯 /etc/debmirror.conf,把 @dists="sid"; 與 @arches="i386"; 兩行註解掉(Ctrl+X,按 Y 儲存)。

cd /root && mkdir python && cd python wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz xz -d Python-2.7.12.tar.xz tar xvf Python-2.7.12.tar cd Python-2.7.12 ./configure --prefix=/usr/local make && make install
裝完後要調整兩個檔案的 shebang,讓 Cobbler 正常運行:把 /usr/bin/yum 的 #!/usr/bin/python 改為 #!/usr/bin/python2.6,把 /usr/bin/cobbler 的 #!/usr/bin/python2 同樣改為 python2.6。
nano /etc/selinux/config → SELINUX=disabled chkconfig iptables off service iptables stop sync; reboot
openssl passwd -1 -salt 'random-phrase-here' '1234567890'
輸出的 $1$random-p$RkqDMTpuNlZZhJ7moLn3Q. 就是加密後的密碼,複製保存,後面要用。

編輯 /etc/cobbler/settings:
next_server: 192.168.136.3 # TFTP 伺服器位址 server: 192.168.136.3 # Cobbler 伺服器位址 manage_dhcp: 1 # 交由 Cobbler 管理 DHCP manage_rsync: 1 # 交由 Cobbler 管理 rsync default_password_crypted: 上面產生的密鑰
接著把 /etc/xinetd.d/tftp 與 /etc/xinetd.d/rsync 中的 disable=yes 改為 disable=no。
編輯 /etc/cobbler/dhcp.template,依自身環境調整(注意保留原有空格):
subnet 192.168.1.0 netmask 255.255.255.0 → 自己的網段 option routers 192.168.1.5; → 網段閘道 option domain-name-servers 192.168.1.1; → 電信商 DNS option subnet-mask 255.255.255.0; → 子網遮罩 range dynamic-bootp 192.168.1.100 192.168.1.254; → 可分配 IP 範圍

並在 /etc/hosts 結尾加上 127.0.0.1 localhost。
service httpd start; service xinetd start; service cobblerd start chkconfig httpd on; chkconfig dhcpd on; chkconfig xinetd on chkconfig tftp on; chkconfig cobblerd on cobbler get-loaders service cobblerd restart cobbler sync service dhcpd start cobbler check
# Ubuntu mkdir -p /mnt/ubuntu14.04 mount -o loop /root/ubuntu-14.04.3-server-amd64.iso /mnt/ubuntu14.04/ cobbler import --path=/mnt/ubuntu14.04/ --name=ubuntu14.04 --arch=x86_64 cobbler sync # CentOS mkdir -p /mnt/CentOS6.8 mount -o loop /root/CentOS-6.8-x86_64-bin-DVD1.iso /mnt/CentOS6.8/ cobbler import --path=/mnt/CentOS6.8/ --name=CentOS6.8 --arch=x86_64 cobbler sync
完成後,用戶端只要以 PXE 開機,就能自動化完成系統安裝。