环境:server IP:10.0.0.97 linux version:rhel 5.4
1:install dhcp tftp server
[root@server linux]# rpm -qa |grep tftp
tftp-server-0.42-3.1.el5.centos
[root@server linux]# rpm -qa |grep dhcp
dhcpv6-client-1.0.10-4.el5
dhcp-3.0.5-13.el5
目的是确保客户端能够正常获取到ip地址和pxelinux.0文件。
2:alter tftp:
[root@server linux]# vi /etc/xinetd.d/tftp
……………………………………………………………………………………
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = yes / 改成no /
per_source = 11
cps = 100 2
flags = IPv4
}
…………………………………………………………………………………………
/tftpboot 这个参数主要是指定tftp client 客户端从服务器的哪个目录去加载bootloader的pxelinux.0文件。
3:start tftp service:
[root@server linux]# service xinetd restart
Stopping xinetd: [FAILED]
Starting xinetd: [ OK ]
4:modify dhcp :
[root@server ~]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
boot bootp;
subnet 10.0.0.0 netmask 255.255.0.0
{ /分配给client端的ip地址/
#option routers 192.168.9.1;
#option subnet-mask 255.255.255.0;
#option domain-name "domain.org";
#option domain-name-servers 202.96.128.66;
option time-offset -18000;
range dynamic-bootp 10.0.0.10 10.0.0.20;
filename "pxelinux.0"; /用来指定tftp根目录的启动文件实际是在/tftpboot目录下。/
default-lease-time 21600;
max-lease-time 43200;
next-server 10.0.0.97; /这一句是告诉client从哪里加载bootloade/r
}
5: make file and copy pxelinux.0 to /tftpboot:
mkdir /tftpboot
cp /usr/lib/syslinux/pxelinux.0 /tftpboot /pxelinux.0server已经有/
midir /tftpboot/pxelinux.cfg
touch /tftpboot/pxelinux.cfg/default
default内容可以修改成如下:
…………………………………………………………………………
default autoinstall /缺省引导autoinstall 这个label/
prompt 1
timeout 30 /缺省自动加载的时间30s/
………………………………
label autoinstall
kernel vmlinuz /内核文件名字/
append ks=nfs:10.0.0.97:/tftpboot/ks
initrd=initrd.img devfs=nomount ramdisk_size=16384 nofb
……………………………………………………………………………………
6:ks file can copy from root config like this:
…………………………………………………………………………
lang en_US
langsupport zh_CN en_US --default=en_US
keyboard us
mouse
timezone Asia/Shanghai
rootpw password /新装系统的root密码/
reboot
#upgrade
install
#harddrive --partition=sdb1 --dir=rhas
nfs --server=10.0.0.97 --dir=/media/cdrom /指定镜像的位置/
text
bootloader --location=mbr
zerombr yes
clearpart --drives hda –initlabe /硬盘名字,根据实际环境更改/
part / --fstype ext3 --size 3072 --asprimary --ondisk had
part swap --size 256 --asprimary --ondisk hda
part /tmp --fstype ext2 --size 256 --ondisk hda
part /home --fstype ext3 --size 1 --grow --ondisk hda
auth --useshadow --enablemd5
#network --bootproto=dhcp --device=eth0
network --device=eth0 --bootproto=static --
ip=192.168.9.210 --netmask=255.255.255.0 --
gateway=192.168.9.244 --nameserver=202.96.128.68 --
hostname=test.com /指定新装系统的主机名和ip/
firewall --disabled
skipx
%packages –resolvedeps /指定新装系统所需的包/
@ development-tools
@ admin-tools
@ system-tools
7: make NFS server:
[root@server ~]# rpm -qa |grep nfs
nfs-utils-lib-1.0.8-7.2.z2
nfs-utils-1.0.9-33.el5
[root@server ~]# cp /dev/cdrom /kscdrom -fR 强制复制整个目录
[root@server ~]# vi /etc/exports
………………………………………………………………
/kscdrom/ *(ro,sync)
…………………………………………………………………
*(ro,sync) *指定所有的用户(ro,sync)具有只读权限,并且数据同步写入硬盘。
c:start nfs service:
[root@server ~]# service portmap start
[root@server ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@server ~]# exportfs /确认nfs共享正常/
/kscdrom/
…………………………………………………………………
下来就可以直接直接无盘安装linux了!