基于CentOS5.3平台PXE网络分发安装Linux步骤记录

0. hostname:  PXES.demopxe.com
ip:192.168.195.1/24 gw:192.168.195.254 dns:192.168.195.2
1.install setuptool
[root@localhost ~]# mkdir /tmp/cdrom
[root@localhost ~]# mount /dev/cdrom /tmp/cdrom/
[root@localhost ~]# cd /tmp/cdrom/CentOS/
[root@localhost CentOS]# rpm -ivh setuptool-1.19.2-1.el5.centos.i386.rpm

2.install && configuration dhcpserver
[root@PXES CentOS]# cd /tmp/cdrom/CentOS/
[root@PXES CentOS]# rpm -ivh dhcp-3.0.5-18.el5.i386.rpm
[root@PXES CentOS]# vi /etc/dhcpd.conf  ##add content   dhcpd.conf bk
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.195.0 netmask 255.255.255.0 {
        range  192.168.195.100 192.168.195.200;
        option routers                  192.168.195.254;
        option subnet-mask              255.255.255.0;
        default-lease-time 21600;
        max-lease-time 43200;
        next-server 192.168.195.1; #TFTP Server IP
        filename "pxelinux.0";   #pxelinux boot file
}

3. install tftp
[root@PXES CentOS]# rpm -ivh xinetd-2.3.14-10.el5.i386.rpm tftp-server-0.42-3.1.el5.centos.i386.rpm
[root@PXES CentOS]# vi /etc/xinetd.d/tftp
        disable                 = no
[root@PXES cdrom]# /etc/init.d/xinetd start
Starting xinetd:                                           [  OK  ]
4.install syslinux
[root@PXES CentOS]# rpm -ivh tcsh-6.14-14.el5.i386.rpm mtools-3.9.10-2.fc6.i386.rpm syslinux-3.11-4.i386.rpm
[root@PXES CentOS]# cd /usr/lib/syslinux/
[root@PXES syslinux]# cp pxelinux.0 /tftpboot/
5.copy boot kerneal file
[root@PXES syslinux]# cd /tmp/cdrom/isolinux/
[root@PXES isolinux]# cp vmlinuz initrd.img /tftpboot/
[root@PXES isolinux]# mkdir /tftpboot/pxelinux.cfg
[root@PXES isolinux]# cp /tmp/cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
 
6.modify boot file
[root@PXES isolinux]# chmod 755 /tftpboot/pxelinux.cfg/default
[root@PXES isolinux]# vi /tftpboot/pxelinux.cfg/default   ##并修改如下
default linux
prompt 0
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
  kernel vmlinuz
  append ks=nfs:192.168.195.1:/mnt/install/ks.cfg initrd=initrd.img
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -

6.install nfs
[root@PXES isolinux]# mkdir /mnt/install
[root@PXES isolinux]# cd /tmp/cdrom/
[root@PXES CentOS]# cp -Rf * /mnt/install/
7.send nfs share dir
[root@PXES CentOS]# vi /etc/exports
/mnt/install/ *(ro,sync)
[root@PXES CentOS]# rpm -ivh portmap-4.0-65.2.2.1.i386.rpm
[root@PXES CentOS]# rpm -ivh libgssapi-0.10-2.i386.rpm libevent-1.1a-3.2.1.i386.rpm nfs-utils-lib-1.0.8-7.2.z2.i386.rpm nfs-utils-1.0.9-40.el5.i386.rpm
[root@PXES CentOS]# service portmap start
Starting portmap:                                          [  OK  ]
[root@PXES CentOS]# service nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@PXES CentOS]# showmount -e localhost
Export list for localhost:
/mnt/install *
 
8.configure kickstart
[root@PXES install]# cp /root/anaconda-ks.cfg /mnt/install/ks.cfg   ##如果没有KS范本,可以从本地COPY
[root@PXES install]# chmod a+r /mnt/install/ks.cfg   ##如果从光盘COPY的记得加权限
[root@PXES install]# vi /mnt/install/ks.cfg  ##本例是直接创建KS.cfg内容如下
# Kickstart file automatically generated by Weihu.Yan_2010-07-26
install
nfs --server=192.168.195.1 --dir=/mnt/install
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$EKusTGl7$qBEycMbZx.KR54NXKk2bN0
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Asia/Chongqing
bootloader --location=mbr --driveorder=sda --md5pass=$1$XWZYl8jJ$cooP5EMD/KZaHNRKQN0dz0
# 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 --linux --drives=sda --initlabel
part /boot --fstype ext3 --size=100
part /var --fstype ext3 --size=10240
part /home --fstype ext3 --size=10240
part / --fstype ext3 --size=10240
part /tmp --fstype ext3 --size=1024
part swap --size=1024
part /data --fstype ext3 --size=1 --grow
%packages
@development-libs
@core
@legacy-software-development
@legacy-software-support
@admin-tools
@development-tools
imake
9.close iptables and start dhcpd
[root@PXES install]# service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: filter                    [  OK  ]
Unloading iptables modules:                                [  OK  ]
[root@PXES install]# service dhcpd start
Starting dhcpd:                                            [  OK  ]

10.other config
[root@PXES install]# chkconfig nfs on
[root@PXES install]# chkconfig portmap on
[root@PXES install]# chkconfig dhcpd on
[root@PXES install]# chkconfig xinetd on
[root@PXES install]# chkconfig iptables off
11.troubleshooting
Q:引导到boot位置时,停止,不会自动往下执行。
A:请确保default文件prompt 有设为0
Q:发现没法mount ks.cfg文件?
A:确保是手工执建一个ks.cfg文件,并非直接COPY过来的。

本文出自 “成就梦想---唯有执著努..” 博客,谢绝转载!

你可能感兴趣的:(linux,网络,平台,pxe,分发)