Unattended automatic installation of Linux systems

Source: Internet
Author: User
Tags manual writing


Overview of PXE Fundamentals

What is PXE?

PXE:pre-boot executionenvironment Pre-Boot execution Environment

technology developed by Intel Corporation

work in the network mode of C/s

The Client downloads the image from the server over the network and boots the operating system over the network

Application Scenarios

LiveOS

OS Installation

PxeFundamentals

1 Client sends an IP address request message to DHCP on the PXE Server, and DHCP detects whether the client is legitimate (primarily detection Client 's network card MAC address), if valid , return the IP address of the client, and transmit the location information of the boot file pxelinux.0 to Client

2 Client sends a pxelinux.0 request message to tftp on the PXE Server , andtftp receives the message and then to the client Send pxelinux.0 size information, test client satisfaction, when TFTP received the client sent back the consent size information, formally to the client Send pxelinux.0

3 Client executes the received pxelinux.0 file

4 Client sends a configuration information file for this computer ( under the Pxelinux.cfg directory of the TFTP service ) to the TFTP Server , whichis sent back to the configuration file by tftp client , and then the client performs subsequent operations based on the configuration file.

5 client sends the Linux kernel request information to tftp, and the kernel file is sent to the client after TFTP receives the message

6 The Client sends the root file request information to TFTP, and theTFTP receives the message and returns to the Linux Genwen

Parts system

7 Client starts the Linux kernel

8 Client Download the installation source file, read the automated installation script


650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/06/D9/wKiom1m_cuOj2QXUAAAxdsOKPSg638.png "title=" PXE fundamentals. png "alt=" Wkiom1m_cuoj2qxuaaaxdsokpsg638.png "/>

building an automated installation systemPxeService


preparatory work

shutting down firewalls and seLinux

[Email protected] ~]# iptables-f

[Email protected] ~]# Setenforce 0

ConfigurationDhcpServer

[[email protected] ~]# yum-y Install DHCP

[Email protected] ~]# cat/etc/dhcp/dhcpd.conf

Subnet 192.168.10.0 netmask 255.255.255.0{

Range 192.168.10.100 192.168.10.200;

Next-server 192.168.10.1; #TFTP server address

FileName "pxelinux.0"; #Bootstrap文件名称

}

[Email protected] ~]# systemctl restart DHCPD

CreateKiskstartfile

Kickstart files can be generated in three ways:

Manual Writing

with the System-config-kickstart graphical tool

Anaconda Setup is automatically generated

[Roo[email protected] ~]# Yum install-y system-config-kickstart

[email protected] ~]# System-config-kickstart Start Kickstart Graphical Tools

After startup follow the same custom build file as the installation system interface is no longer elaborated here.

Note: centos7.3 If you do a Yum source with a disc image, there is a situation where the bread cannot be selected

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/A5/89/wKioL1m_cv_i-oaqAAD6aBAJsKU787.png "title=" Pxe1.png "width=" 692 "height=" 582 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:692px;height:582px; "alt=" WKIOL1M_CV _i-oaqaad6abajsku787.png "/>

You need to modify the Yum warehouse name to development to Select the installation package.


[Email protected] ~]# Cat/etc/yum.repos.d/base.repo

[Development] # This place is modified to Development

Name=zachary

Baseurl=file:///mnt/cdrom

Gpgcheck=0


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/06/D9/wKiom1m_c0Xx8juDAAGS-XdXG7c743.png "title=" Pxe2.png "style=" width:692px;height:435px; "width=" 692 "height=" 435 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" wKiom1m_ C0xx8judaags-xdxg7c743.png "/>

generates a ks.cfg file according to the Graphics Wizard .

installationSyslinuxPackage

[Email protected] ~]# yum-y install Syslinux

ConfigurationFtpServer

This step can use other types of servers, such as NFS or http

# installation FTP Server

[Email protected] ~]# yum-y install VSFTPD

# Configure the software repositories required to install the system

[[email protected] ~]# mkdir-pv/var/ftp/pub/centos/{6,7}

[Email protected] ~]# MOUNT/DEV/SR0/VAR/FTP/PUB/CENTOS/7

[Email protected] ~]# MOUNT/DEV/SR1/VAR/FTP/PUB/CENTOS/6

[Email protected] ~]# Mkdir–v/var/ftp/pub/ks

[Email protected] ~]# MV Ks6.cfg ks7.cfg/var/ftp/pub/ks/ks.cfg

