PXE network installed

Source: Internet
Author: User
Tags file transfer protocol

PXE network installed
Introductionin a large-scale Linux application environment, such as Web clustering, distributed computing, and so on, servers often do notwith an optical drive device, how do I install a system for dozens of or even hundreds of servers in a bare-metal quick installation? Traditionalthe installation method of USB optical drive, mobile hard drive and so on is obviously difficult. using PXE-based (pre-bootexecutionenvironment, pre-boot execution Environment) technologynetwork installed method, and combined with Kickstart configuration for unattended automatic installation.
1. Deploying the PXE Remote Installation servicePXE is a network boot technology developed by Intel Corporation that works in Client/server mode, allowing clients to passDownload the boot image from the remote server and load the installation files or the entire operating system. To build PXEnetwork system, must meet the following prerequisites:? the client's network card supports the PXE protocol (integrated B00trom chip), and the motherboard supports network booting. ? There is a DHCP server in the network to automatically assign the address to the client and specify the boot file location.? The server provides guided mirrors via TFTP (Trivial file Transfer Protocol, simple Document Transfer Protocol)Download the file. The first condition is actually a hardware requirement, and currently almost all servers and most PCs are able toThis support is provided by simply allowing booting from the network or LAN in the BIOS setup. 1.1 Building a PXE Remote installation serverIn this example, the PXE Remote Installation service area integrates the CentOS6.4 installation source, the TFTP service, the DHCP service, the ability to send PXE boot programs to the client, the Linux kernel, the boot menu, and other data, as well as the installation files. 1) Prepare CentOS6.4 installation Source [email protected] ~]# mount/dev/cdrom/mnt<== Insert the disc and Mount itMount:block Device/dev/sr0 is write-protected, mounting read-only [email protected] ~]# yum-y Install vsftpd<== Installing the FTP service
[email protected] ~]# mkdir/var/ftp/centos6.4<== creating a System image directory [email protected] ~]# cp-rf/mnt/*/var/ftp/centos6.4<== Copy all files under the/mnt directory to the FTP shared/var/ftp/centos6.4 directory [email protected] ~]# service vsftpd Restart<= Starting the FTP service

2) Install and enable the TFTP service [email protected] ~]# yum-y install Tftp-server
[email protected] ~]# vim/etc/xinetd.d/tftp
Service tftp{        socket_type              = dgram        protocol                 = UDP   &NBSP;//TFTP with UDP transport protocol          wait                     = yes        user                     = root         server                   =/usr/sbin/in.tftpd               server_args             =-s/var/lib/tftpboot      //Specify the TFTP root directory         disable                  =No<== change "yes" to "no", enable TFTP service Per_source = one CPS = 2 flags = IPv4} [[Email protected] ~]# service xinetd start
[[Email protected] ~]# service iptables stop<== shutting down the firewall

3) Prepare the Linux kernel, initialize the image files for the PXE network installation of the Linux kernel, initialize the image files can be obtained from the CentOS6.4 system CD, respectively, Vmlinuz and Initrd.img, located in the folder Images/pxeboot. Locate the two files and copy them to the root directory of the TFTP service. [Email protected] ~]# cd/mnt/images/pxeboot/
[email protected] pxeboot]# CP vmlinuz initrd.img/var/lib/tftpboot/

4) Boot PXE boot program, boot menu file for PXE network installation boot program for pxelinux.0, provided by package syslinux. Install the package syslinux, and then copy the file pxelinux.0 to the root directory of the TFTP service. [email protected] ~]# yum-y install Syslinux
[email protected] ~]# cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
The boot menu is used to instruct the client's installation process, including how to invoke the kernel and how to load the initialization image. The default boot menu file defaults and should be placed in the PXELINUX.CFG subdirectory of the TFTP root directory, and a typical boot menu configuration can be set up manually by referring to the following actions. [email protected] ~]# mkdir/var/lib/tftpboot/pxelinux.cfg [email protected] ~]# Vim/var/lib/tftpboot/pxelinux.cfg/defaultDefault Auto <== Specifies that prompt 1 <==1 is waiting for the user to control the label auto<== graphical Installation (default)Kernel vmlinuz append initrd=initrd.img devfs=nomount ramdisk_size=8192label linux Text<== Text InstallationKernel vmlinuz Append text initrd=initrd.img devfs=nomount Ramdisk_size=8192label Linux Rescue<== Rescue ModeKernel vmlinuz Append rescue initrd=initrd.img devfs=nomount ramdisk_size=8192
5) Install and enable the DHCP service because the PXE client is usually bare-metal from the system, the DHCP service needs to be preconfigured to automatically assign the address and inform the boot file location in order to get in touch with the server and properly download the relevant boot file. If the IP address of the PXE server is 192.168.1.10,DHCP address pool is 192.168.1.10--192.168.1.200, you can build a DHCP server by referencing the following actions. [[email protected] ~]# yum-y install DHCP
[email protected] ~]# vim/etc/dhcp/dhcpd.confDdns-update-style Interim; <== represents the dynamic information update mode of the DHCP server and DNS server ignore client-updates;<==Ignore client update subnet 192.168.1.0 netmask 255.255.255.0 {<==This means that the network segment where I assigned the IP address is 192.168.1.0 The subnet mask is 255.255.255.0 range 192.168.1.100 192.168.1.200;<==The range of leased IP addresses option domain-name-servers ns.example.org;  Option Domain-name "example.org"; Option routers 192.168.1.10;<==The router address, here is the IP address of the current DHCP machine, option Subnet-mask 255.255.255.0;<==Subnet mask Default-lease-time 600;<==Default lease time Max-lease-time 7200;<==Maximum lease time next-server 192.168.1.10;<==Specify the TFTP server addressFileName "pxelinux.0";<==Specify the PXE bootstrapper file name} [email protected] dhcp]# VIM/ETC/RC.D/INIT.D/DHCPDUser=dhcpd<== change to "root" userGroup=dhcpd<== change to "root" user
#如果DHCP服务器有多快网络, modify the monitor NIC to eth0 [email protected] ~]# VIM/ETC/SYSCONFIG/DHCPDDhcpdargs= "Eth0" [[Email protected] ~]# service DHCPD start

