安装前准备:关闭防火墙和SELINUX,DHCP服务器静态IP。
切勿用桥接模式 最好是NET模式而且把自动分配DHCP对勾取消。
查看防火墙和seelinux是否关闭
[root@centos8 ~]#firewall-cmd --state
not running
[root@centos8 ~]#getenforce
Disabled
安装对应的软件包
安装syslinux的时候centos8和centos7存在一点不同在后面的后缀-nonlinux
启动相应的三个服务 但是由于dhcp的文件配置还没有配置,所以这里起不来。
[root@centos8 ~]#ss -ntulp
查看对应端口号
.
log-facility local7;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
# This is a very basic subnet declaration.
subnet 192.168.32.0 netmask 255.255.255.0 {
range 192.168.32.100 192.168.32.200;
option routers 192.168.32.2;
next-server 192.168.32.8;
filename "pxelinux.0";
}
~
重启服务即可
[root@centos8 ~]#systemctl restart dhcpd
[root@centos8 ~]#systemctl status dhcpd
● dhcpd.service - DHCPv4 Server Daemon
Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-11-14 14:12:29 CST; 5s ago
Docs: man:dhcpd(8)
man:dhcpd.conf(5)
Main PID: 10692 (dhcpd)
Status: "Dispatching packets..."
Tasks: 1 (limit: 11377)
Memory: 5.1M
CGroup: /system.slice/dhcpd.service
└─10692 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
Nov 14 14:12:29 centos8 dhcpd[10692]: ** Ignoring requests on virbr0. If this is not what
Nov 14 14:12:29 centos8 dhcpd[10692]: you want, please write a subnet declaration
Nov 14 14:12:29 centos8 dhcpd[10692]: in your dhcpd.conf file for the network segment
Nov 14 14:12:29 centos8 dhcpd[10692]: to which interface virbr0 is attached. **
Nov 14 14:12:29 centos8 dhcpd[10692]:
Nov 14 14:12:29 centos8 dhcpd[10692]: Listening on LPF/eth0/00:0c:29:fe:da:42/192.168.32.0/24
Nov 14 14:12:29 centos8 dhcpd[10692]: Sending on LPF/eth0/00:0c:29:fe:da:42/192.168.32.0/24
Nov 14 14:12:29 centos8 dhcpd[10692]: Sending on Socket/fallback/fallback-net
Nov 14 14:12:29 centos8 dhcpd[10692]: Server starting service.
Nov 14 14:12:29 centos8 systemd[1]: Started DHCPv4 Server Daemon.
[root@centos8 ~]#
PEX自动化安装就配置好了
安装新系统
现在去安装一个新的centos8的系统
选择菜单
安装成功
脚本运行成功
扩展同时配置加载安装centos6 和 centos 7
需要安装什么系统,对应的光盘同样需要挂载上去
查看web服务器上是否挂载
现在配置应答文件,这里用之前已经做好的应答文件
[root@centos8 html]#cd /var/www/html/
[root@centos8 html]#ls
centos ksdir reset
[root@centos8 html]#cd ksdir/
[root@centos8 ksdir]#ls
ks8.cfg
[root@centos8 ksdir]#rz -E
rz waiting to receive.
[root@centos8 ksdir]#ls
ks6.cfg ks7.cfg ks8.cfg
修改对应的应答文件 特别是注意路径
[root@centos8 ksdir]#vim ks7.cfg
[root@centos8 ksdir]#vim ks6.cfg
[root@centos8 ksdir]#ll
-rw-r--r-- 1 root root 1235 Nov 14 16:13 ks6.cfg
-rw-r--r-- 1 root root 1435 Nov 14 16:09 ks7.cfg
-rw-r--r-- 1 root root 1805 Nov 14 14:35 ks8.cfg
在网页需要分别能打开对应的应答文件,不然就是权限问题 需要设置一下权限
设置tftp配置文件
[root@centos8 tftpboot]#ls
initrd.img ldlinux.c32 libcom32.c32 libutil.c32 menu.c32 pxelinux.0 pxelinux.cfg vmlinuz
创建分别放置不同操作系统的目录6 7 8.用来放置不同的内核文件
[root@centos8 tftpboot]#mkdir {6,7,8}
[root@centos8 tftpboot]#mv vmlinuz initrd.img 8/
[root@centos8 tftpboot]#cp /var/www/html/centos/7/isos/x86_64/isolinux/vmlinuz ./7/
[root@centos8 tftpboot]#cp /var/www/html/centos/7/isos/x86_64/isolinux/initrd.img ./7/
[root@centos8 tftpboot]#cp /var/www/html/centos/6/isos/x86_64/isolinux/vmlinuz ./6/
[root@centos8 tftpboot]#cp /var/www/html/centos/6/isos/x86_64/isolinux/initrd.img ./6/
[root@centos8 tftpboot]#tree
.
├── 6
│ ├── initrd.img
│ └── vmlinuz
├── 7
│ ├── initrd.img
│ └── vmlinuz
├── 8
│ ├── initrd.img
│ └── vmlinuz
├── ldlinux.c32
├── libcom32.c32
├── libutil.c32
├── menu.c32
├── pxelinux.0
└── pxelinux.cfg
└── default
4 directories, 12 files
修改菜单项 注意路径 是相对路径
[root@centos8 tftpboot]#vim pxelinux.cfg/default
default menu.c32
timeout 600
menu title CentOS Linux
label linux8
menu label Auto Install CentOS Linux ^8.0 mini
kernel 8/vmlinuz
append initrd=8/initrd.img ks=http://192.168.32.8/ksdir/ks8.cfg
label linux7
menu label Auto Install CentOS Linux ^7.0 mini
kernel 7/vmlinuz
append initrd=7/initrd.img ks=http://192.168.32.8/ksdir/ks7.cfg
label linux6
menu label Auto Install CentOS Linux ^6.0 mini
kernel 6/vmlinuz
append initrd=6/initrd.img ks=http://192.168.32.8/ksdir/ks6.cfg
label manual
menu label Manual Install CentOS Linux 8.0
kernel vmlinuz
append initrd=initrd.img inst.repo=http://192.168.32.8/centos/8/isos/x86_64/
menu separator # insert an empty line
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
参考文献如下