cobbler搭建步驟

@Author  : Spinach | GHB
@Link    : http://blog.csdn.net/bocai8058

OS: centos7
ip: 172.16.247.206
MAC addr: 00:50:56:3E:6F:8B
hostname: hadoop06

以下操作請按從上到下依次順序執行,如出現報錯問題請自行搜索或詢問Spinach。

準備工作(centos7)

黃色背景字體爲開啓服務或重啓服務、查看狀態;黑色字體爲設置操作

操作描述 命令
更新源 yum install epel-release
安裝組件 yum install cobbler cobbler-web tftp-server dhcp httpd xinetd pykickstart fence-agents(確保每個都已安裝)[再執行一遍可查看是否已安裝]
啓動並使能服務 systemctl start httpd cobblerd && systemctl enable httpd cobblerd
查看服務狀態 systemctl status httpd cobblerd
關閉防火牆 systemctl stop firewalld && systemctl disable firewalld &&systemctl status firewalld
關閉SELinux 1. getenforce獲取當前狀態 2. vi /etc/selinux/config ——>設置SELINUX=disabled 3. reboot

配置dhcp

命令 操作
vi /etc/dhcp/dhcpd.conf 添加如下內容至文件結尾
# A slightly different configuration for an internal subnet.
subnet 172.16.247.0 netmask 255.255.255.0 {
  range 172.16.247.245 172.16.247.250;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "172.16.247.206";
  option routers 172.16.247.1;
  option broadcast-address 172.16.247.255;
  default-lease-time 600;
  max-lease-time 7200;
}

#for cobbler setup
host cobbler {
	option host-name "hadoop06"; 
	ddns-hostname "hadoop06"; 
	hardware ethernet 00:50:56:3E:6F:8B; #mac地址
		fixed-address 172.16.247.206; 
		allow booting;
		allow bootp;
		class "PXE" {
				match if substring (option vendor-class-idrntifier,0,9) = "PXEClient";
				next-server 172.16.247.206;
				filename "pxelinux.0";
		}
}

配置cobbler

命令 操作 內容
vi /etc/cobbler/settings 修改 next_server:172.16.247.206 server:172.16.247.206
sed -ri ‘/disable/c\disable=no’ /etc/xinetd.d/tftp 執行命令即可
sed -ri ‘/disable/c\disable=no’ /etc/xinetd.d/rsync 執行命令即可(在執行之前先查看是否有此文件,若沒有,則此命令跳過不執行
systemctl enable xinetd && systemctl restart xinetd && systemctl status xinetd 啓動tftp-server,並查看狀態
systemctl restart httpd cobblerd && systemctl status httpd cobblerd 重啓httpd、cobbler服務,並查看狀態
cobbler check 查看cobbler啓動需求
systemctl start rsyncd && systemctl enable rsyncd && systemctl status rsyncd 啓動rsync,並查看狀態
cobbler check 查看cobbler啓動需求 應該相比上一次執行cobbler check後少一需求
openssl passwd -1 -salt ‘spinach’ ‘spinach’ 創建新密碼,用於cobbler自動化安裝系統後root的默認密碼 執行完後生成,如:11spinach$PPd1y7cKopgHHEHoFRPIW.
vi /etc/cobbler/settings 修改(此處填寫上一命令執行後生成的密碼,保持一致) default_password_crypted:“11spinach$PPd1y7cKopgHHEHoFRPIW.”
vi /etc/cobbler/dhcp.template 修改 如下圖1
cobbler check 查看cobbler啓動需求 應該相比上一次執行cobbler check後少一需求
systemctl restart cobblerd && systemctl status cobblerd 重啓cobbler,並查看狀態
cobbler check 查看cobbler啓動需求 應該相比上一次執行cobbler check後少一需求
vi /etc/cobbler/modules.conf 修改 module = authn_configfile
htdigest /etc/cobbler/users.digest “Cobbler” cobbler 通過htdigest命令將"Cobbler"(用戶組和屬性域)中cobbler (用戶名,可以起個你喜歡的名字,如Spinach)存到/etc/cobbler/users.digest文件中[注鍵入後會讓你設定密碼,設定即可],此時密碼設置爲12345678
systemctl restart cobblerd && systemctl status cobblerd 重啓cobbler,並查看狀態
cobbler sync 服務同步
cobbler check 查看cobbler啓動需求 最後顯示結果如下圖2
圖1 此中配置ip網段問題是根據本人的hostname ip配置 請自行按照所需配置
圖2 最後cobbler check後顯示的只有1個需求 而此需求是debian的鏡像包沒有安裝,如果不安裝 debian,這條忽略
https://172.16.247.206/cobbler_web 登陸cobbler_web 172.16.247.206是本人hostname的ip [注:賬號:上面設置的是cobbler;密碼:自己設定的]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章