说明:

灰色背景的为命令

蓝色字体为配置文件内容

一:环境

centos 5.6 x86_64

Ip 192.168.0.2/24

安装光盘内容复制在/media/cd目录下

二:需要的服务和软件:

安装tftp dhcpd nfs syslinux   

yum install tftp-server -y

yum install dhcpd -y

yum install nfs   -y

yum install syslinux -y

Chkconfig  --level 35  tftp on

Chkconfig  --level 35  nfs on

Chkconfig  --level 35  dhcpd on

三:配置

1:配置dhcp

cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcp/dhcpd.conf 

在第3行处插入下面2行:

next-server   192.168.0.2;
 filename "pxelinux.0";

2:配置nfs

Vim /etc/exports

/media/cd 192.168.0.0/24(rw,no_root_squash)

/kickstart 192.168.0.0/24(rw,no_root_squash)

重新加载配置文件:

exportfs –av

3:配置tftp

vim /etc/xinetd.d/tftp

disable = yes  ##改为no #默认tftp服务是关闭的。

4:配置syslinux

Mkdir /kickstart

将配置好的ks.conf文件放到此目录。Ks.conf文件可以复制已经安装的系统/root/anaconda-ks.cfg  关于改一下分区设置就可以了

下面是一个样本(红色字段为分区设置)

# Kickstart file automatically generated by anaconda.

 

install

#logging --level=info

nfs --server=192.168.0.2 --dir=/media/cd

lang zh_CN.UTF-8

keyboard us

xconfig --startxonboot

network --device eth0 --bootproto dhcp

rootpw --iscrypted $1$e8RQF6Qb$aVq7/AkocRevYTrYpx3.l0

firewall --enabled --port=22:tcp

authconfig --enableshadow --enablemd5

selinux --enforcing

timezone --utc Asia/Shanghai

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

clearpart --all  --drives=sda

part /boot --fstype ext3 --size=100

part / --fstype ext3 --size=10000

part swap --size=4000

part /www --fstype ext3 --size=100 –grow

 

%packages

@base

@british-support

@chinese-support

@core

@development-libs

@development-tools

@editors

@gnome-desktop

@legacy-software-development

@legacy-software-support

@printing

@base-x

keyutils

iscsi-initiator-utils

trousers

fipscheck

device-mapper-multipath

python-imaging

imake

xorg-x11-server-Xnest

xorg-x11-server-Xvfb

 

复制启动文件,修改pxelinux配置文件

cp /media/cd/p_w_picpaths/pxeboot/vmlinuz /tftpboot/

cp /media/cd/p_w_picpaths/pxeboot/initrd.img /tftpboot/

cp /usr/lib/syslinux/pxelinux.0 /tftpboot/

mkdir /tftpboot/pxelinux.cfg

cp /media/cd/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

vim /tftpboot/pxelinux.cfg/default  ###添加修改以下内容

在文件最前面添加修改:

default autoinstall

prompt 1

timeout 10

 

在文件最后添加

label autoinstall

  kernel vmlinuz

  append ks=nfs:192.168.0.2:/kickstart/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=9216 nofb

四:重启服务

Service dhcpd restart

Service xinetd restart

Service nfs restart

将要安装的机器用网线与服务器连接起来从网络启动,10秒后就会自动安装

安装完后root密码为123456

注:由于写在word里面,没有关闭首字母大写校正,所有文中很多地方的首字母是大写的,我也懒得改了,自己注意...