CentOS7 Unattended Installation Pxe+dhcp+tftp+syslinux+http+kickstart

Source: Internet
Author: User

Working principle:

1. PXE (Preboot execution Environment) client sends a request to DHCP, sets the client's BIOS to PXE boot, and sends a broadcast request to UDP via PXE bootrom (self-booting chip). Obtain information such as an IP address from a DHCP server on your network.

2. The DHCP server receives a request from the client to verify that it is coming to a legitimate PXE client request and verifies that it will give the client a "provide" response, which includes the IP address assigned to the client, the Pxelinux Boot program (TFTP) location, And where the configuration file is located.

3, the PXE client requests the download startup file the client receives a "response" from the server and responds to a frame to request the file to be sent for the boot. These boot files include: pxelinux.0, Pxelinux.cfg/default, Vmlinuz, initrd.img, and so on.

4, the boot server responds to client requests and transmits files, when the server receives the client's request, they will have more information between the client and the server to answer, to determine the startup parameters. Bootrom The files (pxelinux.0, pxelinux.cfg/default) that are necessary to launch the Setup program from the boot server by the TFTP communication protocol. When the default file download is complete, the boot kernel of the Linux installer is started based on the boot order defined in the file.

5, request to download the automatic answer file after the client successfully booted the Linux installation kernel through the Pxelinux.cfg/default file, the installer must first determine what installation media to install the Linux, if it is installed over the network (NFS, FTP, HTTP), The network is initialized at this time and the location of the installation source is located. Perhaps you would say that PXE has not already acquired the IP address? Why do we need it again? This is because PXE obtains the installed kernel as well as the installer, and the Setup program obtains the binary packages and configuration files required to install the system. Because they require different content, the PXE module and the installer are relatively independent, and the PXE network configuration is not passed to the installer. This allows you to get the IP address process two times. It then reads the location of the auto answer file ks.cfg specified in the file and downloads the file based on that location request.

6, the client installation operating system will download the Ks.cfg file back, through the file to find the OS Server, and follow the configuration request of the file to download the installation process required packages. After the OS server and the client establish a connection, the transfer package begins and the client begins to install the operating system. After the installation is complete, you will be prompted to reboot the computer.

Required Components:

http: Used to install file network transport

TFTP: For uploading kernels, entry programs, etc.

DHCP: For dynamic IP assignment

pxelinux.0: Installing the System Entry program

Kickstart: Personalized CENTOS7 configuration

Server Configuration
    1. Installing the HTTPD Package

Yum Install-y httpd

Vim/etc/httpd/conf/httpd.conf

ServerName 192.168.200.101:80

Systemctl Start httpd

Systemctl Enable httpd

2. Boot automatically mount RHEL7.0 ISO CD

Mkdir/var/www/html/source

Mount-o Ro/dev/sr0/var/www/html/source

Vim/etc/fstab

Add the following line to automatically mount the CD-ROM ISO file:

/dev/sr0/var/www/html/source iso9660 Defaults 0 0

3. Install the Tftp-server and xinetd packages.

Yum install-y xinetd Tftp-server

To modify the TFTP configuration file:

Vim/etc/xinetd.d/tftp

Disable = no

Systemctl Start xinetd

Systemctl Enable xinetd

Ss-ntlu|grep 69

UDP unconn 0 0 *:69 *:*

4. Install and configure the DHCP service

Yum install-y DHCP

To modify a DHCP configuration file:

Vim/etc/dhcp/dhcpd.conf

Subnet 192.168.200.0 netmask 255.255.255.0 {

Range 192.168.200.200 192.168.200.250;

Option routers 192.168.200.2;

Option Domain-name-servers 119.29.29.29, 114.114.114.114;

Default-lease-time 36000;

Max-lease-time 72000;

Next-server 192.168.200.101;

FileName "pxelinux.0";

}

To start the DHCP service:

dhcpd

Systemctl start DHCPD

Systemctl Enable DHCPD

Ss-ntlu|grep 67

UDP unconn 0 0 *:67 *:*

5. Configure the PXE boot support:

The first step is to install the Syslinux package.

Yum Install-y syslinux

To copy the files required for PXE boot:

cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

cp/var/www/html/source/images/pxeboot/initrd.img/var/lib/tftpboot/

cp/var/www/html/source/images/pxeboot/vmlinuz/var/lib/tftpboot/

cp/var/www/html/source/isolinux/boot.msg/var/lib/tftpboot/

cp/var/www/html/source/isolinux/splash.png/var/lib/tftpboot/

cp/var/www/html/source/isolinux/vesamenu.c32/var/lib/tftpboot/

mkdir/var/lib/tftpboot/pxelinux.cfg/

Cp/var/www/html/source/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default

chmod U+w/var/lib/tftpboot/pxelinux.cfg/default

To modify the storage address of the default file configuration ks.cfg:

Vim/var/lib/tftpboot/pxelinux.cfg/default

6. Enter the X Windows graphics environment and install the configuration kickstart.

Init 5

Yum Install-y System-config-kickstart

Generate the Ks.cfg file:

System-config-kickstart

    • Based on content configuration language and root password, etc.

    • Select HTTP installation, enter the server IP and directory
    • Boot setup options.

    • Partition information, create three partitions that are/boot,swap and/or root partitions, respectively.

    • Network configuration, network type Select DHCP, device name select Ens32.

    • Verify that no changes are required by default.
    • Firewall settings.

Display configuration, select the installation graphics environment

    • Generate the CFG file and save it to the/var/www/html directory.
    • Vim/var/www/html/ks.cfg

      At the end, add

      %packages

      @base

      @core

      %end

      KS.CFG Syntax Detection

      Ksvalidator/var/www/html/ks.cfg

    • Client Configuration

      Create a new virtual machine and set it to boot from the network card

The memory is too teenager unable to start the Setup program

CentOS7 Unattended Installation Pxe+dhcp+tftp+syslinux+http+kickstart

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.