Centos8怎么基于PXE自动安装操作系统
时间:2021-05-26 16:57
下面由centos教程栏目给大家介绍Centos8基于PXE自动安装操作系统,希望对需要的朋友有所帮助! 提前添加三张光驱,分别放入centos6,7,8的光盘 Centos6,7,8 ks.cfg 新开一台虚拟机从网卡启动 以上就是Centos8怎么基于PXE自动安装操作系统的详细内容,更多请关注gxlcms其它相关文章!PXE服务器配置
安装相关软件
dnf install -y httpd tftp-server dhcp-server syslinux-nonlinux
配置 dhcp
vim /etc/dhcp/dhcpd.conf
subnet 192.168.43.0 netmask 255.255.255.0 {
range 192.168.43.100 192.168.43.200;
option routers 192.168.43.2;
option domain-name "xuepeng.com";
option domain-name-servers 180.76.76.76, 114.114.114.114;
next-server 192.168.43.8;
filename "pxelinux.0";
}
立即启动,开机自启动服务
systemctl enable --now tftp dhcpd httpd
准备相关目录挂载光盘
mkdir -p /var/www/html/Centos/{6,7,8}/os/x86_64
mount /dev/sr0 /var/www/html/Centos/8/os/x86_64/
mount /dev/sr1 /var/www/html/Centos/6/os/x86_64/
mount /dev/sr2 /var/www/html/Centos/7/os/x86_64/
将ks文件移动到 /var/www/html/ksdir
mkdir /var/www/html/ksdir
mv ks{6,7,8}.cfg /var/www/html/ksdir
准备启动相关文件放到 /var/lib/tftpboot 目录下
/var/lib/tftpboot/pxelinux.cfg/default文件内容
default menu.c32
timeout 600
menu title PXE Auto Install Centos
label mini 6
menu label ^Install CentOS Mini ^6
kernel Centos6/vmlinuz
append initrd=Centos6/initrd.img ks=http://192.168.43.8/ksdir/ks6.cfg
label mini 7
menu label ^Install CentOS Mini ^7
kernel Centos7/vmlinuz
append initrd=Centos7/initrd.img ks=http://192.168.43.8/ksdir/ks7.cfg
label mini 8
menu label ^Install CentOS Mini ^8
kernel Centos8/vmlinuz
append initrd=Centos8/initrd.img ks=http://192.168.43.8/ksdir/ks8.cfg
label manual
menu label ^Manual Install Centos Linux 8
kernel Centos8/vmlinuz
append initrd=Centos8/initrd.img inst.repo=http://192.168.43.8/Centos/8/os/x86_64
label rescue
menu label ^Rescue a CentOS Linux system 8
kernel Centos8/vmlinuz
append initrd=Centos8/initrd.img ks=http://192.168.43.8/ksdir/ks8.cfg rescue quiet
label rescue
menu label ^Rescue a CentOS Linux system 7
kernel Centos7/vmlinuz
append initrd=Centos7/initrd.img ks=http://192.168.43.8/ksdir/ks7.cfg rescue quiet
label rescue
menu label ^Rescue a CentOS Linux system 6
kernel Centos6/vmlinuz
append initrd=Centos6/initrd.img ks=http://192.168.43.8/ksdir/ks6.cfg rescue quiet
label local
menu default
menu label Boot from ^local drive
localboot 0xffff
pxe客户端配置
系统自动安装软件包
进入系统