Linux-based PXE implementation of system Automation deployment

Source: Internet
Author: User
Tags file transfer protocol

First, preface:

Typically, the way the computer installs the operating system is primarily, CD-ROM installation and U -disk installation; In an enterprise production environment, you will need to install a Linux operating system on multiple clients or servers , and if you install it in a conventional way, it is time- consuming and laborious; the PXE batch deployment system can perform such work efficiently.


Second, the principle:

Installing with a disc (mirrored) Linux Operating system process:POST(Power On Self Test)-- Boot sequence ( discover boot CD-ROM or U-disk via Biso )-- Bootloader(kernel+ramdisk)-->anaconda(installation program)


1 , automating the environment required for deploying servers:

PXE:preboot Execute environment, pre-Boot execution environment, NIC supports PXE bootrom;

DHCP:dynamic hostconfiguration Protocol, Host Provisioning Protocol , IP address for clients;

TFTP:Trivial files Transfer Protocol, Simple File Transfer Protocol, provide the client with boot boot files and kernel boot files;

xinetd : Super daemon, used to wake up TFTP Service ;

HTTP : Hypertext Transfer Protocol , Hypertext Transfer Protocol, providing the client with Kickstart documentation and installation sources;

Kickstart : System automation installation script;

Syslinux : provide pxelinux.0 file for boot boot, equivalent to bootloader ;

Install the boot file: On the system installation CD;

Operating system CD or Image: Installation source;


2 , implementation process:

pxe adopt C/s Service Schema:

  1 client : Client power-on self-test via bios Found support for pxe NIC, then pxe bootrom Broadcast requests are sent to the network to dhcp server request ip address;

  2 server : The server receives a broadcast that provides the client with a ip address and tftp server ip address, tftp contains pxe bootrom files required by the bootstrapper;

3 ), Client : the client will TFTP the server sends a download request to download the bootloader file;

4 ), Server : TFTP The server receives the request, transmits the bootloader file;


Third, the experimental process:

1 , the experimental premise:

1), Client:

Network card support PXE;


2), Server:

Configure static IP address;

# Vim/etc/sysconfig/network-scripts/ifcfg-eth: Modify the network configuration file; # service Networkrestart: Restart the network service;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/D1/wKiom1WpN77T0cmkAACS_sIFga8773.jpg "title=" 1.jpg " alt= "Wkiom1wpn77t0cmkaacs_sifga8773.jpg"/>


turn off the firewall and SELinux;

# chkconfig Iptables off: Firewall settings boot off; # service iptables stop: Light than Firewall service; # Setenforce 0: Close selinux;# vim/etc/selinux /conf: Modify the SELinux configuration file;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/CE/wKioL1WpOerhjkoaAADsS8QRKIY533.jpg "title=" 2.jpg " alt= "Wkiol1wpoerhjkoaaadss8qrkiy533.jpg"/>


well configured YUM Source, and install the required packages:DHCP,tftp-server,xinted,httpd, System-config-kickstart,syslinux;

# Mount-o loop/mnt/hgfs/lin/centos-6.6-x86_64-bin-dvd1.iso/media/cdrom/: Mount disc image; # Vim/etc/yum.repos.d/centos.repo : Configure the Yum repository location; # yum Install DHCP tftp-server xinted httpd system-config-kickstartsyslinux–y: Install related service packages;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/D1/wKiom1WpOFSjgMv7AAAygFNhp-g079.jpg "title=" 3.jpg " alt= "Wkiom1wpofsjgmv7aaaygfnhp-g079.jpg"/>


2 , DHCP Service configuration:

#/etc/dhcp/dhcpd.conf: master config file; #/usr/share/doc/dhcp-**/dhcpd.conf.sample: Can be modified by reference to the secondary master profile template;


# Cp/etc/dhcp/dhcpd.conf/etc/dhcp/dhcpd.conf.backup: Back up the original configuration file; # cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/ dhcp/dhcpd.conf: Template Overwrite the original configuration file; # vim/etc/dhcp/dhcpd.conf: Modify the configuration file;


Global configuration:

>option domain-name "chencer.org";    : Configure domain name >option domain-name-servers 192.168.1.2;    : Configure DNS server address >default-lease-time 3600;    : Default lease time in seconds; >max-lease-time 86400; : Maximum lease time, unit seconds;


Address pool configuration:

