環境準備 準備兩台主機,如centos6和centos7 centos7當作server伺服器 關閉selinux 關閉防火牆 安裝 cobbler包光碟里是沒有的,要配置epel源,這裡就說怎麼配置epel源了,在yum.repos.d/目錄下照葫蘆畫瓢就可,配置好後執行如下命令安裝 安裝成功後, ...
環境準備
- 準備兩台主機,如centos6和centos7
- centos7當作server伺服器
- 關閉selinux
- 關閉防火牆
安裝
cobbler包光碟里是沒有的,要配置epel源,這裡就說怎麼配置epel源了,在yum.repos.d/目錄下照葫蘆畫瓢就可,配置好後執行如下命令安裝
yum install –y cobbler # #
安裝成功後,我們發現它還安裝了其他的服務
備註:我們搭建cobbler-系統部署需要用到httpd、tftp-server、dhcp服務,從圖上可以看出它沒有安裝dhcp服務,所以我們要安裝下dhcp服務
yum install –y dhcp # #
開啟服務
http服務
systemctl start httpd #開啟服務 systemctl enable httpd #設置開機自啟動
tftp-server服務
systemctl start tftp #開啟服務 systemctl enable tftp #開機自啟動
cobbler服務
systemctl start cobblerd #開啟服務 systemctl enable cobblerd #開機自啟動
cobbler環境檢查
執行
cobbler check #
會出現如下提示,配置缺少的東西
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : change 'disable' to 'no' in /etc/xinetd.d/tftp 4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, 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. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 5 : enable and start rsyncd.service with systemctl 6 : debmirror package is not installed, it will be required to manage debian deployments and repositories 7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
OK 根據提示一步一步來解決
步驟一
1、第一個提示:在/etc/cobbler/settings 文件中server欄位必須要有一個別人可訪問的IP地址,來提供網路服務,那麼我們是在centos7上搭建的所以是本機地址。
①編輯配置文件
vim etc/cobbler/settings #編輯配置文件
②刷新配置文件並環境檢查
systemctl restart cobblerd #重啟服務,重新讀取修改的配置文件 cobbler check #環境檢查
步驟二
#環境檢查後發現少了一項,那麼下麵接著還是從第一項開始操作 1 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 2 : change 'disable' to 'no' in /etc/xinetd.d/tftp 3 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, 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. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 4 : enable and start rsyncd.service with systemctl 5 : debmirror package is not installed, it will be required to manage debian deployments and repositories 6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
如上第一條:'next_server' 地址不應該是127.0.0.1
所以修改它的地址,這個地址也就是你tftp伺服器所在的主機地址,我們把服務都安裝在一臺主機上了,所以和上面地址一樣
①編輯配置文件
vim etc/cobbler/settings #編輯配置文件
②重覆步驟一中的②命令來重讀配置文件與環境檢查
步驟三
#環境檢查後發現又少了一條,下麵接這來... 1 : change 'disable' to 'no' in /etc/xinetd.d/tftp 2 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, 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. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 3 : enable and start rsyncd.service with systemctl 4 : debmirror package is not installed, it will be required to manage debian deployments and repositories 5 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 6 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
如上第一條:提示更改/etc/xinetd.d/tftp配置文件中'disable'狀態改為‘no’說白了也就是開啟tftp服務
因為我們用的是centos7不需要xinetd.d了,前面已經開啟了tftp服務,這步忽略,看下一個提示
第二條:在/var/lib/cobbler/loaders目錄下少了一些必要的文件,用'cobbler get-loaders' 命令來獲取,這時候需要主機聯網下載
我們先來看看這個目錄
①生成必要文件
cobbler get-loaders # #
我們知道出現的這些文件是要放在/var/lib/tftpboot/這裡的,我們看下這個目錄的信息
用如上環境檢查中給出的提示進行同步
cobbler sync #數據同步
再次查看下/var/lib/tftpboot目錄結構
②重覆步驟一中的②命令
#又少了,繼續 1 : enable and start rsyncd.service with systemctl 2 : debmirror package is not installed, it will be required to manage debian deployments and repositories 3 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one 4 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
步驟四
第一條:開啟rsyncd.service 服務,我們沒有用這個服務,忽略
第二條:是針對debian發行版的系統配置,忽略
第三條:修改kickstart文件的預設口令
①編輯配置文件
vim /etc/cobbler/settings #
②重覆步驟一中的②命令
#少了一條 1 : enable and start rsyncd.service with systemctl 2 : debmirror package is not installed, it will be required to manage debian deployments and repositories 3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
如上第一、二上面說了忽略,看第三條,意思說配置電源項,和硬體有關,忽略
步驟五
配置dhcp
①編輯配置文件
vim /etc/cobbler/settings #
② 改cobbler提供的dhcp配置文件模板
vim /etc/cobbler/dhcp.template #
我們先來看下dhcp配置文件
還是空的沒有配置信息
②同步
systemctl restart cobblerd #重啟服務 cobbler sync #數據同步
再來看dhcp配置文件
有信息了
步驟六
①開啟dhcp服務
systemctl start dhcpd #開啟服務
②建立cobbler yum源-導入系統
這裡我們也把centos6導入
備註:它是放在了/var/www/目錄下,同時生成了一個和系統同名的kickstart文件,
自帶的kickstart文件是滿足不了我們的需求的,所以我們使用自己的kickstart文件,之前生成過,直接拿來用。
步驟七
①編輯ks.cfg文件(前幾篇提到過怎麼創建改文件)
②把ks.cfg文件放在/var/lib/cobbler/kickstarts/下
③創建啟動菜單
cobbler profile add --name=Centos-7.5-x86_64-Auto --distro=Centos-7.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg # cobbler profile add --name=Centos-6.9-x86_64-Auto --distro=Centos-6.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks6.cfg #
④查看啟動文件default是不是有了我們創建的自定義啟動項
cat /var/lib/tftpboot/pxelinux.cfg/default #查看啟動菜單
備註:也可刪除不需要的啟動菜單
cobbler profile remove --name=Centos-6.9-x86_64 #
OK現在就可以用準備好的另一臺主機測試了
備註:確保 http tftp dhcp 服務已開啟 防火牆以關閉 selinux以關閉
成功界面
cobbler-web管理
1、首先安裝包
yum install -y cobbler-web #
2、訪問
https://192.168.43.7/cobbler_web
預設賬號:cobbler
預設密碼:cobbler
附帶過程中出現的問題
問題一:出現如下提示:
解決方案:http:改為https:訪問
問題二:安裝新系統的時候,出現TFTP open timeout!
解決方案:關閉防火牆
#systemctl stop firewalld.service
#iptables –L
問題三:check環境檢查的時在cobbler 候出現如下
解決方案:這是ip分配錯誤的提示,檢查配置文件IP分配段
每個人遇到的問題可能不一樣,查看日誌檢查,tailf -10 /var/log/messages