详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术

PXE高效批量网络装机

服务器的批量部署

  • 规模化:同时装配多台服务器
  • 自动化:安装系统、配置各种服务
  • 远程实现:不需要光盘、U盘等安装介质

关于PXE网络

PXE

  • 预启动执行环境,在操作系统之前运行
  • 可用于远程安装,构建无盘工作站

服务端

  • 运行DHCP服务,用来分配地址、定位引导程序

    • DHCP 自动分配IP地址 定位引导文件
  • 运行TFTP服务器,提供引导程序下载

    • TFTP 简单文件传输协议
    • 使用UDP协议
    • 端口号69号
    • 优点:高效率
    • 缺点:容量小
    • 用于存放:引导程序pxelinux.0syslinux软件包),压缩内核vmlinuz,系统初始化文件initrd.img,启动菜单default
  • 运行FTP服务,提供镜像文件下载

    • FTPvsftpd) 文件传输协议

    • 优点:安全 ,容量大
    • 缺点:传输速度慢

    • 使用TCP协议

    • 端口号20用于数据传输 ,端口号21用于连接
    • 用于存放:系统镜像
  • 安装包:dhcptftp-servervsftpdsyslinux

客户端

  • 网卡支持PXE协议
  • 主板支持网络启动

基本部署过程

  • 准备CentOS 7安装源(YUM仓库)
  • 启用TFTP服务,并提供内核、引导程序
  • 启用DHCP服务,用来分配地址、指出引导程序位置
  • 配置启动菜单

TFTP服务及引导文件

  • 安装tftp-server软件包,启用tftp服务
  • 准备内核文件vmlinuz、初始化镜像initrd.img
  • 准备引导程序文件pxelinux.0

DHCP服务的PXE设置

  • next-server //指向TFTP路径
  • filename //引导程序文件位置

默认的启动菜单文件

  • 创建/var/lib/tftpboot/pxelinux.cfg/default
  • 目录名称pxelinux.cfg不可更改

验证PXE网络安装

  • 调整BIOS设置,以便从网络引导
  • 自动获取IP地址,并指定CentOS 7安装源
  • 其余过程与本地安装相同

Demo

1、首先在VMware 15虚拟机中配置一台虚拟机,不安装系统,网卡设置处于仅主机模式,用于验证PXE网络装机,并打开CentOS 7虚拟机,配置双网卡模式,原网卡用于网络连接,便于我们安装服务软件,添加的网卡设置为仅主机模式,使其与配置的虚拟机绑定在同一设备中,同时在添加的网卡中配置静态IP地址,可以给配置的虚拟机提供IP地址。

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

