*****************************************************************
1、配置DHCP
2、配置共享pxelinux.0文件,通过tftp
3、配置共享nfs(也可以是http,vsftpd等) ks.cfg和光盘内容
******************************************************************
1、配置DHCP(光盘镜像已经挂载到/var/ftp/rhel5.3,操作步骤省略)
[root@server /]# rpm -ivh /var/ftp/rhel5.3/Server/dhcp-3.0.5-18.el5.i386.rpm
[root@server /]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y
vim dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
next-server 192.168.1.254;
filename
"pxelinux.0";
# --- default gateway
option routers
192.168.1.254;
option subnet-mask
255.255.255.0;
option nis-domain
"domain.org";
option domain-name
"domain.org";
option domain-name-servers
192.168.1.254;
option time-offset
-18000;
# Eastern Standard Time
#
option ntp-servers
192.168.1.1;
#
option netbios-name-servers
192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#
option netbios-node-type 2;
range dynamic-bootp 192.168.1.128 192.168.1.240;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
[root@server ~]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
2、配置共享pxelinux.0文件,通过tftp
[root@server ~]# rpm -ivh /var/ftp/rhel5.3/Server/tftp-server-0.42-3.1.i386.rpm
[root@server ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@server ~]# cd /tftpboot/
[root@server tftpboot]# ls
pxelinux.0
[root@server tftpboot]# mkdir pxelinux.cfg
[root@server pxelinux.cfg]# cp /var/ftp/rhel5.3/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
查看default文件中定义要加载vmlinuz,initrd两个文件。
那么这两文件应该共享,如下:
[root@server tftpboot]# ls
pxelinux.0 pxelinux.cfg
[root@server tftpboot]# cp /var/ftp/rhel5.3/isolinux/vmlinuz /tftpboot/
[root@server tftpboot]# cp /var/ftp/rhel5.3/isolinux/initrd.img /tftpboot/
[root@server tftpboot]# ls
initrd.img pxelinux.cfg pxelinux.0 vmlinuz
启动tftp server
[root@server tftpboot]# chkconfig tftp on
[root@server tftpboot]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
以上是pxe是配置过程。不再用光盘的方式来到安装界面了。而是通过 网络启动的方式。
============================
[root@server tftpboot]#cat /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 30
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=nfs:192.168.1.254:/var/ftp/rhel5.3/ks.cfg
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 -
__________________________________________________________________
ks.cfg 通过system-config-kickstart来生成。
++++++++++++++++++++++++++++++++++++++++++++++++
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
key --skip
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr --driveorder=sda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
langsupport --default=en_US.UTF-8 zh_HK.UTF-8 zh_CN.UTF-8 zh_TW.UTF-8 en_US.UTF-8
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.1.253 --dir=/var/ftp/rhel5.3
# Network information
network --bootproto=dhcp --device=eth0 --onboot=no
# Reboot after installation
reboot
#Root password
rootpw uplooking
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
key 2515dd4e215225dd
xconfig --defaultdesktop=GNOME --depth=16 --resolution=800x600
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=200
part /home --bytes-per-inode=4096 --fstype="ext3" --size=500
part / --bytes-per-inode=4096 --fstype="ext3" --size=5000
part swap --bytes-per-inode=4096 --fstype="swap" --size=512
%packages --resolvedeps
@ base-x
@ gnome-desktop
@ editors
@ graphical-internet
@ text-internet
@ server-cfg
@ web-server
@ mail-server
@ smb-server
@ dns-server
@ ftp-server
@ network-server
@ development-tools
@ admin-tools
@ system-tools
@ chinese-support
%post
useradd student
echo student | passwd student --stdin