6) Verify that the PXE network installation is set up after the PXE Remote installation server, you can use the client to install the test. For newly purchased servers or PC bare metal, no additional settings are generally required; to reload a system for a host that already has a system, you may need to modify the BIOS settings, set Boot first to "NETWORK" or "LAN", and then restart the host. If the server is configured correctly, network connectivity, PXE support is not a problem, the client restarts automatically configures the IP address, then obtains the bootstrapper pxelinux.0 from the TFTP server, and prompts the user to specify the boot entry according to the boot menu configuration, as follows:
Pressing the ENTER key directly after the prompt string "boot:" (or performing "Auto") will enter the default graphical installation entry, and if you execute "Linux text", enter the text installation portal, and if you execute "Linux Rescue" enter rescue mode. Select the language, keyboard type, and then prompt the user to specify the installation media, using "URL",
When you are prompted to configure TCP/IP, the IPV4 setting accepts the default DHCP acquisition, and IPV6 support should be canceled, and then in the URL Setup dialog box, the URL path to the CentOS installation source:
After confirmation, automatically download the installation files over the network and enter the graphical installer, if you can succeed to this step, it means that the PXE network installation is basically no problem.




2. Implement Kickstart unattended Installation 1. Prepare the installation answer fileAfter installing the System-config-kickstart tool in a Linux system, you can configure the setup answer file with the Graphical Wizard tool. [email protected] ~]# yum-y Install system-config-kickstart*
1) Configure the installation answer parameters through the Desktop menu "Application"-"System Tools"-"kickstart" to open the Kickstart configuration program, in the Kickstart configuration program, you can for basic information, installation methods, boot options, partition information, The network configuration and other installation settings are specified.

2) basic information and installation method "Basic information" set the default language to "English", Time zoneSet as "Asia/shanghai", set the root password to "qwe.123" and Tick "reboot the system after installation". in the Installation Method dialog box, the Cettos installation source should be specified correctly, if a userverification information must also be specified.
3) partition information in the Partition Information dialog box, you need to properly plan the partitioning scheme, for example, you can divide a 500MB/bootpartition, 4GB home partition, 2GB swap partition will be divided into the remaining space to the root partition, if sufficient disk space can be flexibly adjusted according to the actual situation.
4) In the Network Configuration dialog box, add a network device "eth0",set the network type to "DHCP ".
in the Firewall configuration dialog box, you can choose to disable SELinux and disable the firewall.

5) Package Selectionin the Package Selection dialog box, select the package groups you want to install, depending on your actual needs. For example, you can selectBasic World Wide Web Server, X Window System, font, desktop, and development tools,text Support "and so on.

6) Installation Scriptin pre-install scripts, thepost-Installation Scripts dialog box, you can add them separately before installing theexecutable statements that run in a dynamic operation. This setting makes it easier to automate the configuration of the server, such as enabling customers toThe automatic setup of the YM warehouse after the installation is complete, it is important to ensure that the code you write is properly executed to prevent the installation from failing.
Without special requirements, you only need to keep the default settings in the boot loader, verify, display configuration, pre-install scripts, post-Install Scripts dialog boxes.

2. Save the Auto answer fileClick the Kickstart configuration program's file-save menu, specify the destination folder, file name, and save the configured answer parameters as a text file, such as/root/ks.cfg. To modify this answer configuration later, you can either open it in the Kickstart configuration program or modify it directly with a text editing tool such as Vim. [email protected] ~]# grep-v ^#/root/ks.cfg
Firewall--disabledinstallurl--url= "Ftp://192.168.1.10/yum" Rootpw--iscrypted $1$pp2myxoo$. 2yjxunbzayru05lrfp.p.auth--useshadow--passalgo=sha512graphicalfirstboot--disablekeyboard Uslang en_USselinux-- Disabledlogging--level=inforeboottimezone asia/shanghainetwork--bootproto=dhcp--device=eth0--onboot= Onbootloader--location=mbrzerombrclearpart--all part/boot--fstype= "Ext4"--size=500part/home--fstype= "Ext4"-- Size=4096part/--fstype= "EXT4"--grow--size=1
3. Implement batch automatic machineWith an auto-installed answer file, you can implement a network-based batch auto-loader as long as you place it in the FTP directory of the PXE installation server and modify the boot menu appropriately. 1) Start the auto answer file on the PXE Remote installation server, copy the established answer file to the/var/ftp/centos6.4 directory so that the client can access it through ftp://192.168.1.10/centos6.4/ks.cfg. Then edit the boot menu file default, add the KS boot parameter to specify the URL path of the ks.cfg answer file. [email protected] ~]# cp/root/ks.cfg/var/ftp/centos6.4/ks.cfg
[email protected] ~]# mkdir/var/lib/tftpboot/pxelinux.cfg
[email protected] ~]# Vim/var/lib/tftpboot/pxelinux.cfg/default
Default autoprompt 0label auto kernel vmlinuz appendks=ftp://192.168.1.10/centos6.4/ks.cfgInitrd=initrd.img Devfs=nomount ramdisk_size=8192
2) After verifying that the unattended installation initiates an auto-answer installation, each time the client is booted in PXE, the Ks.cfg answer profile is automatically downloaded, and then the CentOS6.4 system is installed based on the settings, without manual intervention.





































































From for notes (Wiz)

PXE network installed

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.