标签:
确保已经安装操作系统,作为PXE Server,建议使用RHEL 6的最新版本。
cat>> /etc/yum.repos.d/rhel-dvd.repo<< !
[rhel-dvd]
name=Red Hat Enterprise Linux DVD
baseurl=file:///media/rhel6-dvd
enabled=1
gpgcheck=0
!
需要确保,光盘挂载到/media/rhel6-dvd这个目录。如下:
# mkdir /media/rhel6-dvd
# mount–o loop /dev/sr0 /media/rhel6-dvd
yum-y install dhcptftp-server syslinuxhttpd
# cat >> /etc/dhcp/dhcpd.conf << !
option domain-name "pxe.com";
option domain-name-servers 192.168.157.254;
option routers 192.168.157.254;
default-lease-time 14400;
ddns-update-style none;
########### 提供TFTP服务器地址和启动文件#####################
next-server 192.168.157.254;
filename "pxelinux.0";
allow booting;
allow bootp;
#############################################################
subnet 192.168.157.0 netmask 255.255.255.0 {
range 192.168.157.10 192.168.157.100;
default-lease-time 14400;
max-lease-time 172800;
}
########## 为客户端分配指定IP ###############################
host liujia {
hardware ethernet 00:0C:29:E5:C5:28;
fixed-address 192.168.157.200;
}
#############################################################
注意:需要确保你当前使用dhcp分发的网卡,设定上面配置的IP , 192.168.157.254
chkconfig tftp on
/etc/init.d/xinetd start
chkconfig dhcpd on
/etc/init.d/dhcpd start
chkconfig httpd on
/etc/init.d/httpd start
# cd /var/www/html/
# mkdir wwwrepo ks
# cp–r /media/rhel6-dvd/* wwwrepo
[root@rhel66tftpboot]# pwd
/var/lib/tftpboot
[root@rhel66tftpboot]# tree .
.
├── boot.msg ---- 文件源自RHEL6光盘DVD目录下isolinux/boot.msg
├──memtest ---- 文件源自RHEL6光盘DVD目录下isolinux/memtest
├── pxelinux.0 ---- 文件源自操作系统下 /usr/share/syslinux/pxelinux.0
├──pxelinux.cfg ----- mkdir自行创建
│ └── default ---- 文件源自RHEL6光盘DVD目录下isolinux/isolinux.cfg
├── rhel6u6 ----- mkdir自行创建
│ ├──initrd.img ----- 文件源自RHEL6光盘DVD目录下isolinux
│ └──vmlinuz ----- 文件源自RHEL6光盘DVD目录下isolinux
├── splash.jpg ----- 文件源自RHEL6光盘DVD目录下isolinux
└── vesamenu.c32 ----- 文件源自RHEL6光盘DVD目录下isolinux
2 directories, 8 files
执行以下命令:
# cd /var/lib/tftpboot
# mkdir pxelinux.cfg rhel6u6
#cp/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
# cp /media/rhel6-dvd/isolinux/boot.msg /var/lib/tftpboot/
# cp /media/rhel6-dvd/isolinux/memtest /var/lib/tftpboot/
# cp /media/rhel6-dvd/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default
# cp /media/rhel6-dvd/isolinux/initrd.img /var/lib/tftpboot/rhel6u6
# cp /media/rhel6-dvd/isolinux/vmlinuz /var/lib/tftpboot/rhel6u6
# cp /media/rhel6-dvd/isolinux/splash.jpg /var/lib/tftpboot/
# cp /media/rhel6-dvd/isolinux/vesamenu.c32 /var/lib/tftpboot/
编辑文件/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.6!
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 hard drive
localboot 0
labelvesa
menu label auto install system with ks file
kernel /rhel6u6/vmlinuz
appendinitrd=/rhel6u6/initrd.img ks=http://192.168.157.254/ks/rhel6u6.ks ksdevice=bootif
ipappend 2
label rescue
menu label ^Rescue installed system
kernel vmlinuz
appendinitrd=initrd.img rescue
label memtest86
menu label ^Memory test
kernelmemtest
append -
# cd /var/www/html/ks
# vi rhel6u6.ks
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Use network installation
url --url=http://192.168.157.254/wwwrepo/rhel6u6/
# Root password
rootpw --plaintext root1234
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
langen_US
# SELinux configuration
selinux --disabled
# Firewall configuration
firewall --disabled
# Installation logging level
logging --level=info
#Reboot after installation
reboot
services --disabled udev-post,rpcidmapd,rpcgssd,rpcbind,rhsmcertd,rhnsd,postfix,mdmonitor,lvm2-monitor,libvirt-guests,iptables,ip6tables,cups,bluetooth,avahi-daemon,autofs,atd,abrtd,abrt-oops,abrt-ccpp,NetworkManager,gpm
services --enabled kdump,ntpd
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=dhcp --device=em2 --onboot=on
# System bootloader configuration
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# Clear the Master Boot Record
zerombr
clearpart --all --initlabel
ignoredisk --only-use=sda
part /boot --fstype="ext4" --ondisk=sda --size=1024
part pv.008002 --grow --ondisk=sda --size=200
volgroupVolGroup --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --size=5000
logvol swap --name=lv_swap --vgname=VolGroup --size=1024
%packages
@base
@chinese-support
@core
net-snmp
net-snmp-libs
net-snmp-utils
ntp
ntpdate
gcc
gcc-c++
openssh-server
openssh-clients
sysstat
lzo
vsftpd
ncompress
make
%end
%post --log=/tmp/ks.log --interpreter=/bin/bash
cat>> /etc/yum.repos.d/rhel-dvd.repo<< !
[rhel-dvd]
name=Red Hat Enterprise Linux DVD
baseurl=http://192.168.157.254/wwwrepo/rhel6u6/
enabled=1
gpgcheck=0
!
%end
需要修改为你实际环境中的网卡,进行配置。进入网卡配置界面进行配置。
需要修改PXE菜单引导配置,添加类似如下:
labelvesa
menu label auto install system with ks file
kernel /rhel6u6/vmlinuz
appendinitrd=/rhel6u6/initrd.imgks=http://192.168.157.254/ks/rhel6u6.ksksdevice=bootif
ipappend 2
标签:
原文地址:http://www.cnblogs.com/MichaelDD/p/5130402.html