学习
路无止境!

没有伞的孩子要学会努力奔跑!


  • 首页

  • 归档

  • 关于我

  • 公益404

  • 搜索

CentOS 7 PXE Install

Pre-boot eXecution Environment

PXE-client 集成在网卡里

1519C23E-3602-4A31-9EA9-959F002E5201.jpeg

  1. 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";#网卡引导程序,相当于说明书
    
    }
    
  2. 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
    

    Untitled

    Untitled

  3. HTTP(FTP/NFS),yum 源-提供软件包

    1. install httpd

    2. 挂载安装光盘

      [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
      

      Untitled

  4. 部署无人值守安装—应答文件

    1. 使用system-config-kickstart生成应答文件(yum install system-config-kickstart)

    2. 如果出现乱码:LANG=en system-config-kickstart

    3. 修改yum repo base的名字,否则package selection为灰色(官方bug,只能用development这个名字)

      Untitled

      Untitled

      Untitled

    4. 安装方法

      Untitled

    5. boot loader

      Untitled

    6. 磁盘分区

      Untitled

    7. 网络配置-eth0

      Untitled

    8. 必选包

      Untitled

    9. 脚本按需

      Untitled

    10. 生成应答文件

    11. 修改菜单

      [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
      

    总结:

    1. dhcp—>IP地址 next-server filename(pxelinux.0)
    2. tftp—>pxelinux.0
    3. pxelinux.0—>菜单文件 default
    4. default—>图形模块 背景图片 内核 驱动程序 ks.cfg
    5. 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)

  • 文章目录
  • 站点概览
Etaon

Etaon

Kepp Going!

80 日志
15 分类
43 标签
GitHub CSDN
友情链接
  • Kubernetes
  • Cisco
  • W3School
  • 廖雪峰
标签云
  • Mysql
  • Aws
  • Dql
  • Hadoop
  • Kubernetes
  • Nsx t
  • Redis
  • Azure
  • Cicd
  • Git
  • Pre-boot eXecution Environment
© 2010 - 2023 路无止境!
Powered by - Hugo v0.101.0 / Theme by - NexT
/
Storage by Azure static web apps /
0%