2017-3-10 Cobbler實現無人值守安裝


   

   之前實習期間用過kickstart安裝操作系統,一直不成功,現在回到學校了,無意看到cobbler安裝,有些沖動。別看沒多少內容,可用了兩天時間,終於完成了!

   以后肯定要的着,先記錄下。

 


官方文檔:http://cobbler.github.io/
web界面文檔:http://cobbler.github.io/manuals/2.6.0/5_-_Web_Interface.html
國內文檔:http://www.tuicool.com/articles/NFfi6fv
用戶使用手冊:http://cobbler.github.io/manuals/2.8.0/

 

1、基本環境搭建
[root@cobbler ~]# ifconfig eth0 192.168.1.22
[root@cobbler ~]# yum install epel-release -y
[root@cobbler ~]# yum install cobbler cobbler-web -y
[root@cobbler ~]# openssl passwd -1 -salt cobbler
Password:
$1$cobbler$M6SE55xZodWc9.vAKLJs6. ## 安裝完系統root密碼
[root@cobbler ~]# vim /etc/cobbler/settings
pxe_just_once: 1
next_server: 192.168.1.22
server: 192.168.1.22
manage_dhcp: 1
manage_rsync: 1
default_password_crypted: "$1$cobbler$M6SE55xZodWc9.vAKLJs6."

[root@cobbler ~]# vim /etc/cobbler/dhcp.template ##DHCP服務默認配置好了的
option routers 192.168.1.1

[root@cobbler ks_mirror]# pwd
/var/www/cobbler/ks_mirror
[root@cobbler ks_mirror]# mount -t iso9660 /dev/cdrom /mnt ##去VMware里添加鏡像即可。
mount: /dev/sr0 is write-protected, mounting read-only


2、cobber的web界面設置
[root@cobbler ks_mirror]# yum install dhcp -y
[root@cobbler ~]# vim /etc/cobbler/modules.conf
module = authn_configfile
[authorization]
module = authz_allowall
[root@cobbler ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobbler
Changing password for user cobbler in realm Cobbler
New password:
Re-type new password:

3、http服務、tftp服務
[root@cobbler ks_mirror]# vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1
[root@cobbler ks_mirror]# systemctl start httpd.service
[root@cobbler ~]# yum install xinetd -y
[root@cobbler ks_mirror]# vim /etc/xinetd.d/tftp
disable = no
[root@cobbler ~]# yum install xinetd
[root@cobbler ks_mirror]# systemctl start rsyncd.service
[root@cobbler ~]# systemctl start cobblerd.service

4、cobbler檢查,這幾步必須做的
[root@cobbler ~]# yum install debmirror fence-agents pykickstart ##依賴包安裝
[root@cobbler ~]# cobbler check ##非常重要的命令
[root@cobbler ~]# cobber sync
[root@cobbler ks_mirror]# cobbler import --name=fedora17 --arch=x86_64 --path=/mnt ##等15分鍾左右

# cobbler distro list
修改profile指定新的KS啟動文件在第一次導入系統鏡像時,cobbler會給安裝鏡像指定一個默認的kickstart自動安裝文件,
文件位於/var/lib/cobbler/kickstarts/sample.ks

# cobbler profile list ##查看profile列表
# cobbler distro report --name=fedora17-x86_64
$ cobbler system add --name=test --profile=fedora17-x86_64
$ cobbler system list

5、登錄到web界面,沒啥用處,可以不看
https://192.168.1.22//cobbler_web 用戶名和密碼都是cobbler
# yum install system-config-kickstart
# yum groupinstall "X Window System" ##安裝X Window圖形界面
# system-config-kickstart ##運行工具進行配置

報錯:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
(1)訪問web界面居然沒有內容?
[root@cobbler conf.d]# curl -I http://192.168.1.22/cobbler_web
HTTP/1.1 403 Forbidden
Date: Thu, 09 Mar 2017 15:43:37 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_wsgi/3.4 Python/2.7.5
Content-Type: text/html; charset=iso-8859-1
/usr/share/cobbler/web/cobbler.wsgi failed, reason: SSL connection required
解決:https://192.168.1.22//cobbler_web ##https呀!

(2)始終報出rsyncd的問題,結果是沒開啟自啟而已,郁悶
[root@cobbler tftpboot]# cobbler check
The following are potential configuration items that you may want to fix:
1 : enable and start rsyncd.service with systemctl
解決:[root@cobbler tftpboot]# systemctl enable rsyncd

(3)客戶端引導的時候請求DHCP服務的時候找不到引導文件pxelinux.0?
解決:哎呀,忘了把客戶端的NAT模式改為橋接了!

(4)客戶機引導一大半了,告訴我/dev/root不存在?
解決:這個是內存給的太小了!這個問題真不好排查,是我換了另一個虛擬機安裝的

(5)客戶機引導時出現選擇頁面,local 還是fedora17-x86_64?干擾自動部署
解決:# vim /var/lib/tftpboot/pxelinux.cfg/default
去掉Label標簽即可,另外把TIMEOUT改為0


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM