系統CentOS5.5
CentOS下配置PXE+Kickstart無人值守安裝
Howto install CentOS through PXE+KickStart
1..確認以下軟件包是否安裝,如果沒有安裝則加載光盤進行安裝
dhcp
tftp-server
xinetd
syslinux
nfs-utils
2.配置DHCP
編輯/etc/sysconfig/dhcpd
DHCPDARGS=eth0;
[root@pxecentos ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
修改/etc/dhcpd.conf
修改subnet
range dynamic-bootp
內容
添加
allow booting;
allow bootp;
next-server 192.168.15.168;
filename "/pxelinux.0";
註釋掉以下三行
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-server 192.168.1.1;
2.編輯/etc/xinetd.d/tftp
修改 disable =no
3.拷貝pxelinux.0到/tftpboot
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
4從光盤拷貝內核文件vmlinuz以及根文件系統initrd.img到/tftpboot
cp /mnt/cdrom/images/pxeboot/vmlinuz /mnt/images/pxeboot/initrd.img /tftpboot
5. 創建/tftpboot/pxelinux.cfg目錄
mkdir /tftpboot/pxelinux.cfg
6. 創建/tftpboot/pxelinux.cfg/default文件
touch /tftpboot/pxelinux.cfg/default
文件內容如下:
default linux
prompt 0
label linux
kernel vmlinuz
append ks=nfs:192.168.15.168:/netinstall/ks.cfg initrd=initrd.img
配置nfs網絡安裝
mkdir /netinstall
cp /root/anaconda-ks.cfg /netinstall/ks.cfg
chmod 777 /netinstall/ks.cfg
# Kickstart file automatically generated by anaconda.
編輯/netinstall/ks.cfg
修改cdrom 爲
nfs --server=192.168.15.168 --dir=/mnt/cdrom/
修改clearpart --linux --drives=sda爲
autopart
clearpart --all --drives=sda –initlabel
配置nfs
[root@pxecentos ~]# vi /etc/exports
添加如下內容
/netinstall *(ro,sync)
/mnt/cdrom *(ro,sync)
重新啓動相關服務,並添加到開機自啓動
/etc/init.d/network restart
/etc/init.d/dhcpd restart
/etc/init.d/xinetd restart
/etc/init.d/portmap restart
/etc/init.d/nfs restart
Chkconfig dhcpd on
Chkconfig nfs on
Chkconfig portmap on
客戶端設置從網絡啓動
KS.cfg修改後內容如下:
install
text
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$FPVa/ywL$38m6TfY1kCE3MF42oJP0p.
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Asia/Shanghai
nfs --server=192.168.15.168 --dir=/mnt/cdrom/
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
autopart
clearpart --all --drives=sda --initlabel
#part /boot --fstype ext3 --size=100 --ondisk=sda
#part pv.2 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.2
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1024 --grow --maxsize=2048
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
%packages
@admin-tools
@base
@core
@development-libs
@development-tools
@dialup
@editors
@ftp-server
@gnome-desktop
@games
@graphical-internet
@graphics
@network-server
@office
@printing
@sound-and-video
@system-tools
@text-internet
@base-x
keyutils
kexec-tools
trousers
fipscheck
device-mapper-multipath
imake
java-1.6.0-openjdk
libsane-hpaio
vnc-server
festival
audit
xorg-x11-server-Xnest
xorg-x11-server-Xvfb