环境配置
1.rhel7主机 配置网络
2开启图形
[root@localhost ~]yum -y groupinstall "Server with GUI" #下载
[root@localhost ~]init 5 #开启图形
3.关闭DHCP功能
实验步骤
安装并启动kickstart
[root@localhost ~]# yum install system-config-kickstart
[root@localhost ~]# system-config-kickstart
程序配置
[root@localhost ~]# ln -s /rhel7 /var/www/html/
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# ll
total 0
lrwxrwxrwx 1 root root 6 Aug 5 15:10 rhel7 -> /rhel7
点击文件保存至/root 文件名为ks.cfg
[root@localhost ~]# ls
anaconda-ks.cfg Desktop Documents Downloads ks.cfg Music Pictures Public Templates Videos wangluo.sh
更改ks.cfg文件
[root@localhost ~]# vim ks.cfg
[root@localhost ~]# ksvalidator ks.cfg #检查文件完整性
[root@localhost ~]# cp /root/ks.cfg /var/www/html/ #移动文件
网络访问ks.cfg 和 rhel7
搭建DHCP服务并测试kickstart脚本
[root@localhost ~]# yum install dhcp -y
[root@localhost ~]# \cp -f /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
删去37行以下内容
启动DHCP
[root@localhost ~]# systemctl enable --now dhcpd
搭建pxe网络安装环境实现服务器自动部署
[root@localhost ~]# yum install syslinux.x86_64 -y
[root@localhost ~]# yum install tftp-server.x86_64 -y
[root@localhost ~]# systemctl enable --now tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.[root@localhost ~]# cp /rhel7/isolinux/* /var/lib/tftpboot
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@localhost ~]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# ls
boot.cat grub.conf isolinux.bin memtest splash.png upgrade.img vmlinuz
boot.msg initrd.img isolinux.cfg pxelinux.0 TRANS.TBL vesamenu.c32
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cp isolinux.cfg pxelinux.cfg/default
[root@localhost tftpboot]# vim /etc/dhcp/dhcpd.conf
[root@localhost tftpboot]# vim /var/lib/tftpboot/pxelinux.cfg/default
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
[root@localhost tftpboot]# systemctl restart dhcpd
[root@localhost tftpboot]# systemctl restart tftp
测试