服務(wù)最好安裝在 Centos下,它需要Python支持。
Cobbler服務(wù)是一個(gè)容器,它整合了以下幾個(gè)開源軟件:
1 Dhcp
2 Dns (可選bind,dnsmasq)
3 Kickstart/PXE
4 Apache(提供kickstart 的安裝源,并提供定制化的kickstart配置)
5 Tftp (PXE啟動(dòng)時(shí)需要)
同時(shí),它和apache做了深度整合。通過 cobbler,可以實(shí)現(xiàn)對(duì)RedHat/Centos/Fedora系統(tǒng)的快速部署,同時(shí)也支持Suse 和Debian(Ubuntu)系統(tǒng)。
綜上所述,一個(gè)理想的安裝環(huán)境是:
相關(guān)配置參數(shù):
官方文檔 : https://github.com/cobbler/cobbler/wiki/
二、 安裝
1) 定義 Yum源
可根據(jù)自己所在地選擇離自己近的鏡像源,比如mirrors.163.com或mirrors.sohu.com
相關(guān)配置文件: /etc/yum.repos.d/CentOS-Base.repo
2) 安裝 epel源
Centos5 32位: rpm -Uvh
Centos5 64位: rpm -Uvh
Centos6 32位: rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-7.noarch.rpm'
Centos6 64位: rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm'
確定是否正確安裝 :
yum list|grep -E "^epel"
epel-release.noarch 5-4 installed
也可以用這個(gè)命令: rpm -qa |grep -i epel
3) 安裝cobbler服務(wù)
A) yum -y install cobbler
確認(rèn)是否正確安裝 :
rpm -qa |grep -i cobbler
B) 安裝其它需要的服務(wù)
yum -y install cman tftp-server dhcp cobbler cobbler-web bind pykickstart rsync
根據(jù)需要來,比如 我的測(cè)試環(huán)境不需要bind,就沒有安裝
需要確認(rèn) mod_wsgi已經(jīng)正確安裝,否則需要手動(dòng)安裝
yum -y install mod_wsgi
確認(rèn)apache配置已經(jīng) 加載wsgi_module: /etc/httpd/conf.d/wsgi.conf
4) 安裝debmirror
debmirror 可以用來下載 ubuntu 12.04的鏡像源 來做本地源.
目前debmirrors, 只能使用rpm包安裝, 先裝依賴包
yum -y install ed patch perl perl-Compress-Zlib perl-Cwd perl-Digest-MD5 perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perl
安裝debmirrors :
rpm -Uvh 'http://mirrors.ustc.edu.cn/fedora/epel/5Server/x86_64/debmirror-20090807-1.el5.noarch.rpm'
5) 關(guān)閉selinux 和防火墻
sed -i '/^SELINUX=http://www.3lian.com/ s/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
//為調(diào)試方便,暫時(shí)關(guān)閉防火墻
service iptables stop
6) 啟動(dòng)Cobbler服務(wù)
/etc/init.d/cobblerd start
7) 可能會(huì)缺少的包:
請(qǐng)注意察看 cobbler服務(wù)啟動(dòng)的報(bào)錯(cuò)信息,我第一次安裝時(shí)候就遇到有關(guān) ctypes的報(bào)錯(cuò),只能手動(dòng)安裝:
yum -y install python-ctypes
8) Cobbler相關(guān)配置
根據(jù)需要修改 cobbler主配置文件: /etc/cobbler/settings
//cobbler監(jiān)聽I(yíng)P是 192.168.100.1
sed -i 's/server: 127.0.0.1/server: 192.168.100.1/g' /etc/cobbler/settings
//pxe安裝 只允許一次,防止誤操作 ( 在正式環(huán)境有用。實(shí)際測(cè)試來看,這個(gè)功能可以屏蔽掉 )
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings
//dhcp 服務(wù)的IP地址,PXE過程中 會(huì)用到
sed -i 's/next_server: 127.0.0.1/next_server: 192.168. 100.1 /g' /etc/cobbler/settings
//支持 對(duì)的dhcp管理,在做自定義配置時(shí),需要修改dhcp相關(guān)配置,以配合PXE啟動(dòng)用
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
9) 進(jìn)行cobbler系統(tǒng)檢查
cobbler check
可自動(dòng) 檢查安裝環(huán)境是否滿足cobbler服務(wù)的需要
出現(xiàn)如下結(jié)果提示:
The following are potential configuration items that you may want to fix:
1 : 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.
//解決辦法 : 執(zhí)行 cobbler get-loaders
2 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
//解決辦法 : iptables 保證對(duì) 69 80 443 25151 端口的 數(shù)據(jù)沒有限制,如果僅僅只是在內(nèi)部環(huán)境中使用,建議直接將防火墻關(guān)掉
3 : debmirror package is not installed, it will be required to manage debian deployments and repositories
//解決辦法 : debian 安裝用,暫時(shí)可以不管;如果需要安裝,下載地址為:?query=debmirror