1.实验环境配置
1.1红帽7主机
1.2.开启图形 init 5
1.3.配置网络为手动,配置网络可用
1.4.关闭Vmvare DHCP功能
2.创建脚本
安装kickstart
yum install system-config-kickstart -y
启动图形界面
system-config-kickstart
修改配置文件
安装httpd
yum install httpd -y
systemctl enable --now httpd
ln -s /rhel7 /var/www/html/rhel7
测试
搭建DHCP服务
yum install dhcp -y
cp /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
systemctl enable --now dhcpd
搭建pxe网络安装环境
yum install syslinux.x86_64
yum install tftp-server.x86_64 -ysystemctl enable --now tftp
netsat -antluplerpm -ql tftp-server
cp /rhel7/isolinux/* /var/lib/tftpboot/
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/cd /var/lib/tftpboot/
mkdir pxelinux.cfg
cp isolinux.cfg pxelinux.cfg/defaultvim /etc/dhcp/dhcpd.conf
subnet 172.25.254.0 netmask 255.255.255.0 {
range 172.25.254.30 172.25.254.40;
option routers 172.25.254.2;
next-server 172.25.254.200;
filename "pxelinux.0";
}systemctl restart dhcpd
vim /var/lib/tftpboot/pxelinux.cfg/default
label linux
menu label ^Install Red Hat Enterprise Linux hahaha
menu default (首先执行第一行)
kernel vmlinuz
append initrd=initrd.img repo=http://172.25.254.200/rhel7 ks=http://172.25.254.200/ks.cfg quiet
label check
menu label Test this ^media & install Red Hat Enterprise Linux 7.9
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 rd.live.check quietmenu separator # insert an empty line
测试
kickstart自动安装脚本制作及pxe网络环境配置完成