Unattended automated installation

PXE unattended automated installation

lab environment

dhcp server:Cerntos7 192.168.10.121

tftp server:Centos7 192.168.10.121

vsftp server: Centso7 192.168.10.122
Note: firewall, selinux are closed, yum source is a local disc image

PXE

  • PXE: preboot execute environment (Pre-boot Environment), developed by Intel network boot technology, working on C / S architecture, network-based boot the client operating system installation. It allows the client to download the boot image from the remote server via a network, and load the entire file or install the entire operating system.
  • Dependence dhcp, tftp, file server (vsftpd, httpd, nfs, etc.), the client host adapters, also need support BOOTROOM chip, supports PXE related agreements.
  • dhcp assigned IP address and the boot file location specified.
  • tftp provide guidance downloaded image file
  • vsftpd download the operating system installation package, copy the contents of the disc in to the file server
  • Network boot Linux related software provided by syslinux, syslinux need to install the program, list of related documents syslinux program: / usr / share / syslinux

TFTP Service

  • Trivial File Transfer Protocol (Trivial File Transfer Protocol) network file based on a simple UDP transport protocol, port UDP 69
  • Belonging to the C / S architecture: client tftp, server program tftp-server, based daemon xinetd to run.

  • xinetd configuration file: /etc/xinetd.d/tftp
  • tftp server provides the client file to access the root directory: / var / lib / tftpboot

PXE installation workflow automation

  1. After the client boots broadcasts FIND frame of dhcp
  2. dhcp server receives the IP address assignment frame is enough, and returns the address of the TFTP server
  3. Client gets pxe boot files via tftp service, and will load the kernel image file to initialize memory to run
  4. Get auto-answer file by default start menu location specified in the file ks.cfg initiates a request to a server tftp
  5. tftp server automatically returns to its answer file ks.cfg
  6. Obtaining position by the automatic response system image file, according to automate the installation and configuration files

other

  • pxelinux.0: pxe boot program (provided by the program syslinux)
  • When the system starts the boot menu, point out to load the kernel image and inird mirror, and then guide: pxelinux.cfg / default.
  • vmlinuz: Linux kernel
  • initrd.img: Initialization image files, stored for some drivers during boot

Set up practice

  1. Set up a TFTP service

    • First, install the daemon xinetd (tftp services offer)

      image-20191105134847605

    • Installation tftp service

      image-20191105134932973

    • Modify the configuration file tftp

      image-20191105135804063

      image-20191105135911759

      service tftp
      {
              socket_type             = dgram
              protocol                = udp
              wait                    = no #不等待
              user                    = root
              server                  = /usr/sbin/in.tftpd
              server_args             = -s /var/lib/tftpboot #默认共享文件目录
              disable                 = no #是否不可以,no表示启用tftp
              per_source              = 11
              cps                     = 100 2
              flags                   = IPv4
      }
      
    • Start Service

      image-20191105135946571

  2. The required configuration files are placed tftp server shared directory

    • Where the kernel, image initialization, the boot menu

      image-20191105140210214

    • Install syslinux, and copy it came with pxe boot files to the shared directory

      image-20191105140526583

      image-20191105140557047

    • Cfg modify the boot menu file

      image-20191105140653737

      image-20191105140847878

      image-20191105150439394

      default linux #默认使用linux选项
      prompt 0 #是否提示  0不提示(不等待用户选择直接使用默认项) 1提示
      timeout 15 #延时
      
      label linux
        menu label ^Install CentOS 7
        kernel vmlinuz
        append initrd=initrd.img inst.ks=ftp://192.168.10.122/ks.cfg quiet  #附加参数,initrd指定初始化镜像文件位置,inst.ks指定kickstart自动应答文件位置

      Note: default Specifies the default startup items, it should be set to the installation key

      image-20191105141159431

    • Use the directory tree view structure

      image-20191105141230862

  3. Configuring DHCP Service Installation

    • install service

      image-20191105141451703

    • Modify the configuration file

      image-20191105141633821

      image-20191105144932197

      subnet 192.168.10.0 netmask 255.255.255.0 {
        range 192.168.10.10 192.168.10.60;
        option domain-name-servers 114.114.114.114;
        option domain-name "www.lg.com";
        option routers 192.168.10.2;
        default-lease-time 600;
        max-lease-time 7200;
        next-server 192.168.10.121  #TFTP服务器ip地址
        filename "pxelinux.0";  #pxe引导文件名
      }
    • Start Service

      image-20191105142221352

    • Client Test

      image-20191105144552127

  4. Installation configuration VSFTP Service

    • install service

      image-20191105150704967

    • Installation kickstart (for graphical production of auto-answer file, requires a graphical interface)

      image-20191105152117507

    • Start system-config-kickstart answer file to automatically generate graphical

      image-20191105152401861

      Set the default language, keyboard layout, time zone, root password, cpu architecture type, whether to restart after installation, whether text installation

      image-20191105152635699

      Specifies the installation for the new installation, specify the location of the system image file

      image-20191105152712377

      Specify the type of installation guide and other options

      image-20191105152741854

      Set partition configuration

      image-20191105152839603

      Add / boot partition

      image-20191105152958548

      Adding swap swap partition, swap do not need to choose a mount point

      image-20191105153041931

      Add / root partition

      image-20191105153104072

      After completion of the partition view the partition configuration

      image-20191105153121380

      Network configuration, specify when the need for additional network card configuration

      image-20191105153200856

      Password encryption to verify the configuration

      image-20191105153235733

      Firewall, SELinux configuration

      image-20191105153258872

      Display Configuration

      image-20191105153316374

      Select the packages to install, the name of the configuration file if the yum repository is not development will be the following errors

      image-20191105153402578

      Solution:

      image-20191105154005903

      image-20191105153945254

      Kickstart need to restart the program after modification

      image-20191105154332316

      Pre-installation configuration script execution

      image-20191105154347482

      After the installation is complete script execution configuration

      image-20191105154405292

      After the setup is complete, save the configuration file to the specified directory

      image-20191105154426414

      image-20191105154601269

      Placing vsftp shared directory files / var / ftp / under can

      image-20191105154837852

      image-20191105154854356
      Note: Use ksvalidator order to detect whether the auto-answer file syntax error

    • Mount the file system image to a shared directory under the ftp

      image-20191105151819983

  • Start Service

    image-20191105155039317

test

  • Create a test virtual machine

    image-20191105155227480

  • Power Test

    image-20191105160948613

    image-20191105155459713

    image-20191105162455748

    image-20191105155554186

    image-20191105160745382

Guess you like

Origin www.cnblogs.com/lastyear/p/11801176.html