系统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