分类: LINUX
2012-11-27 20:43:53
环境介绍
pxe 源服务器: 192.168.30.105
client 服务器: 网卡和 pxe 服务器的网卡接在一个交换机上
[server]
1.安装相应的软件包
yum –y install dhcp* nfs* tftp*
2.配置tftp
vi /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -u nobody -s /tftpboot #设置tftp 根目录
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
service xinetd restart
检查tftp启动状况
chkconfig --list |grep tftp
tftp: on
3.配置dhcp
vi /etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.30.0 netmask 255.255.255.0 {
option routers 192.168.30.105;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.30.105;
option time-offset -18000;
range dynamic-bootp 192.168.30.200 192.168.30.253;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.30.105;
filename "pxelinux.0"; #--关键.让客户端获取ip后读取 tftp根目录下的文件
}
vi /etc/sysconfig/dhcpd
DHCPDARGS=eth1 (这个网卡是我的192.168.30.0 段的网卡)
service dhcpd start
4. iso 文件准备
mkdir /mnt
mkdir -p /tftpboot/pxelinux.cfg
mount /iso/CentOS-6.2-x86_64-bin-DVD1.iso /mnt -o loop
cp /mnt/isolinux/vmlinuz /tftpboot/
cp /mnt/isolinux/initrd.img /tftpboot/
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
yum -y install syslinux-devel syslinux-tftpboot syslinux
cp /usr/share/syslinux/pxelinux.0 /tftpboot/
注意:
/tftpboot 目录下是pxe 引导需要的所有东东,也就 4个东东
/mnt 是挂载安装光盘的所有东西,是client端安装时需要的安装文件
整个过程就是:
1.client 通过 tftpboot 下面的东西成功pxe启动,进入安装界面
2. 选择安装文件的路径,进行安装
5.配置nfs
vi /etc/exports
/tftpboot *(ro,sync)
/mnt *(ro,sync)
yum -y install portreserve (这个是替代以前所谓的portmap ; 6.2是叫portreserve)
service nfs start ---启动
service portreserve start
6.客户机器网卡和pxe 源服务器的网卡,要接在一个交换机上面
进到安装界面了,大功告成