Pre-boot eXecution Environment
PXE-client 集成在网卡里
DHCP Server
# cat /etc/dhcp/dhcpd.conf # yum install -y dhcp # systemctl start dhcpd # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.example # see dhcpd.conf(5) man page subnet 172.16.21.0 netmask 255.255.255.0 { range 172.16.21.128 172.16.21.163; option domain-name-servers 114.114.114.114; option routers 172.16.21.2; default-lease-time 600; max-lease-time 7200; next-server 172.16.21.8; filename "pxelinux.0";#网卡引导程序,相当于说明书 }
TFTP-引导程序下载,port 69
#yum install -y tftp-server #/var/lib/ftfpboot #systemctl start tftp
pexlinux.0-二进制,由软件产生
- 查询需要安装什么软件
[root@cent ~]# yum provides */pxelinux.0 #查询什么程序产生pxelinux.0 Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.sjtu.edu.cn * extras: ftp.sjtu.edu.cn * updates: ftp.sjtu.edu.cn syslinux-4.05-15.el7.x86_64 : Simple kernel loader which boots from a FAT filesystem Repo : base Matched from: Filename : /usr/share/syslinux/pxelinux.0 syslinux-tftpboot-4.05-15.el7.noarch : SYSLINUX modules in /var/lib/tftpboot, available for network booting Repo : base Matched from: Filename : /var/lib/tftpboot/pxelinux.0 syslinux-4.05-15.el7.x86_64 : Simple kernel loader which boots from a FAT filesystem Repo : @base Matched from: Filename : /usr/share/syslinux/pxelinux.0
安装syslinux or syslinx-tfpboot
[root@cent ~]# yum install syslinux -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: ftp.sjtu.edu.cn * extras: ftp.sjtu.edu.cn * updates: ftp.sjtu.edu.cn Package syslinux-4.05-15.el7.x86_64 already installed and latest version Nothing to do [root@cent ~]# rpm -ql syslinux | grep pxelinux /usr/share/doc/syslinux-4.05/pxelinux.txt /usr/share/syslinux/gpxelinux.0 /usr/share/syslinux/gpxelinuxk.0 /usr/share/syslinux/pxelinux.0 [root@cent ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
pxelinux.0 要求读取菜单内容在:/var/lib/tftpboot/pxelinux.cfg/default
#利用安装ISO的菜单文件,mount /dev/sr0 /mnt [root@cent isolinux]# cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default [root@cent isolinux]# pwd /mnt/isolinux
- 图形模块vesamenu.c32(使用syslinux-ftfp-boot会自动生成)和背景模块splash.png
[root@cent isolinux]# cp splash.png /var/lib/tftpboot/
- 启动内核,启动硬件模块 vmlinuz / initrd.img
[root@cent isolinux]# cp vmlinuz initrd.img /var/lib/tftpboot/
- 修改菜单文件
1 default vesamenu.c32 #加载图形模块 2 timeout 600 #单位1/10秒,即60s 10 menu background splash.png #背景图片 61 label linux 62 menu label ^Install CentOS 7 - 2009 #^I 颜色不同,表示快捷键I,直接到这个选择 menu default #默认读秒 63 kernel vmlinuz #加载启动内核 64 append initrd=initrd.img #加载驱动程序,网络启动后面删除 inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet
HTTP(FTP/NFS),yum 源-提供软件包
install httpd
挂载安装光盘
[root@cent isolinux]# mkdir /var/www/html/centos7 [root@cent isolinux]# mount /dev/cdrom /var/www/html/centos7/ #也可以使用cp 将cdrom的内容copy到centos7目录 cp /mnt/* /var/www/html/centos7
部署无人值守安装—应答文件
使用system-config-kickstart生成应答文件(yum install system-config-kickstart)
如果出现乱码:LANG=en system-config-kickstart
修改yum repo base的名字,否则package selection为灰色(官方bug,只能用development这个名字)
安装方法
boot loader
磁盘分区
网络配置-eth0
必选包
脚本按需
生成应答文件
修改菜单
[root@cent isolinux]# cp ~/ks-centos7.cfg /var/www/html/ [root@cent isolinux]# vim /var/lib/tftpboot/pxelinux.cfg/default ------ label linux menu label ^Install CentOS 7 - 2009 menu default kernel vmlinuz append initrd=initrd.img ks=http://172.16.21.8/ks-centos7.cfg
总结:
- dhcp—>IP地址 next-server filename(pxelinux.0)
- tftp—>pxelinux.0
- pxelinux.0—>菜单文件 default
- default—>图形模块 背景图片 内核 驱动程序 ks.cfg
- ks.cfg—>....分区 软件包选择等配置 修改菜单文件–url="http://192.168.4.7/centos7"
注意,客户端的内存要大于1.5G,使用1G内存是会报错:
[ 118.553728] dracut-initqueue[720]: missing codepage or helper program, or other error
1595369 – rhel 7.5 installation fails with 1GB ram (redhat.com)