[root@localhost ~]# ifconfig    //查看CentOS 7系统中网卡信息
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500     //原网卡信息
        inet 192.168.144.133  netmask 255.255.255.0  broadcast 192.168.144.255
        inet6 fe80::a85a:c203:e2e:3f3c  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:a0  txqueuelen 1000  (Ethernet)
        RX packets 26199  bytes 36984367 (35.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8391  bytes 524793 (512.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500         //添加的网卡信息
        inet6 fe80::deb1:3cec:3e26:5ec2  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:aa  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 1308 (1.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[root@localhost ~]# cd /etc/sysconfig/network-scripts/          //进入网卡配置文件目录
[root@localhost network-scripts]# ls                            //查看信息
ifcfg-ens33  ifdown-ippp    ifdown-sit       ifup-bnep  ifup-plip    ifup-Team          network-functions-ipv6
ifcfg-lo     ifdown-ipv6    ifdown-Team      ifup-eth   ifup-plusb   ifup-TeamPort
ifdown       ifdown-isdn    ifdown-TeamPort  ifup-ib    ifup-post    ifup-tunnel
ifdown-bnep  ifdown-post    ifdown-tunnel    ifup-ippp  ifup-ppp     ifup-wireless
ifdown-eth   ifdown-ppp     ifup             ifup-ipv6  ifup-routes  init.ipv6-global
ifdown-ib    ifdown-routes  ifup-aliases     ifup-isdn  ifup-sit     network-functions
[root@localhost network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36      //复制ens33配置文件为ens36
[root@localhost network-scripts]# vim ifcfg-ens36               //编辑网卡信息
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static               //更改dhcp为static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens36                        //更改33为36
DEVICE=ens36                      //更改33为36
ONBOOT=yes 
IPADDR=192.168.100.100            //配置IP地址
NETMASK=255.255.255.0             //配置子网掩码
GATEWAY=192.168.100.1             //配置网关
~                                 //注意:删除UUID条目                                                           
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
~                                                                                          
:wq
[root@localhost network-scripts]# service network restart              //重启网卡服务
Restarting network (via systemctl):                        [  确定  ]
[root@localhost network-scripts]# ifconfig                               //查看网卡信息
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.144.133  netmask 255.255.255.0  broadcast 192.168.144.255
        inet6 fe80::a85a:c203:e2e:3f3c  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:a0  txqueuelen 1000  (Ethernet)
        RX packets 124487  bytes 178695031 (170.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35758  bytes 2193524 (2.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        //获取静态IP地址
        inet 192.168.100.100  netmask 255.255.255.0  broadcast 192.168.100.255
        inet6 fe80::f6eb:23e3:3afb:fef4  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:5b:d3:aa  txqueuelen 1000  (Ethernet)
        RX packets 2  bytes 486 (486.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 186  bytes 32776 (32.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

2、安装DHCP服务,并编辑DHCP服务配置文件

[root@localhost network-scripts]# yum install dhcp -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 dhcp.x86_64.12.4.2.5-68.el7.centos.1 将被 安装
...//省略部分内容...
已安装:
  dhcp.x86_64 12:4.2.5-68.el7.centos.1                                                     

作为依赖被升级:
  dhclient.x86_64 12:4.2.5-68.el7.centos.1    dhcp-common.x86_64 12:4.2.5-68.el7.centos.1  
  dhcp-libs.x86_64 12:4.2.5-68.el7.centos.1  

完毕!
[root@localhost network-scripts]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf 
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? yes         //复制DHCP配置文件模板到配置文件中,输入yes确认
[root@localhost network-scripts]# vim /etc/dhcp/dhcpd.conf   //编辑配置DHCP配置文件
...//省略部分内容...
ubnet 192.168.100.0 netmask 255.255.255.0 {            //设置网段地址
        range 192.168.100.20 192.168.100.30;           //设置IP地址分配范围
        option routers 192.168.100.100;                //设置网关,指向自己,方便服务器分配地址
        option domain-name-servers 8.8.8.8;            //设置分配DNS地址
        next-server 192.168.100.100;                   //设置指向TFTP服务器地址,也就是本机
        filename "pxelinux.0";                         //设指向引导文件位置,注意:文件名不可输错
}
...//省略部分内容...
:wq                            //保存退出

3、安装引导程序文件

[root@localhost network-scripts]# yum install syslinux -y   //安装引导程序
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 syslinux.x86_64.0.4.05-15.el7 将被 安装
...//省略部分内容...
已安装:
  syslinux.x86_64 0:4.05-15.el7                                                                                 
完毕!
[root@localhost network-scripts]# rpm -ql syslinux | grep pxelinux.0   //查看安装的软件中是否成功安装引导文件
/usr/share/syslinux/gpxelinux.0
/usr/share/syslinux/pxelinux.0      //程序引导文件

4、安装TFTP服务软件

[root@localhost network-scripts]# yum install tftp-server -y   //安装tftp服务
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 tftp-server.x86_64.0.5.2-22.el7 将被 安装
...//省略部分内容...
已安装:
  tftp-server.x86_64 0:5.2-22.el7                                                                               
完毕!
[root@localhost network-scripts]# rpm -ql tftp-server        //查看tftp服务列表
/etc/xinetd.d/tftp                                    //tftp配置文件目录
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/CHANGES
/usr/share/doc/tftp-server-5.2/README
/usr/share/doc/tftp-server-5.2/README.security
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
/var/lib/tftpboot                                     //tftp站点目录                               

5、将引导程序文件放入tftp服务站点中,并开启tftp服务功能

[root@localhost network-scripts]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/  //将文件复制入tftp站点中
[root@localhost network-scripts]# cd /var/lib/tftpboot/     //进入tftp站点
[root@localhost tftpboot]# ls                               //查看目录信息
pxelinux.0                                                   //引导程序文件添加入站点
[root@localhost tftpboot]# vim /etc/xinetd.d/tftp            //进入编辑tftp主配置文件
# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no                     //更改yes为no开启服务功能
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
~                                                                                                             
:wq                                                    //保存退出

6、安装ftp服务功能,并将镜像文件CentOS 7挂载在ftp站点中,并找到系统初始文件与压缩内核文件,将其添加到的tftp站点中。

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

[root@localhost tftpboot]# yum install vsftpd -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-25.el7 将被 安装
...//省略部分内容...
已安装:
  vsftpd.x86_64 0:3.0.2-25.el7                                                                                  
完毕!
[root@localhost tftpboot]# rpm -ql vsftpd     //查看ftp服务文件列表
...//省略部分内容...
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp                            //ftp站点位置
/var/ftp/pub
[root@localhost ~]# cd /var/ftp/       //进入ftp服务站点
[root@localhost ftp]# ls               //查看目录
pub
[root@localhost ftp]# mkdir centos7      //创建目录centos7目录用户挂载镜像文件
[root@localhost ftp]# ls                 //查看
centos7  pub                             //创建成功
[root@localhost ftp]# mount /dev/sr0 /var/ftp/centos7/     //将镜像文件挂载到ftp站点中centos7目录
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ftp]# df -hT                               //查看磁盘信息
文件系统       类型      容量  已用  可用 已用% 挂载点
/dev/sda2      xfs        20G  3.7G   17G   19% /
devtmpfs       devtmpfs  898M     0  898M    0% /dev
tmpfs          tmpfs     912M     0  912M    0% /dev/shm
tmpfs          tmpfs     912M  9.0M  903M    1% /run
tmpfs          tmpfs     912M     0  912M    0% /sys/fs/cgroup
/dev/sda5      xfs        10G   37M   10G    1% /home
/dev/sda1      xfs       6.0G  174M  5.9G    3% /boot
tmpfs          tmpfs     183M   28K  183M    1% /run/user/0
/dev/sr0       iso9660   4.3G  4.3G     0  100% /var/ftp/centos7     //成功挂载
[root@localhost ftp]# cd centos7/           //进入centos7目录
[root@localhost centos7]# ls                //查看挂载的镜像信息
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL
[root@localhost centos7]# cd images/     //进入images目录
[root@localhost images]# ls              //查看目录信息
efiboot.img  pxeboot  TRANS.TBL
[root@localhost images]# cd pxeboot/     //进入pxeboot目录
[root@localhost pxeboot]# ls              //查看目录信息
initrd.img  TRANS.TBL  vmlinuz           //压缩内核与系统初始化文件
[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/  //将压缩内核与系统初始化文件添加入tdtp站点
[root@localhost pxeboot]# ls /var/lib/tftpboot/     //查看tftp站点信息
initrd.img  pxelinux.0  vmlinuz                      //成功添加压缩内核与系统初始化文件

7、在tftp站点中添加启动菜单,完成后,开启dhcp、tftp、ftp服务,并关闭防火墙、增强性安全功能

[root@localhost pxeboot]# cd /var/lib/tftpboot/      //进入tftp站点
[root@localhost tftpboot]# ls                        //查看站点信息
initrd.img  pxelinux.0  vmlinuz                      
[root@localhost tftpboot]# mkdir pxelinux.cfg        //在站点中添加启动菜单目录,注意:目录名不可写错
[root@localhost tftpboot]# ls                        //查看目录
initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz        //成功创建启动菜单目录
[root@localhost tftpboot]# cd pxelinux.cfg/          //进入创建的启动菜单目录
[root@localhost pxelinux.cfg]# vim default           //编辑启动菜单文件
default auto                             //默认模式
prompt 1                                 //等待时间1秒
                                                         //编写配置文件模板
label auto                             
        kernel vmlinuz                  //内核信息
        append initrd=initrd.img method=ftp://192.168.100.100/centos7   
                                        //加载系统初始化文件,模式为ftp,存放目录为centos7
label linux text
        kernel vmlinuz
        append text initrd=initrd.img method=ftp://192.168.100.100/centos7

label linux rescue                          //进入急救模式
        kernel vmlinuz                
        append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
~                                                                                                             
~                                                                                       
:wq         //编写完成后保存退出
[root@localhost pxelinux.cfg]# systemctl start dhcpd           //启动dhcp服务
[root@localhost pxelinux.cfg]# systemctl start tftp            //启动tftp服务
[root@localhost pxelinux.cfg]# systemctl start vsftpd          //启动ftp服务
[root@localhost pxelinux.cfg]# systemctl stop firewalld.service    //关闭防火墙功能
[root@localhost pxelinux.cfg]# setenforce 0                        //关闭增强性安全功能

8、验证PXE网络部署装机,打开配置的虚拟机,在开机界面按ESC键,进入boot模式,选择从网络启动

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

关于kickstart

kickstart无人值守技术

  • 创建应答文件,预先定义好各种安装设置
  • 免去交互设置过程,从而实现全自动化安装
  • 通过添加%post脚本,完成安装后的各种配置操作

Demo

1、在CentOS 7中安装kickstart服务软件

[root@localhost pxelinux.cfg]# yum install system-config-kickstart -y   //安装kickstart软件
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 system-config-kickstart.noarch.0.2.9.7-1.el7 将被 安装
...//省略部分内容...
已安装:
  system-config-kickstart.noarch 0:2.9.7-1.el7                                                                  
作为依赖被安装:
  gnome-python2.x86_64 0:2.28.1-14.el7                   gnome-python2-canvas.x86_64 0:2.28.1-14.el7         
  libart_lgpl.x86_64 0:2.3.21-10.el7                     libgnomecanvas.x86_64 0:2.30.3-8.el7                 
  rarian.x86_64 0:0.8.1-11.el7                           rarian-compat.x86_64 0:0.8.1-11.el7                 
  system-config-date.noarch 0:1.10.6-3.el7.centos        system-config-date-docs.noarch 0:1.0.11-4.el7       
  system-config-keyboard.noarch 0:1.4.0-5.el7            system-config-keyboard-base.noarch 0:1.4.0-5.el7    
  system-config-language.noarch 0:1.4.0-9.el7            usermode-gtk.x86_64 0:1.111-5.el7                      
完毕!

2、安装完成后在图像化界面打开kickstart服务软件

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

3、打开软件后首先设置基本配置

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

4、设置安装方法与引导装载程序选项

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》
《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

5、设置分区信息

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

6、设置网卡配置

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

7、配置安装后脚本信息

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

8、完成后将配置好的文件信息保存到FTP站点中

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

9、保存完成后关闭软件,打开终端,进入ftp站点查看保存的文件,进入查看文件,并在模板中添加需要的组件安装包。

[root@localhost ~]# cd /var/ftp      //进入ftp站点
[root@localhost ftp]# ls             //查看目录信息
centos7  ks.cfg  pub
[root@localhost ftp]# vim ks.cfg      //进入编辑模式查看保存的模板信息
platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$QnfXQpTo$2SWg34gaOZQoLWy.bGlmd/        //root用户密钥模板
# Use network installation
url --url="ftp://192.168.100.100/centos7"         //安装路径模板
# System language
lang zh_CN                                         //设置的键盘模式
# Firewall configuration
firewall --disabled
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --enforcing

# Network information
network  --bootproto=dhcp --device=ens33            //设置的网卡信息
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --location=none
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="xfs" --size=500            //磁盘分区设置模板
part /home --fstype="xfs" --size=4096
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --grow --size=1    
:q                        //退出模板
[root@localhost ftp]# cd /root                   //进入root用户家目录
[root@localhost ~]# ls                           //查看家目录信息
anaconda-ks.cfg       公共  视频  文档  音乐        //找到anaconda-ks.cfg模板
initial-setup-ks.cfg  模板  图片  下载  桌面
[root@localhost ~]# vim anaconda-ks.cfg           //进入编辑anaconda-ks.cfg模板
...//省略部分内容...
%packages
@^gnome-desktop-environment
@base
@core
@desktop-debugging
@dial-up
@directory-client
@fonts
@gnome-desktop
@guest-agents                     //找到此部分信息并复制
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
chrony
kexec-tools

%end
...//省略部分内容...
:q                        //退出
[root@localhost ~]# vim /var/ftp/ks.cfg             //进入ftp站点,编辑ks.cfg文件
part /boot --fstype="xfs" --size=500
part /home --fstype="xfs" --size=4096
part swap --fstype="swap" --size=4096
part / --fstype="xfs" --grow --size=1

%packages
@^gnome-desktop-environment
@base
@core
@desktop-debugging
@dial-up
@directory-client
@fonts                                           //在下行粘贴此部分内容
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@java-platform
@multimedia
@network-file-system-client
@networkmanager-submodules
@print-client
@x11
chrony
kexec-tools

%end
~                                                                                      
:wq                                            //保存退出

10、在tftp站点启动菜单文件中添加ks.cfg文件引导条目。

[root@localhost ~]# cd /var/lib/tftpboot/             //进入tftp站点
[root@localhost tftpboot]# ls                         //查看站点信息
initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz
[root@localhost tftpboot]# cd pxelinux.cfg/           //进入目录
[root@localhost pxelinux.cfg]# ls
default
[root@localhost pxelinux.cfg]# vim default            //进入编辑启动菜单文件 
default auto
prompt 1

label auto
        kernel vmlinuz              //添加ks=ftp://192.168.100.100/ks.cfg条目使装机时系统可以读取ks.cfg模板内容
        append initrd=initrd.img method=ftp://192.168.100.100/centos7 ks=ftp://192.168.100.100/ks.cfg

label linux text
        kernel vmlinuz
        append text initrd=initrd.img method=ftp://192.168.100.100/centos7

label linux rescue
        kernel vmlinuz
        append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
:wq                                     //保存退出

11、配置一台新的虚拟机,网卡设置为仅主机模式,然后验证PXE部署装机+kickstart无人值守装机。

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

《详解CentOS 7中PXE高效批量网络装机与kickstart无人值守技术》

    原文作者:SiceLc
    原文地址: https://blog.51cto.com/14473285/2437273
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