Kickstart無人職守安裝RHEL5

 測試環境:Redhat 5.4 關閉iptables 和Selinux 

所需服務:Dhcp Vsftp Tftp Xinted

2.開始安裝:

(1)安裝所需服務

  1. DHCP:  
  2. [root@station5 ~]# yum -y install dhcp.i*  
  3. [root@station5 ~]# chkconfig dhcpd on 
  4.  
  5. TFTP:  
  6. [root@station5 ~]# yum -y install tftp.i* 
  7.  
  8. VSFTPD:  
  9. [root@station5 ~]# yum -y install vsftpd 
  10.  
  11. kickstart:  
  12. [root@station5 ~]# yum -y install system-config-kickstart 

(2)安裝配置DHCP服務

修改以下內容:

(3)將TFTP服務狀態設置爲可運行 
 

  1. [root@station5 ~]# vim /etc/xinetd.d/tftp  
  2. 14         disable                 = no        #修改第14行把原來的yes修改成no 
  3.  
  4. [root@station5 ~]# /etc/init.d/xinetd restart      

(4)複製Linux啓動、內核文件及啓動鏡像文件:

  1. [root@station5 ~]# mount /dev/hdc /mnt    #掛載光盤到/mnt目錄下  
  2. [root@station5 ~]# cp /mnt/isolinux/initrd.img /tftpboot/  
  3. [root@station5 ~]# cp /mnt/isolinux/vmlinuz /tftpboot/  
  4. [root@station5 ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/ 

(5)將RHEL光盤所有內容複製到/var/ftp/pub目錄下

  1. [root@station5 ~]# cp -r * /var/ftp/pub/ 

(6)kickstart配置文件的生成: 
通過system-config-kickstart 生成無人值守文件,再將生成的ks.cfg無人值守文件保存到/var/ftp下。

基本配置: 

安裝方法(這是是通過FTP安裝的) 
image

分區信息:這裏我選的是:清除主引導記錄和清除現有分區 
接下來是新建分區信息,可根據實際情況配置: 
image

網絡配置:選擇 Add Network Device ---OK  使用DHCP網絡類型:

image

其他的按照自己的裝機需求設置

接下來單擊菜單:File--Save File 將ks.cfg保存到/var/ftp目錄下面 
 image

配置新生成的ks.cfg文件,配置安裝的軟件包 
可以從當前系統安裝時自動生成的安裝信息/root/anaconda-ks.cfg將軟件包信息 複製到ks.cfg文件裏 
[root@station5 ~]# cat anaconda-ks.cfg 
%packages 
@admin-tools 
@base 
@chinese-support 
@core 
@dialup 
@editors 
@gnome-desktop 
。。。。以下省略。。。

%pachages 後的部分記錄系統安裝時的軟件包的安裝情況,複製下來全部複製到ks.cfg文件後面

  1. [root@station5 ftp]# vim ks.cfg  
  2. #platform=x86, AMD64, or Intel EM64T  
  3. # System authorization information  
  4. auth  --useshadow  --enablemd5  
  5. # System bootloader configuration  
  6. bootloader --location=mbr  
  7. # Clear the Master Boot Record  
  8. zerombr  
  9. # Partition clearing information  
  10. clearpart --all --initlabel  
  11. # Use graphical install  
  12. graphical  
  13. # Firewall configuration  
  14. firewall --enabled    
  15. # Run the Setup Agent on first boot  
  16. firstboot --disable  
  17. key --skip                    #順便增加這個,跳過序列號  
  18. # System keyboard  
  19. keyboard us  
  20. # System language  
  21. lang en_US  
  22. # Installation logging level  
  23. logging --level=info  
  24. # Use network installation  
  25. url --url=ftp://192.168.0.5/pub  
  26. # Network information  
  27. network --bootproto=dhcp --device=eth0 --onboot=on  
  28. # Reboot after installation  
  29. reboot  
  30. #Root password  
  31. rootpw --iscrypted $1$73hBcd2n$DoNPPPAFrOKrj10Cr.eRX0 
  32.  
  33. # SELinux configuration  
  34. selinux --enforcing  
  35. # System timezone  
  36. timezone  Asia/Shanghai  
  37. # Install OS instead of upgrade  
  38. install  
  39. # X Window System configuration information  
  40. xconfig  --defaultdesktop=GNOME --depth=32 --resolution=800x600 --startxonboot  
  41. # Disk partitioning information  
  42. part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100  
  43. part / --bytes-per-inode=4096 --fstype="ext3" --size=4096  
  44. part /home --bytes-per-inode=4096 --fstype="ext3" --size=2000  
  45. part swap --bytes-per-inode=4096 --fstype="swap" --size=512  
  46. part /usr --bytes-per-inode=4096 --fstype="ext3" --size=3000 
  47.  
  48. %packages  
  49. @dialup  
  50. @base  
  51. @gnome-desktop  
  52. @core  
  53. @admin-tools  
  54. @chinese-support  
  55. @printing  
  56. @base-x  
  57. @graphical-internet  
  58. @java  
  59. @text-internet  
  60. @system-tools  
  61. @legacy-software-support  
  62. @editors  
  63. kexec-tools  
  64. fipscheck  
  65. device-mapper-multipath  
  66. sgpio  
  67. emacs  
  68. festival  
  69. audit  
  70. xorg-x11-utils  
  71. xorg-x11-server-Xnest 

將複製的%pachages 部分信息放到最後

(7)複製配置文件模塊

  1. [root@station5 ~]# cd /tftpboot/  
  2. [root@station5 tftpboot]# mkdir pxelinux.cfg  
  3. [root@station5 tftpboot]# cp /mnt/isolinux/isolinux.cfg pxelinux.cfg/default  
  4. [root@station5 tftpboot]# chmod u+w pxelinux.cfg/default          
  5. #由於defaults文件默認是隻讀的,所以增加寫的權限 

(8)修改default文件,內容如下: 
 

  1. default linux        #用戶不選擇使用內容時默認使用哪 個標籤  
  2. prompt 1         
  3. timeout 600        #等待用戶選擇時間 
  4.  
  5. label linux        #定義的標籤,可以建立這個label指向不同的內核文件  
  6. kernel vmlinuz    #內核文件  
  7. append ks=ftp://192.168.0.5/ks.cfg initrdinitrd=initrd.img  
  8. #客戶端下載啓動文件用無人值守安裝文件的地方,也就是上面配置的ks.cfg文件。 

(9)重啓dhcpd、xinetd、vsftpd 服務

  1. [root@station5 ~]# /etc/init.d/dhcpd restart  
  2. [root@station5 ~]# /etc/init.d/xinetd restart  
  3. [root@station5 ~]# /etc/init.d/vsftpd restart 

(10)客戶端安裝(前提當然是支持PXE引導) 
開機後選擇從網絡引導,就可以看到以下信息,輸入:linux 回車 
 image 

image

轉載自http://liyaoyi.blog.51cto.com/442933/810858

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章