先放出官方網址: https://cobbler.github.io/,官方介紹如下:
Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between many various commands and applications when deploying new systems, and, in some cases, changing existing ones. Cobbler can help with provisioning, managing DNS and DHCP, package updates, power management, configuration management orchestration, and much more.
簡單說就是以前的 kickstart的升級版,可以通過web(https)的方式來方便查看,更改應答文件.支持多系統(centos,ubuntu,suse)
下面介紹如何在centos7.6 環境下安裝Cobbler
1,安裝epel-release 源
yum install epel-release
2.安裝其他依賴包
yum install cobbler-web dhcp tftp-server httpd rsync xinetd pykickstar -y
3.關閉 selinux,關閉防火牆
setenforce 0 #臨時關閉 selinux
systemctl stop firewalld.service #關閉防火牆
4.增加一個web用戶名"admin",密碼設爲"123456".
htdigest /etc/cobbler/users.digest Cobbler admin #Cobbler 首字母"C"需要大寫
5.修改配置文件
# vim /etc/cobbler/settings
server: 192.168.1.9
next_server: 192.168.1.9
manage_dhcp: 1
pxe_just_once: 1
# 設置新裝系統的默認root密碼123456。下面的命令來源於提示。
# openssl passwd -1 -salt 'test' '123456'
$1$forfun$q8gjm/wakmbRmWf4Ci5QU1
# vim /etc/cobbler/settings
default_password_crypted: "$1$forfun$q8gjm/wakmbRmWf4Ci5QU1"
6.下載引導文件
systemctl start cobblerd.service #開啓cobbler服務
systemctl enable cobblerd.service #設爲開機啓動
systemctl start httpd.service #開啓httpd服務
systemctl enable httpd.service #設爲開機啓動
cobbler get-loaders #下載引導文件
7.change 'disable' to 'no' in /etc/xinetd.d/tftp
8.配置dhcp,只顯示需要修改的部分.
vim /etc/cobbler/dhcp.template
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name-servers 192.168.1.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.100 192.168.1.254;
}
9.同步設置
cobbler sync
10.啓動相關服務
systemctl start dhcpd.service
systemctl enable dhcpd.service
systemctl start xinetd.service
systemctl enable xinetd.service
systemctl start rsyncd.service
systemctl enable rsyncd.service
11.掛載鏡像(以Centos7.6舉例)
mount -r Downloads/CentOS-7-x86_64-DVD-1810.iso /mnt/
12.導入鏡像
cobbler import --path=/mnt/ --name=CentOS-7.6-x86_64 --arch=x86_64
# --path 鏡像掛載的路徑
# --name 爲安裝源定義一個名字
# --arch 指定安裝源的架構
cobbler list #查看導入結果
13.查看對應的kickstart文件路徑
cobbler distro report --name=CentOS-7.6-x86_64
14.以上導入鏡像的操作也通過cobbler-web 來完成
在瀏覽器中輸入 https://192.168.1.9/cobbler_web
點擊左側的Import DVD,Perfix(鏡像名詞),Arch(架構),Breed(分支),Path(鏡像掛載路徑),點擊Run後即會執行導入鏡像的操作(需要等待一定時間),可以通過左側的Events查看當前的進度.
還可以點擊左側的Profiles查看存在的配置,以及通過點擊View Kickstart查看對應的kickstart文件
點擊Edit執行編輯操作
15.其他主機選擇從網卡啓動即可看到網絡引導的選項了
有一點需要注意,默認的kickstart文件(sample_end.ks),會清空分區表,然後重新建分區,所以主機上有數據的同學要手動分區纔可以保留以前的數據.對kickstart的語法感興趣的同學自己百度吧.