前面一篇介紹了使用Kickstart批量部署redhat,但是這種方法配置起來比較麻煩,F(xiàn)在,我們有了更好的選擇。那就是:Cobbler。在看以下內(nèi)容時(shí)最好先看下:Kickstart批量部署redhat。
系統(tǒng)環(huán)境:CentOS 5
CentOS5.4默認(rèn)的Repository里找不到Cobbler,先安裝rpmforce這個(gè)Repository。很全很強(qiáng)大,近10000個(gè)軟件包。
Java代碼
#32位:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
#64位:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
#32位:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
#64位:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
1. 安裝相關(guān)軟件:
Java代碼
yum -y install cobbler dhcp httpd xinetd tftp-server
yum -y install cobbler dhcp httpd xinetd tftp-server
# cobbler的配置文件在/var/lib/cobbler/和/etc/cobbler下(不同版本可能不同)
# xinetd tftp-server用來做tftp服務(wù)器,pxe啟動(dòng)需要。
# httpd服務(wù)器主要存放ks文件和安裝光盤。注意 /var/www/cobbler 目錄必須具有足夠容納 Linux 安裝文件的空間(移動(dòng),建軟鏈接)
2. 檢查 cobbler 配置:
Java代碼
cobbler check
cobbler check
#0: The 'server' field in /var/lib/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.
#1: For PXE to be functional, the 'next_server' field in /var/lib/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
# 按提示解決相關(guān)問題,把 /var/lib/cobbler/settings 中的 server 和 next_server 設(shè)為本服務(wù)器的 IP 地址,/etc/xinetd.d/tftp中disable = yes,manage_dhcp 設(shè)為 1,以便管理 DHCP
3. 導(dǎo)入 CentOS 5 安裝 DVD ISO 中的文件:
Java代碼
mount -o loop home/sapling/CentOS-5.4-x86_64-bin-DVD.iso /mnt/redhatISO
cobbler import --mirror=/mnt/redhatISO --name=CentOS-5-4-x86-64
# 從 /mnt/redhatISO 目錄導(dǎo)入所有安裝文件,命名為 CentOS-5-4-x86-64
cobbler list
# 查看導(dǎo)入結(jié)果,應(yīng)包含一個(gè)xen的
mount -o loop home/sapling/CentOS-5.4-x86_64-bin-DVD.iso /mnt/redhatISO
cobbler import --mirror=/mnt/redhatISO --name=CentOS-5-4-x86-64
# 從 /mnt/redhatISO 目錄導(dǎo)入所有安裝文件,命名為 CentOS-5-4-x86-64
cobbler list
# 查看導(dǎo)入結(jié)果,應(yīng)包含一個(gè)xen的
4. 修改 DHCP 和 Kickstart 配置模板:
Java代碼
vi /etc/cobbler/dhcp.template
# DHCP 配置模板,注意你本服務(wù)器的 IP 地址要和dhcp配置的subnet一個(gè)網(wǎng)段,否則會(huì)啟動(dòng)失敗。
vi /etc/cobbler/default.ks
# Kickstart 配置模板,可以用system-config-kickstart(建議)生成,也可以安裝系統(tǒng)后在/root/anaconda-ks.cfg得到你所安裝系統(tǒng)的配置。
vi /etc/cobbler/dhcp.template
# DHCP 配置模板,注意你本服務(wù)器的 IP 地址要和dhcp配置的subnet一個(gè)網(wǎng)段,否則會(huì)啟動(dòng)失敗。
vi /etc/cobbler/default.ks
# Kickstart 配置模板,可以用system-config-kickstart(建議)生成,也可以安裝系統(tǒng)后在/root/anaconda-ks.cfg得到你所安裝系統(tǒng)的配置。
5. 生成并同步所有配置:
Java代碼
cobbler sync
cobbler sync
6. 啟動(dòng)相關(guān)服務(wù):
Java代碼
service xinetd start
service dhcpd start
service cobblerd start
#設(shè)置相關(guān)服務(wù)開機(jī)啟動(dòng)
ntsysv
service xinetd start
service dhcpd start
service cobblerd start
#設(shè)置相關(guān)服務(wù)開機(jī)啟動(dòng)
ntsysv
7. 安裝服務(wù)器:
啟動(dòng)另一臺(tái)新服務(wù)器,通過 PXE 啟動(dòng)進(jìn)入,提示"boot:"時(shí)輸入"menu"即可進(jìn)入藍(lán)色的 Cobbler 安裝界面,選擇安裝項(xiàng),幾分鐘之內(nèi)就能一氣呵成,自動(dòng)完成系統(tǒng)安裝。
8.重裝系統(tǒng):
Java代碼
# 在要重裝的機(jī)器安裝koan
yum install koan
#查看cobbler服務(wù)器有哪些安裝盤
koan --list-profiles --server=192.168.1.2
#選擇要重裝的系統(tǒng)并重啟
koan --replace-self --server=192.168.1.2 --profile=CentOS-5-4-x86-64
reboot
# 在要重裝的機(jī)器安裝koan
yum install koan
#查看cobbler服務(wù)器有哪些安裝盤
koan --list-profiles --server=192.168.1.2
#選擇要重裝的系統(tǒng)并重啟
koan --replace-self --server=192.168.1.2 --profile=CentOS-5-4-x86-64
reboot
億恩科技地址(ADD):鄭州市黃河路129號(hào)天一大廈608室 郵編(ZIP):450008 傳真(FAX):0371-60123888
聯(lián)系:億恩小凡
QQ:89317007
電話:0371-63322206 本文出自:億恩科技【www.allwellnessguide.com】
服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|