>subnet 192.168.1.0 netmask255.255.255.0 {> range 192.168.1.1 192.168.1.100;    : Configure address Pool range;> option routers 192.168.1.1;    : Gateway configuration;> next-server 192.168.1.2;    : Configure the TFTP server address;> filename "pxelinux.0"; : Configure the PXE boot file;}

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/CE/wKioL1WpO2GD23IsAABZq7BU0bM350.jpg "title=" 4.jpg " alt= "Wkiol1wpo2gd23isaabzq7bu0bm350.jpg"/>



# SERVICEDHCPD Configtest: Edit complete, save exit, check config file syntax; # chkconfig DHCPD on: Set boot boot; # service DHCPD {Start|restart}: Start or restart Service; # SS–UNL: Check the listening port; dhcpd monitor on UDP port 67th;


3 , TFTP Service configuration:

1),xinetd configuration:

# vim/etc/xinetd.d/tftp:xinetd is the Super daemon of the TFTP service, modify the configuration file;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/D1/wKiom1WpOe7wWbZaAAEUS0hcTaQ879.jpg "title=" 5.jpg " alt= "Wkiom1wpoe7wwbzaaaeus0hctaq879.jpg"/>



2), provide the boot file for the TFTP service:

# cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/: Provides a boot PXE working environment for the TFTP server; # cp/media/cdrom/images/pxeboot/{ vmlinuz,initrd.img}/var/lib/tftpboot/: Provide kernel and ramdisk;# cp/media/cdrom/isolinux/{boot.msg,splash.jpg, Vesamenu.c32}/var/lib/tftpboot: Provides the installation menu frame;


# mkdir-p/var/lib/tftpboot/pxelinux.cfg# cp/media/cdrom/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/ default# Vim/var/lib/tftpboot/pxelinux.cfg/default

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/D1/wKiom1WpOlCzpKwSAAJ6RaQfUhs027.jpg "title=" 6.jpg " alt= "Wkiom1wpolczpkwsaaj6raqfuhs027.jpg"/>

# tree/var/lib/tftpboot/: Check file integrity;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/CE/wKioL1WpPEvgmohQAAB1RaXbg1U102.jpg "title=" 7.jpg " alt= "Wkiol1wppevgmohqaab1raxbg1u102.jpg"/>



3), start the service:

# Chkconfig xinetd on: Set boot up, # service xinetd {Start|restart}: Start or restart xinetd service; # ss–unl: View listening port; TFTP monitor on UDP port 69th;


4 , http Service configuration:

1), provide the installation source:

# mkdir/var/www/html/centos6.6: Create the installation source directory, # mount--bind/media/cdrom//var/www/html/centos6.6/: Mount the image to the installation source directory;

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/D1/wKiom1WpOsrgJuw1AAC8N7TWri4241.jpg "title=" 8.jpg " alt= "Wkiom1wposrgjuw1aac8n7twri4241.jpg"/>


2), provide kickstart file:

# System-config-kickstart: Create Kickstart file with graphical interface tool saved in/var/www/html/ks.cfg;# Vim-o/root/anaconda-ks.cfg/var/www/html /KS.CFG: Can be modified by reference to/ROOT/ANACONDA-KS.CFG;


Add or modify the following two lines to specify the installation source location:

>url--url=http://192.168.1.2/centos6.6>repo--name= "CentOS"--baseurl=http://192.168.1.2/centos6.6--cost= 100

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/D1/wKiom1WpOxKSyN5LAAIbjqHD-Ds024.jpg "title=" 9.jpg " alt= "Wkiom1wpoxksyn5laaibjqhd-ds024.jpg"/>


3), start the service:

# chkconfig httpd on: Set up service boot # services httpd {Start|restart}: Start or restart service; # SS–TNL:HTTPD monitor on TCP port 80th;


Iv. Client Testing:

the BIOS is set to network card first:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/CE/wKioL1WpPR_yvz97AAHIMfUpa8k902.jpg "title=" 10.jpg "alt=" Wkiol1wppr_yvz97aahimfupa8k902.jpg "/>

Installation Menu Interface:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/CE/wKioL1WpPSjRu1ElAAGJ30wMHgo133.jpg "title=" 11.jpg "alt=" Wkiol1wppsjru1elaagj30wmhgo133.jpg "/>

Installing:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/D1/wKiom1WpO1TThBqlAAFVl-7T-64527.jpg "title=" 12.jpg "alt=" Wkiom1wpo1tthbqlaafvl-7t-64527.jpg "/>


This article is from the "Pony Learning Record" blog, make sure to keep this source http://masachencer.blog.51cto.com/8683770/1675847

Linux-based PXE implementation of system Automation deployment

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.