1.KickStart
KickStart是一種無人職守安裝方式。KickStart的工作原理是通過記錄典型的安裝過程中所需人工干預填寫的各種參數,并生成一個名為ks.cfg的文件;在其后的安裝過程中(不只局限于生成KickStart安裝文件的機器)當出現要求填寫參數的情況時,安裝程序會首先去查找KickStart生成的文件,當找到合適的參數時,就采用找到的參數,當沒有找到合適的參數時,才需要安裝者手工干預。這樣,如果KickStart文件涵蓋了安裝過程中出現的所有需要填寫的參數時,安裝者完全可以只告訴安裝程序從何處取ks.cfg文件,然后去忙自己的事情。等安裝完畢,安裝程序會根據ks.cfg中設置的重啟選項來重啟系統,并結束安裝。
PXE + KickStart安裝的條件
2.實驗環境
組件:
dhcp:動態分配Ip地址
httpd:基于web訪問centos鏡像文件
tftp:存放linux pxe引導文件
syslinux:syslinux是一個功能強大的引導加載程序
服務器:
主機centos6.5 IP:192.168.180.130
安裝:dhcp httpd tftp syslinux服務
3.操作步驟
一.安裝相關組件
[root@localhost ~]#yum -y install dhcp* httpd* tftp* syslinux*
掛載CentOS6.5的DVD光盤,并復制第一張光盤下的所有內容(文件和文件夾)到/var/www/html/centos(centos目錄需要自己創建)下(apache默認網站根目錄)
[root@localhost ~]#mount /dev/cdrom /mnt/ [root@localhost ~]#cp -rf /mnt/* /var/www/html/centos
二、配置apache
[root@localhost ~]#service httpd start
三、配置tftp
[root@localhost ~]#vim /etc/xinetd.d/tftp 修改14行disable = no
[root@localhost ~]#/etc/init.d/xinetd start
四、配置dhcp
[root@localhost ~]#vim /etc/dhcp/dhcpd.conf ddns-update-style interim; default-lease-time 216000; filename "/pxelinux.0"; max-lease-time 43200; next-server 192.168.180.130; subnet 192.168.180.0 netmask 255.255.255.0 { option subnet-mask 255.255.255.0; option routers 192.168.180.2; range dynamic-bootp 192.168.180.2 192.168.180.200; default-lease-time 21600; }
五、配置支持PXE啟動
我已經把第一張光盤的內容復制到/var/www/html目錄中了,所以所需要的文件我只需要從/var/www/html目錄中復制就行了
1、進入tftpboot文件夾,沒有就建一個,有了就不用建了。 [root@localhost ~]#cd /var/lib/tftpboot/
2、把pxelinux.0復制到/tftpboot/中 [root@localhost ~]#cd /usr/share/syslinux [root@localhost ~]#cp pxelinux.0 /var/lib/tftpboot [root@localhost ~]#cp vesamenu.c32 /var/lib/tftpboot
3、把Linux第一張安裝光盤上/images/pxeboot/initrd.img和vmlinux復制到/tftpboot/中 [root@localhost ~]#cp /var/www/html/images/pxeboot/initrd.img /var/lib/tftpboot [root@localhost ~]#cp /var/www/html/images/pxeboot/vmlinux /var/lib/tftpboot
4、 復制第一張安裝光盤上的isolinux/*.msg到/tftpboot/中 [root@localhost ~]#cp /var/www/html/isolinux/*.msg /var/lib/tftpboot
5、 在tftpboot中新建一個pxelinux.cfg目錄 [root@localhost ~]#mkdir pxelinux.cfg
6、 把Linux第一張安裝光盤上isolinux目錄中的isolinux.cfg復制到pxelinux.cfg目錄中,并同時更改文件名稱為default [root@localhost ~]# cd pxelinux.cfg [root@localhost ~]# cp /var/www/html/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default [root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default 把22行注釋掉,在下面添加: append initrd=initrd.img ks=http://192.168.180.130/ks.cfg
六、修改/var/www/html/ks.cfg文件,指定讀取ks.cfg的方法
#platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use CDROM installation media url --url=http://192.168.180.130/centos/ # Root password rootpw --iscrypted $1$mR96CBFs$tpDEL7evE3eL2UjJ5PjG2. # System authorization information auth --useshadow --passalgo=sha512 # Use graphical install graphical firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone Asia/Shanghai # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System bootloader configuration bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sdb" # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="ext4" --size=200 part swap --size=4096 part / --fstype="ext4" --size=40960 %pre echo "start install" %end %post echo "install end" %end #程序包段 %packages @chinese-support @development @X Window System @remote-desktop-clients %end
七、設置服務開機自啟動:
[root@localhost ~]# chkconfig httpd on [root@localhost ~]# chkconfig xinetd on [root@localhost ~]# chkconfig dhcpd on
八.設置bios為網卡啟動,啟動后,就會進入到安裝界面,并自行安裝。
原創文章,作者:a295053193,如若轉載,請注明出處:http://www.www58058.com/53336