1、客户机可以通过服务端dhcp在获取IP地址,并且dhcpd服务器会告诉客户端tftp服务器IP地址。
2、pxe客户端会从tftp服务器上下载pxelinux.0操作系统和这个操作系统对应的配置文件(default)至本机,在本机上运行pxelinux.0这个操作系统,
这个操作系统会加载自己的配置文件:default.
default加载后会弹出一个安装系统选择界面,让用户去选择要安装哪个操作系统
tftp的作用是实现安装文件UDP快速传输
3、启动第三个临时系统(vmlinuz/initrd.img),构造安装之前一个临时系统环境,在这里会重新
获取IP地址,并且会读取ks.cfg这个配置文件
4、nfs/http/ftp用来导出红帽系统安装目录树
5、根据ks.cfg来自动完成操作系统的安装
部署PXE
1. Configure the network (NFS, FTP, HTTP) server to export the installation tree.
2. Configure the files on the tftp server necessary for PXE booting.
3. Configure DHCP.
4. Boot the client, and start the installation.
1 配置服务(NFS, FTP, HTTP) 导出安装树
[iyunv@node1 ~]# lftp 192.168.0.254
lftp 192.168.0.254:~> cd notes/iso/
lftp 192.168.0.254:/notes/iso> get rhel-server-6.3-x86_64-dvd.iso
lftp 192.168.0.254:/notes/iso> exit
[iyunv@node1 ~]# vim /etc/fstab
/root/rhel-server-6.3-x86_64-dvd.iso /mnt/rhel6 iso9660 ro,loop 0 0
[iyunv@node1 ~]# mkdir /mnt/rhel6
[iyunv@node1 ~]# mount -a
本地YUM源
[iyunv@node1 ~]# rm -fr /etc/yum.repos.d/*
[iyunv@node1 ~]# vim /etc/yum.repos.d/local.repo
[local]
name=this's local YUM
baseurl=file:///mnt/rhel6
enabled=1
gpgcheck=0
安装服务
[iyunv@node1 ~]# yum -y install vsftpd httpd
通过ftp发布安装树
[iyunv@node1 ~]# mkdir /var/ftp/pub/rhel6/dvd -p
[iyunv@node1 ~]# vim /etc/fstab
/root/rhel-server-6.3-x86_64-dvd.iso /var/ftp/pub/rhel6/dvd iso9660 ro,loop 0 0
[iyunv@node1 ~]# mount -a
[iyunv@node1 ~]# service vsftpd start
[iyunv@node1 ~]# chkconfig vsftpd on
通过http发布安装树
[iyunv@node1 ~]# ln -s /var/ftp/pub/rhel6/dvd/ /var/www/html/rhel6
[iyunv@node1 ~]# service httpd start
[iyunv@node1 ~]# chkconfig httpd on
[iyunv@node1 ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.3!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label local
menu label Boot from ^local drive
menu default
localboot 0xffff
label linux
menu label Install RHEL6.3
menu default
kernel rhel6.3/vmlinuz
append initrd=rhel6/initrd.img
label auto
menu label Auto RHEL6.3
kernel rhel6.3/vmlinuz
append initrd=rhel6/initrd.img ks=http://192.168.0.1/rhel6.cfg noipv6
label rescue
menu label ^Rescue installed system
kernel rhel6.3/vmlinuz
append initrd=rhel6.3/initrd.img rescue
vim /root/ks_rhel5.4.cfg
#platform=x86, AMD64, 或 Intel EM64T
key --skip
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr --md5pass=$1$MUnByNpz$WVFU9CQ.cnLdHPjOjfKvO/
# 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
# Installation logging level
logging --level=info
# Use network installation
url --url=ftp://192.168.0.1/pub/rhel5.4
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$dTFnL7xR$f6xjhRJbxoKxPt69HLv2V0
# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=8 --resolution=800x600 --startxonboot
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part / --bytes-per-inode=4096 --fstype="ext3" --size=15000
part swap --bytes-per-inode=4096 --fstype="swap" --size=512
%pre
#clearpart --linux
#part /boot --fstype ext3 --size=200
#part pv.3 --size=20000
#part swap --size=1024
#volgroup vol0 --pesize=32768 pv.3
#logvol / --fstype ext3 --name=root --vgname=vol0 --size=15000
#logvol /home --fstype ext3 --name=home --vgname=vol0 --size=992
%post
echo "nameserver 192.168.0.1" >> /etc/resolv.conf