一、环境准备
- 一台centos7操作系统,地址:172.16.16.253/24
- 关闭防火墙、selinux
- 配置本地yum源
二、服务安装
yum install -y dhcp tftp-server httpd syslinux
三、服务配置
[root@pxe ~]
subnet 172.16.16.0 netmask 255.255.255.0 {
range 172.16.16.10 172.16.16.210;
default-lease-time 3600;
next-server 172.16.16.253;
filename "pxelinux.0";
}
[root@pxe ~]
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
cp /mnt/isolinux/vmlinuz /var/lib/tftpboot
cp /mnt/isolinux/initrd.img /var/lib/tftpboot
mkdir pxelinux.cfg
touch default
[root@pxe pxelinux.cfg]
default menu.c32
timeout 300
prompt 0
label 1
menu label ^1) install centos7
menu default
kernel vmlinuz
append initrd=initrd.img method=http://172.16.16.253/centos7 ks=http://172.16.16.253/ks.cfg
mkdir /var/www/html/centos7
cp /mnt/* /var/www/html/centos7
cp anaconda-ks.cfg /var/www/html/ks.cfg
四、重启服务
重启所有服务,将网络与需要部署的服务器连接,开始自动部署操作系统。
|