[email protected] ks]# chmod +r/var/ftp/pub/ks/* # Note Permissions

Note: After the configuration is complete FTP in the software warehouse, be sure to verify that the warehouse is available (browser view)

TftpServer Configuration

[Email protected] ~]# yum-y install Tftp-server

[Email protected] ~]# CP/USR/SHARE/SYSLINUX/{PXELINUX.0,MENU.C32}/var/lib/tftpboot/

[[email protected] ~]# mkdir–v/var/lib/tftpboot/{pxelinux.cfg,centos7.3,centos6.9}

[Email protected] ~]# cp-v/var/ftp/pub/centos/7/isolinux/{vmlinuz,initrd.img}/var/lib/tftpboot/centos7.3/

[Email protected] ~]# cp-v/var/ftp/pub/centos/6/isolinux/{vmlinuz,initrd.img}/var/lib/tftpboot/centos6.9/

[[email protected] pxelinux.cfg]# cat Default

Default Menu.c32

Timeout 300

Menu title ########## PXE Boot Menu ##########

Label centos6.9

Menu Label ^kickstart Inatall CentOS 6.9

Menu default

Kernel Centos6.9/vmlinuz

Append ks=ftp://192.168.10.3/pub/ks/ks6.cfg initrd=centos6.9/initrd.img

Label centos7.3

Menu label ^kickstart Inatall CentOS 7.3

Menu default

Kernel Centos7.3/vmlinuz

Append ks=ftp://192.168.10.3/pub/ks/ks7.cfg initrd=centos7.3/initrd.img

Note: If you use CENTOS6 to build PXE Server, TFTP by xinetd Services to manage this non-independent service.

set up related services to start

[Email protected] ~]# Systemctl enable Dhcpd.service

[Email protected] ~]# systemctl start Dhcpd.service

[Email protected] ~]# Systemctl enable Tftp.socket

[Email protected] ~]# systemctl start Tftp.socket

[Email protected] ~]# Systemctl enable Vsftpd.service

[Email protected] ~]# systemctl start Vsftpd.service

Test


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/A5/89/wKioL1m_c2uAGaxfAAAVt_ejZcI229.png "style=" float : none; "title=" Pxe3.png "alt=" Wkiol1m_c2uagaxfaaavt_ejzci229.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/06/D9/wKiom1m_c5ySdR0sAAASw0f4Qis017.png "style=" width : 692px;height:313px; "title=" Pxe4.png "width=" 692 "height=" 313 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" wKiom1m_ C5ysdr0saaasw0f4qis017.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/06/D9/wKiom1m_c5zjIoXQAAAUGZrY8tg472.png "style=" width : 692px;height:357px; "title=" Pxe5.png "width=" 692 "height=" 357 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" wKiom1m_ C5zjioxqaaaugzry8tg472.png "/>



line up the wrong idea

each server's troubleshooting during testing is based on its original and returned error messages. PXE is no exception.

1 To install the operating system using PXE, the client must first have a piece of network adapter that supports PXEA installation.

2 Nic gets the IP address . Nic to properly obtain the IP address and TFTP server address (next-sever), you need to check the DHCP configuration options.

3 The following are some common scenarios where the TFTP service cannot be used afterproper IP address acquisition

The Next-server address in the DHCP configuration file does not match the address.

firewalls and SELinux do not allow access to TFTP, which can be configured accordingly. The simple method is to close directly.

there is an error in the TFTP configuration, which can be checked through this directory tree structure

[Email protected] tftpboot]# tree

.

├──centos6.9

│?? ├──initrd.img

│?? └──vmlinuz

├──centos7.3

│?? ├──initrd.img

│?? └──vmlinuz

├──menu.c32

├──pxelinux.0

└──pxelinux.cfg

├──default

4 After the menu file appears, there is basically nothing much to do with TFTP . If an error occurs, the kernel option is a parameter problem, or a mirrored warehouse problem. and a problem with the KS file. If the process of building a software warehouse during the detailed examination of the step, generally there will not be a big mistake.

Problems generally occur in permissions issues, path problems .

5 Special reminder: in TFTP the kernel files in the server and Ramfs be sure to align with the installation image.


This article is from the "Keep Simple Keep Stupid" blog, make sure to keep this source http://yangzhiheng.blog.51cto.com/11586378/1966365

Unattended automatic installation of Linux systems

Related Article

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.