PXE自动装机所需服务(CentOS7.4)
1、DHCP服务(用于服务器开机获取地址,并指定配置文件获取地址)
2、TFTP服务 (用于存放一些简单的配置文件,依赖xinetd管理服务)
3、FTP/HTTP服务(存放系统文件与镜像)
4、DNS服务 (可选服务,用来自动配置主机名)
5、配置YUM源或者本地yum源 (此次采用阿里云yum源)
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
第一步、安装DHCP
1、yum -y install dhcp
2、vim /etc/dhcp/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.20;
option domain-name-servers dns.chaoyue1.com;
option domain-name "dns.chaoyue.com";
option routers 192.168.0.1;
next-server 192.168.0.200; #指定下一条服务器地址
filename "pxelinux.0"; #指定启动相关文件地址
default-lease-time 600;
max-lease-time 7200;
}
第二部、安装TFTP
1、yum -y install tftp-server xinetd
2、vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no #默认状态为yes,不启用状态
per_source = 11
cps = 100 2
flags = IPv4
}
第三部、配置系统与引导文件
1、yum -y install syslinux vsftpd
2、cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
3、mount -o loop -t iso9660 /root/CentOS7.XXXXX /var/ftp/pub
4、cp /var/ftp/pub/isolinux/* /var/lib/tftpboot
5、mkdir /var/lib/tftpboot/pxelinux.cfg
6、cp /var/ftp/pub/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
7、chmod 644 /var/lib/tftpboot/pxelinux.cfg/default
8、修改启动配置文件
menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty line
label linux
menu label Install CentOS ^7.6
menu default
kernel vmlinuz
append initrd=initrd.img inst.ks=ftp://192.168.0.200/pub/CentOS7.6/ks7.cfg ip=dhcp quiet
label linux
menu label Install CentOS ^6.5
kernel vmlinuz
append initrd=CentOS6.5/initrd.img inst.ks=ftp://192.168.0.200/pub/CentOS6.5/ks6.cfg ip=dhcp quiet
第四部、配置自动应答文件
1、安装软件system-config-kickstart 或者直接修改 /root/anaconda-ks.cfg 文件
2、yum -y install system-config-kickstart
3、system-config-kickstart
4、配置kickstart

分区时需要注意是否需要LVM等·····等等等·····等

SELinux不激活,上下文啥的等研究透了再考虑SELinux吧,防火墙禁用。

系统安装完成后运行的脚本,用来做前期的一些准备工作。

##之后就可以点击左上角文件,选择保存了,注意选择保存位置。
第五步、检查
1、systemctl start dhcpd
2、systemctl enable dhcpd
3、systemctl start xinetd
4、systemctl enable xinetd
5、systemctl start vsftpd
6、systemctl enable vsftpd
7、systemctl stop firewalld
8、systemctl disable firewalld
CentOS7配置PXE自动装机
原文:https://www.cnblogs.com/chaoyue-xu/p/13346375.html