kickstart安裝教程
pxe概念介紹:
pxe
技術與rpl技術不同之處為rpl是靜态路由,pxe是動态路由。rpl是根據網卡上的id号加上其他記錄組成的一個frame(幀)向伺服器送出請求。
而伺服器中已有這個id資料,比對成功則進行遠端啟動。pxe則是根據伺服器端收到的工件站mac位址,使用dhcp服務為這個mac位址指定個ip地
址。每次啟動可能同一台工作站有與上次啟動有不同的ip,即動态配置設定位址。下以用戶端引導過程說明pxe的原理。
(1)用戶端開機後,pxe bootrom(自啟動晶片)獲得控制權之前執行自我測試,然後以廣播形式發出一個請求find幀。
(2)如果伺服器收到用戶端所送出的要求,就會送回dhcp回應,包括使用者端的ip位址、預設通信通道,以及開機映像檔案;否則伺服器會忽略這個要求。
(3)用戶端收到伺服器發回的響應後則會回應一個幀,以請求傳送啟動所需檔案,并把自己的mac位址寫到伺服器端的netnames.db檔案中。
(4)将有更多的消息在用戶端與伺服器之間應答,用于決定啟動參數。bootrom由tftp通信協定從伺服器下載下傳開機映像文檔。用戶端使用tftp協定接收啟動檔案後,将控制權轉交啟動塊以引導作業系統,完成遠端啟動。
kickstart概念介紹:
kickstart
是一種無人職守安裝方式。kickstart的工作原理是通過記錄典型的安裝過程中所需人工幹預填寫的各種參數,并生成一個名為ks.cfg的檔案;在其
後的安裝過程中(不隻局限于生成kickstart安裝檔案的機器)當出現要求填寫參數的情況時,安裝程式會首先去查找kickstart生成的檔案,當
找到合适的參數時,就采用找到的參數,當沒有找到合适的參數時,才需要安裝者手工幹預。這樣,如果kickstart檔案涵蓋了安裝過程中出現的所有需要
填寫的參數時,安裝者完全可以隻告訴安裝程式從何處取ks.cfg檔案,然後去忙自己的事情。等安裝完畢,安裝程式會根據ks.cfg中設定的重新開機選項來
重新開機系統,并結束安裝。
kickstart流程:
大體流程:dhcp(擷取ip,尋找tftp)>tftp(交換擷取開機啟動檔案 /tftpboot即此檔案夾)>http(加載安裝檔案)>本地安裝
詳細流程圖:

安裝過程:
一、關閉了selinux iptables
vim /etc/sysconfig/selinux
更改成 selinux=disabled
service iptables stop
chkconfig iptables off
二、配置yum源以及用yum安裝
yum install -y httpd ftpd tftp-server xinetd system-config-kickstart syslinux dhcpd
dhcp-comon dhcp-devel
service httpd start
mkdir /var/www/html/centos65
http://192.168.11.125/centos65
挂載linxu iso鏡像
mount /dev/cdrom /mnt
cp -rf /mnt/* /var/www/html/centos65
三、配置tftp加載檔案
tftp-server依賴于xinetd服務
開機啟動修改:
vim /etc/xinetd.d/tftp
disable = no
#disable的直由yes變為no,開啟tftp
service xinetd start
加載ftp檔案,tftp目錄/var/lib/tftpboot下 :
rpm -ql syslinux | grep pxelinux.0
進入CD光牒挂載目錄,p_w_picpaths/pxeboot/initrd.img
p_w_picpaths/pxeboot/vmlinux
isolinux/isolinux.cfg
isolinux/boot.msg
cd /tftpboot/cp /usr/share/syslinux/pxelinux.0 /tftpboot
cp /var/www/html/p_w_picpaths/pxeboot/initrd.img /tftpboot
cp /var/www/html/p_w_picpaths/pxeboot/vmlinux /tftpboot
mkdir pxelinux.cfg tftp-server配置檔案
cp /var/www/html/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
chmod u+w /var/lib/tftpboot/pxelinux.cfg/default
cp /var/www/html/isolinux/boot.msg /var/lib/tftpboot/
chmod u+w /var/lib/tftpboot/boot.msg
四、配置dhcp檔案
vim /etc/dhcpd.conf
# # dhcp server configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
ddns-update-style interim;
ignore client-updates;
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
range 192.168.10.100 192.168.10.200;
next-server 192.168.10.85;
filename "pxelinux.0";
allow booting;
allow bootp;
}
五、配置kicksyack自動安裝配置檔案
圖形界面配置:
#system-config-kickstart
shell配置:參考代碼區進行修改。
六、後續工作重新開機服務以及開機啟動
service httpd restart
service xinetd restart
service dhcpd restart
chkconfig httpd on
chkconfig xinetd on
chkconfig dhcpd on
代碼:
[root@wh-kickstart-100-60 ~]# vim /tftpboot/pxelinux.cfg/default
default linux
prompt 0
timeout 10
display boot.msg
f1 boot.msg
f2 options.msg
f3 general.msg
f4 param.msg
f5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.100.60/ks.cfg
label text
append initrd=initrd.img text
label ks
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
[root@wh-kickstart-100-60 ~]# vim /etc/dhcpd.conf
#
# dhcp server configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
range 192.168.100.100 192.168.100.200;
next-server 192.168.100.60;
[root@wh-kickstart-100-60 ~]# vim /var/www/html/ks.cfg
#platform=x86, amd64, or intel em64t
# system authorization information
auth --useshadow --enablemd5
# system bootloader configuration
bootloader --location=mbr
# partition clearing information
clearpart --none
# use graphical install
graphical
# firewall configuration
firewall --enabled
# run the setup agent on first boot
firstboot --disable
# system keyboard
keyboard us
# system language
lang en_us
# installation logging level
logging --level=info
# use network installation
url --url=http://192.168.100.60/
# network information
network --bootproto=dhcp --device=eth0 --onboot=on
#root password
rootpw --iscrypted $1$vrakvwxt$xevnz205xckgz8pnf43bv1
# selinux configuration
selinux --disabled
# system timezone
timezone asia/shanghai
# install os instead of upgrade
install
# x window system configuration information
xconfig --defaultdesktop=gnome --depth=8 --resolution=640x480
# disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=4096
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024
part /home --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@gnome-desktop
faq:
問1:第一段提示硬碟空間不夠。
答1:更新空間即可。
問2:提示虛拟磁盤空間無法讀取。
答2:需要點選确定就ok,實體硬碟不存在此問題。
dhcp介紹:
ddns-update-style interim:這個是動态擷取ip位址啦。必須放在第一項哇。
ignore client-updates:服務端與用戶端傳輸相關
subnet:擷取ip段,要配置正确。
routers:是路由位址
range:dhcp配置設定ip段。
next-server:是tftp位址。
allow booting bootp:放行傳輸和協定。
tftp介紹:
default:用在于tftp建立傳輸入協定後會去tftpboot裡找檔案,啥都找不着之後就會找default。
tftp-server :這個是用來傳送引導檔案的,
initrd.img/vmlinux: 看用來安裝前的一些工作。但tftp是用來傳輸這些檔案的協定。
網絡結構:
如圖為網絡安裝環境的一個原理示意,安裝環境由一個區域網路和連接配接到該區域網路的啟動伺服器、安裝伺服器和待安裝用戶端,其中啟動伺服器和安裝伺服器可以部署在同一台實體機上。
服務相關作用:
dhcpd: 分發ip位址。
tftpd: 分發啟動檔案安裝。
httpd:分發系統檔案安裝。
參考位址:
http://os.51cto.com/art/201009/223294.htm
http://blog.sina.com.cn/s/blog_94717ebc01010wio.html
轉載位址:http://cwtea.blog.51cto.com/4500217/834991/