測試環境:Redhat 5.4 關閉iptables 和Selinux
所需服務:Dhcp Vsftp Tftp Xinted
2.開始安裝:
(1)安裝所需服務
- DHCP:
- [root@station5 ~]# yum -y install dhcp.i*
- [root@station5 ~]# chkconfig dhcpd on
- TFTP:
- [root@station5 ~]# yum -y install tftp.i*
- VSFTPD:
- [root@station5 ~]# yum -y install vsftpd
- kickstart:
- [root@station5 ~]# yum -y install system-config-kickstart
(2)安裝配置DHCP服務
修改以下內容:
(3)將TFTP服務狀態設置爲可運行
- [root@station5 ~]# vim /etc/xinetd.d/tftp
- 14 disable = no #修改第14行把原來的yes修改成no
- [root@station5 ~]# /etc/init.d/xinetd restart
(4)複製Linux啓動、內核文件及啓動鏡像文件:
- [root@station5 ~]# mount /dev/hdc /mnt #掛載光盤到/mnt目錄下
- [root@station5 ~]# cp /mnt/isolinux/initrd.img /tftpboot/
- [root@station5 ~]# cp /mnt/isolinux/vmlinuz /tftpboot/
- [root@station5 ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
(5)將RHEL光盤所有內容複製到/var/ftp/pub目錄下
- [root@station5 ~]# cp -r * /var/ftp/pub/
(6)kickstart配置文件的生成:
通過system-config-kickstart 生成無人值守文件,再將生成的ks.cfg無人值守文件保存到/var/ftp下。
分區信息:這裏我選的是:清除主引導記錄和清除現有分區
接下來是新建分區信息,可根據實際情況配置:
網絡配置:選擇 Add Network Device ---OK 使用DHCP網絡類型:
其他的按照自己的裝機需求設置
接下來單擊菜單:File--Save File 將ks.cfg保存到/var/ftp目錄下面
配置新生成的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文件後面
- [root@station5 ftp]# vim ks.cfg
- #platform=x86, AMD64, or Intel EM64T
- # System authorization information
- auth --useshadow --enablemd5
- # System bootloader configuration
- bootloader --location=mbr
- # Clear the Master Boot Record
- zerombr
- # Partition clearing information
- clearpart --all --initlabel
- # Use graphical install
- graphical
- # Firewall configuration
- firewall --enabled
- # Run the Setup Agent on first boot
- firstboot --disable
- key --skip #順便增加這個,跳過序列號
- # System keyboard
- keyboard us
- # System language
- lang en_US
- # Installation logging level
- logging --level=info
- # Use network installation
- url --url=ftp://192.168.0.5/pub
- # Network information
- network --bootproto=dhcp --device=eth0 --onboot=on
- # Reboot after installation
- reboot
- #Root password
- rootpw --iscrypted $1$73hBcd2n$DoNPPPAFrOKrj10Cr.eRX0
- # SELinux configuration
- selinux --enforcing
- # System timezone
- timezone Asia/Shanghai
- # Install OS instead of upgrade
- install
- # X Window System configuration information
- xconfig --defaultdesktop=GNOME --depth=32 --resolution=800x600 --startxonboot
- # Disk partitioning information
- part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
- part / --bytes-per-inode=4096 --fstype="ext3" --size=4096
- part /home --bytes-per-inode=4096 --fstype="ext3" --size=2000
- part swap --bytes-per-inode=4096 --fstype="swap" --size=512
- part /usr --bytes-per-inode=4096 --fstype="ext3" --size=3000
- %packages
- @dialup
- @base
- @gnome-desktop
- @core
- @admin-tools
- @chinese-support
- @printing
- @base-x
- @graphical-internet
- @java
- @text-internet
- @system-tools
- @legacy-software-support
- @editors
- kexec-tools
- fipscheck
- device-mapper-multipath
- sgpio
- emacs
- festival
- audit
- xorg-x11-utils
- xorg-x11-server-Xnest
將複製的%pachages 部分信息放到最後
(7)複製配置文件模塊
- [root@station5 ~]# cd /tftpboot/
- [root@station5 tftpboot]# mkdir pxelinux.cfg
- [root@station5 tftpboot]# cp /mnt/isolinux/isolinux.cfg pxelinux.cfg/default
- [root@station5 tftpboot]# chmod u+w pxelinux.cfg/default
- #由於defaults文件默認是隻讀的,所以增加寫的權限
(8)修改default文件,內容如下:
- default linux #用戶不選擇使用內容時默認使用哪 個標籤
- prompt 1
- timeout 600 #等待用戶選擇時間
- label linux #定義的標籤,可以建立這個label指向不同的內核文件
- kernel vmlinuz #內核文件
- append ks=ftp://192.168.0.5/ks.cfg initrdinitrd=initrd.img
- #客戶端下載啓動文件用無人值守安裝文件的地方,也就是上面配置的ks.cfg文件。
(9)重啓dhcpd、xinetd、vsftpd 服務
- [root@station5 ~]# /etc/init.d/dhcpd restart
- [root@station5 ~]# /etc/init.d/xinetd restart
- [root@station5 ~]# /etc/init.d/vsftpd restart