實驗一
實驗名稱:kickstart無人值守安裝
實驗過程:
步驟1:基本環境
建立在上一個實驗環境上
步驟2:安裝dns
首先把dns裝了,dns可裝可不裝,實驗要求爲各主機分配IP和主機名,裝上,,
[root@localhost ~]# yum -y install bindbind-chroot caching-nameserver
Installed:
bind.x86_64 30:9.3.6-20.P1.el5_8.5
bind-chroot.x86_64 30:9.3.6-20.P1.el5_8.5
caching-nameserver.x86_64 30:9.3.6-20.P1.el5_8.5
Complete!
修改主配置文件
[root@localhost ~]# cd /var/named/chroot/etc/
[root@localhost etc]# cp -p named.caching-nameserver.conf named.conf
15 listen-on port 53 { 192.168.4.253; };
27 allow-query { any; };
28 allow-query-cache { any; };
29};
37 match-clients { any; };
38 match-destinations { any; };
…
[root@localhost etc]# vimnamed.rfc1912.zones
zone "tarena.com" IN{
type master;
file "tarena.com.zone";
};
zone "4.168.192.in-addr.arpa" IN{
type master;
file "tarena.com.arpa";
};
檢測語法
[root@localhost etc]# named-checkconfnamed.conf
接下來配置數據庫文件
[root@localhost etc]# cd /var/named/chroot/var/named/
[root@localhost named]# cp -p named.localtarena.com.zone
[root@localhost named]# vim tarena.com.zone
$TTL 86400
@ IN SOA tarena. root.tarena. (
2014041901 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns1.tarena.com.
dns1 IN A 192.168.4.253
$GENERATE 1-20 station$ IN A 192.168.4.$
接着配置反向解析配置文件
[root@localhost named]# cp -p tarena.com.zone tarena.com.arpa
$TTL 86400
@ IN SOA tarena. root.tarena. (
2014041901 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400) ; Minimum
IN NS dns1.tarena.com.
253 IN PTR dns1.tarena.com.
$GENERATE 1-20 $ IN PTR station$.tarena.com.
[root@localhost named]# service namedrestart
停止 named: [確定]
啓動 named: [確定]
[root@localhost named]#
Dns配置完成
步驟3:安裝kickstart
[root@localhost ~]# yum -y installsystem-config-kickstart
…
pykickstart.noarch 0:0.43.9-1.el5
Complete!
…
打開kickstart進行配置
[root@localhost ~]# system-config-kickstart
Loaded plugins: product-id
/usr/lib/python2.4/site-packages/pirut/GroupSelector.py:401:GtkWarning: gtk_tree_view_scroll_to_point: assertion `GTK_WIDGET_REALIZED(tree_view)' failed
gobject.idle_add(lambda x: x.scroll_to_point(0, 0), tree)
我們是在圖形環境配置的
見圖
最後兩項可以忽略
完成後
生成文件
這樣客戶機就需要通過一些途徑訪問到這個文件,我們使用的是http服務器
步驟4:安裝http
下面安裝http
[root@localhost ~]# yum -y install httpd
Dependency Installed:
apr.x86_64 0:1.2.7-11.el5_6.5 apr-util.x86_64 0:1.2.7-11.el5_5.2
postgresql-libs.x86_64 0:8.1.23-6.el5_8
Complete!
[root@localhost ~]#
將生成的ks.cfg拷貝到httpd默認目錄下
[root@localhost ~]# cp /root/ks.cfg/var/www/html/
啓動服務
[root@localhost ~]# service httpd restart
停止 httpd: [失敗]
啓動 httpd: [確定]
[root@localhost ~]#
[root@localhost ~]# chkconfig httpd on
步驟5:ks.cfg相關設置
爲ks.cfg文件配置跳過註冊步驟
7zerombr
8key --skip
9 #Partition clearing information
修改啓動菜單,調用應答文件
[root@localhost ~]# vim/tftpboot/pxelinux.cfg/default
10 label linux
11 kernel vmlinuz
12 append ks=http://192.168.4.253/ks.cfg initrd=initrd.img
存退,重啓服務
開啓客戶機,直接上圖
能走到這一步已經成功了,下面就等待安裝好
實驗結果:這次試驗比較綜合,總的來說不難,難的是出錯怎麼解決。
Unable to download the kickstart file
遇到這個錯誤彆着急,要挺住,因爲這不是你的配置問題,有可能是VMrare的問題,也有可能是linux系統版本的問題,還有可能是網段的問題,我被卡在這裏一段時間,換ftp啦,改權限啦,都沒用,百度很多同學遇到這個問題,但是磚家也解釋不清楚,沒有一個準,還得靠自己,最後新開了一臺rh6的裸機終於搞定了,我的服務器沒做任何修改。只是改了一下兩臺虛擬機的網段。
爲了進一步驗證,我又開了一臺rh5的裸機發現沒有出錯,那麼就證明是網段的問題,我將網段改回VMnet1(僅主機模式)它又接着出錯。
另外,這種操作用的時候比較多,做到秒殺是最基本的。