PXE是一个预启动环境 是由inter公司开发的,可以让计算机在网络中去启动操作系统
主要是用于安装客户机的引导系统
Kickstart:无人值守安装方式,其工作原理就是将运维人员的操作,保存到一个ks.cfg的一个文件当中,在安装过程当中会自动执行里面的步骤
需要的服务:
DHCP:主要是用来分配IP,让两台主机之间进行联通
TFTP:简单文件传输协议,负责传输小的文件,其特点:是不需要经过认证,可以直接用来进行传输,用的是UDP协议(传输层),端口号69
FTP:将完整的操作系统进行传输,通过共享目录的方式进行传输,共享目录在/var/ftp下面,还可以使用httpd,共享目录在/var/www/,还有nfs
一台2G的虚拟机
安装配置DHCP:给需要安装操作系统的主机分配IP
[root@localhost yum.repos.d]# yum -y install dhcp
[root@localhost yum.repos.d]# vim /etc/dhcp/dhcpd.conf
启动服务:
[root@localhost yum.repos.d]# systemctl restart dhcpd
安装配置TFTP:
[root@localhost yum.repos.d]# yum -y install tftp xinetd tftp-server //xinetd:管理tftp的组件
[root@localhost yum.repos.d]# vim /etc/xinetd.d/tftp
安装拷贝启动程序需要的东西:
[root@localhost yum.repos.d]# yum -y install syslinux //包含了引导程序,syslinux提供pxelinux.0文件生成ks.cfg
将所有的引导文件放到这个下面就可以进行传输:
[root@localhost yum.repos.d]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# cp /usr/share/syslinux/pxelinux.0 . //pxeboot:远程安装系统,引导程序内容,提供生成ks.cfg文件的用syslinux软件进行拷贝
[root@localhost tftpboot]# cp /media/images/pxeboot/vmlinuz . //tftp传输文件包含pxe网络安装系统的虚拟的根目录和虚拟的内核
[root@localhost tftpboot]# cp /media/images/pxeboot/initrd.img . //镜像
[root@localhost tftpboot]# cp /media/isolinux/vesamenu.c32 . //图形安装界面程序
[root@localhost tftpboot]# cp /media/isolinux/splash.png . //背景图片
[root@localhost tftpboot]# cp /media/isolinux/boot.* . //提示信息,启动选项
[root@localhost tftpboot]# mkdir pxelinux.cfg 创建pxelinux引导目录
[root@localhost tftpboot]# cp /media/isolinux/isolinux.cfg pxelinux.cfg/default //创建default引导文件
修改配置文件:
[root@localhost tftpboot]# vim pxelinux.cfg/default
网络安装包的位置,ks:虚拟机的什么分区时区都在ks.cfg里面
重新启动:
[root@localhost tftpboot]# systemctl restart xinetd
[root@localhost tftpboot]# systemctl restart tftp
配置安装ftp:
[root@localhost tftpboot]# yum -y install vsftpd
匿名用户的共享目录:
[root@localhost tftpboot]# cd /var/ftp/
[root@localhost ftp]#ls
[root@localhost ftp]# mkdir centos //创建安装文件目录
复制挂载点里面的全部内容:
[root@localhost centos]# cp -r /media/* . //将光盘中的文件拷贝到安装文件
[root@localhost centos]# cp /root/anaconda-ks.cfg ./ks.cfg //把原有的启动分区里面所有东西都拷贝到pxe里面
[root@localhost centos]# chmod +r ks.cfg
[root@localhost centos]# vim ks.cfg
[root@localhost centos]# systemctl restart vsftpd
[root@localhost centos]# systemctl stop firewalld
[root@localhost centos]# setenforce 0