1、检查网络,能否上网
2、安装dhcp
yum install dhcp –y
配置
vim /etc/dhcp/dhcpd.conf
启动/etc/init.d/dhcpd start
3、使客户机可以外网
vim /etc/sysctl.conf
![](https://i-blog.csdnimg.cn/blog_migrate/30039f985aa86f0e68e546b4d0fd9b55.png)
sysctl -p
做nat转发
iptables –F
iptables -t nat -A POSTROUTING -s 192.168.102.0/24 -j MASQUERADE
4、安装tftp服务器
yum install tftp-server -y
修改配置文件
启动
/etc/init.d/xinetd start
检查
![](https://i-blog.csdnimg.cn/blog_migrate/d371563d0873b1dd527fcd4efd2fb69b.png)
5、安装httpd服务
yum install httpd -y
启动
/etc/init.d/httpd start
6、准备pxe开机引导文件
yum install syslinux -y
cd /var/lib/tftpboot/
cp /usr/share/syslinux/pxelinux.0 .
cp /var/www/html/centos/isolinux/* .
mkdir pxelinux.cfg
cd pxelinux.cfg/
mv ../isolinux.cfg default
vim default
mkdir /var/www/html/ks
cd /var/www/html/ks
vim 6.5-ks.cfg
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
url --url=http://10.0.0.200/centos/
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
url --url=http://10.0.0.200/centos/
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# 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
zerombr
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=200
part swap --asprimary --size=2048
part / --fstype=ext4 --grow --asprimary --size=200
reboot
repo --name="CentOS" --baseurl=http://10.0.0.200/centos/ --cost=100
%packages
@base
@compat-libraries
@core
@debugging
@server-policy
@workstation-policy
python-dmidecode
sgpio
device-mapper-persistent-data
net-tools
vim
lrzsz
wget
tree
screen
lsof
tcpdump
%end
%post
echo 'begin youhua' >>/tmp/install.log
chkconfig|awk '{print $1}'|grep -Ev 'crond|rsyslog|sshd|sysstat|network'|awk '{print "chkconfig " $0 " off"}'|bash
sed -i 's@#UseDNS yes@UseDNS no@g' /etc/ssh/sshd_config
sed -i '/^GSSAPIAuthentication yes/d' /etc/ssh/sshd_config
>/etc/issue
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
sed -i 's#^HOSTNAME=.*$#HOSTNAME=oldboy#g' /etc/sysconfig/network
%end
开始pxe安装centos6.5
创建一台新机器,设置网络适配器为lan区段