First, PXE Introduction
PXE (Pre-Boot execution Environment, pre-boot execution Environment) is the latest technology developed by Intel Corporation, working in the Client/server network mode, enabling workstations to download images from remote servers over the network, This supports booting the operating system over the network, and during the boot process, the terminal requires the server to assign an IP address, then TFTP (trivial File Transfer Protocol) or MTFTP (Multicast trivial file transfer Protocol) protocol to download a boot package into native memory executed by this boot package to complete the terminal basic software setup, thus booting the terminal operating system preinstalled in the server.
Strictly speaking, PXE is not a way to install, but a way to boot. A requirement for a PXE installation is that a PXE-supported network card (NIC) must be included on the computer to be installed, that is, the PXE Client must be in the network card. The PXE protocol enables a computer to boot over the network. This protocol is divided between the client side and the Server side, while the PXE client is in the ROM of the NIC. When the computer boots, the BIOS directs the PXE client into memory and then the files that are placed at the remote end by the PXE client are downloaded locally to run on the network. Running the PXE protocol requires setting up a DHCP server and a TFTP server. The DHCP server assigns an IP address to the PXE client (the host that will install the system), and because it assigns an IP address to the PXE client, the appropriate PXE settings need to be added when configuring the DHCP server. In addition, the TFTP client already exists in the PXE client ROM, so it can download the required files via the TFTP protocol to the TFTP Server.
Second, the PXE working process:
1. The PXE Client starts from its own PXE network card and requests IP from the DHCP server in the network (for the first time), provided the BIOS turns on the PXE function and the local network card supports the PXE function;
2. The DHCP server returns the IP assigned to the client (the second time) and the location of the PXE file (which is typically placed on a TFTP server);
3. The PXE Client requests the pxelinux.0 file from the TFTP server in the network;
4. The PXE Client obtains the pxelinux.0 file after the implementation of the file;
5. Load the kernel and file system via the TFTP server based on the results of pxelinux.0 execution;
6. Enter the installation screen, which can be installed by selecting one of the HTTP, FTP, and NFS modes;
Detailed workflow, please refer to the following picture:
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/82/73/wKiom1dVbtaSd9ZDAACWbpzm8SU669.jpg "title=" PXE schematic diagram "alt=" Wkiom1dvbtasd9zdaacwbpzm8su669.jpg "/>
Iii. introduction of Kickstart
Kickstart is an unattended installation method. It works by documenting typical parameters that require manual intervention during the installation process and generating a file named Ks.cfg. If you have to fill in the parameters during the installation process (not limited to the machine that generated the Kickstart installation files), the installer will first look for the files generated by the kickstart, and if the appropriate parameters are found, use the found parameters; Need to be manually intervened by the installer. So, if the kickstart file covers all the parameters that may be required during installation, then the installer can simply tell the installer where to fetch the ks.cfg file and then go to work on it. When the installation is complete, the installer restarts the system according to the settings in the Ks.cfg and ends the installation.
Iv. implementation of Kickstart installation steps
Kickstart installations can be performed using local discs, local hard drives, or through nfs,ftp,http.
To use Kickstart, you must:
1. Create a kickstart file.
2. Create a boot media with kickstart files or make this file available on the network.
3. Prepare the installation tree.
4. Start Kickstart installation.
The flowchart is as follows:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/82/73/wKiom1dVcY-hFnHdAACjR3rNiLg920.jpg-wh_500x0-wm_3 -wmp_4-s_4147762560.jpg "title=" Kickstart Flowchart "alt=" Wkiom1dvcy-hfnhdaacjr3rnilg920.jpg-wh_50 "/>
V. Preparation of the experiment
Physical machine: Redhat 6.4 graphical
Ip:10.0.0.1/16
Lab Environment: VMware Workstation 10
System platform: Redhat 6.4 (minimized)
Network mode: NAT mode
Dhcp/tftp /FTP IP:10.0.0.2/16
PXE network boot is supported on all servers
purpose of implementation: fully automated batch installation of Linux systems by configuring Kickstart servers
Hardware and Software configuration: Network card to support PXE boot, the operating system also supports PXE boot, and the FTP server is used to store the operating system installation files, the DHCP server is used to assign IP.
vi. Specific deployment steps :
1. Turn off the firewall and SELinux
[Email protected] ~]# yum-y install dhcp* tftp* vsftpd* syslinux
2. Installation Complete Check Pack group
[Email protected]/]# Rpm-qa | grep dhcpdhcp-4.1.1-34.p1.el6.x86_64dhcp-common-4.1.1-34.p1.el6.x86_64[[email protected]/]# Rpm-qa | grep vsftpvsftpd-2.2.2-11.el6.x86_64[[email protected]/]# Rpm-qa | grep xinetdxinetd-2.3.14-38.el6.x86_64
3. Install the DHCP server
dhcp.conf Introduction:
Ddns-update-style interim: This is the dynamic acquisition of IP address. Must be put in the first item Wow. Ignore client-updates: Server-to-client transport related subnet: Gets the IP segment to be configured correctly. Routers: is the routing address range:dhcp the assigned IP segment. Next-server: Is the TFTP address. Allow booting BOOTP: Release transfer and protocol.
[[email protected] /]# cp -rf /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/ dhcp/dhcpd.conf[[email protected] /]# vim /etc/dhcp/dhcpd.conf subnet 10.0.0.0 netmask 255.255.0.0 { range dynamic-bootp 10.0.0.100 10.0.0.200; ---> This section represents the DHCP server support pxe next-server 10.0.0.2; filename "pxelinux.0"; --> most basic startup file //points to the root directory of Tftp-server Option domain-name-servers 10.0.0.2; option domain-name "Baidu.com"; #这两条是DNS, if there is no DNS do not write, the environment does not support the reverse solution, write a installation will be very slow default-lease-time 600; max-lease-time 7200; }
5. Start the service
[[Email protected]/]# service DHCPD startstarting dhcpd: [OK][[email Prote CTED]/]# service dhcpd STATUSDHCPD (PID 3490) is running ... [Email protected]/]# chkconfig dhcpd on
6. Check the Syslinux package group
[Email protected]/]# RPM-QL syslinux| grep pxelinux.0/usr/share/syslinux/gpxelinux.0/usr/share/syslinux/pxelinux.0[[email protected]/]#
7. Install and configure the Pxelinux.cfg file
[[email protected] /]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ Provide the required files for the boot menu (from the Isolinux directory on the RHEL6 CD-ROM) [[email protected] cdrom]# cp -rf isolinux/* /var/lib/tftpboot/[[email protected] cdrom]# ls /var/lib/tftpboot/boot.cat grub.conf isolinux.bin memtest splash.jpg Vesamenu.c32boot.msg initrd.img isolinux.cfg pxelinux.0 trans. tbl vmlinuz[[email protected] cdrom]# [[email protected] tftpboot]# pwd/var/lib/tftpboot[[email protected] tftpboot]# mkdir pxelinux.cfg[[email protected] tftpboot]# cp isolinux.cfg pxelinux.cfg/default[[email protected] tftpboot]# [[email protected] tftpboot]# lsboot.cat initrd.img memtest &nbSp; splash.jpg vmlinuzboot.msg isolinux.bin pxelinux.0 trans. Tblgrub.conf isolinux.cfg pxelinux.cfg vesamenu.c32[[email protected] tftpboot]# mkdir rhel6[[email protected] tftpboot]# cp vmlinuz Initrd.img rhel6/[[email protected] tftpboot]# ls rhel6/initrd.img vmlinuz [[email protected] tftpboot]# [[email protected] tftpboot]# vim Pxelinux.cfg/defaultlabel linux menu label ^install rhel6 <manual> menu default kernel rhel6/vmlinuz #kernel Parameters specify the kernel to start. append initrd=rhel6/initrd.img #append Specifies the parameters appended to the kernel that can be used in the grub parameters for the kernel, which can also be used here. Note: If you are installing multipleThe version image source creates a directory for each version under Tftpboot and specifies a different location under default.
8. Configuring the XINETD Service
TFTP configuration file Description:
Default: The use of TFTP in the establishment of the Transfer Protocol will go to the tftpboot to find files, nothing can be found after the default.
Tftp-server: This is for transmitting the boot file,
Initrd.img/vmlinux: Look for some work before installing. But TFTP is the protocol used to transfer these files.
9. Specific steps:
[[email protected] tftpboot]# vi /etc/xinetd.d/tftp service tftp{ disable = no socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/ In.tftpd server_args = -s /var/lib/tftpboot per_source = 11 cps = 100 2 flags = IPV4}
10. Start the service:
[[email protected] tftpboot]# chkconfig xinetd on[[email protected] tftpboot]# umount /mnt/cdrom/[[email protected] tftpboot]# mount /dev/cdrom /mnt/cdrommount: block device /dev/sr0 is write-protected, mounting read-only[[email protected] tftpboot]# cp -rf /mnt/cdrom/* /var/ftp/pub/[[email protected] tftpboot]# service vsftpd startstarting vsftpd for vsftpd: [ ok ][[email protected] tftpboot]# chkconfig vsftpd on[[email protected] tftpboot] #访问ftp里是否有镜像源, if there is an attempt to install, if you can install the package interface, the PXE installation is successful.
11. Network Structure:
As a schematic of the network installation environment, the installation environment consists of a local area network and a boot server connected to the local area network, an installation server, and the client to be installed, where the boot server and the installation server can be deployed on the same physical machine.
Service-related functions:
DHCPD: Distribute the IP address.
TFTPD: Distribute the boot file installation.
VSFTPD: Distribution System File installation.
1. Installing Kickstart
1. Create the Kickstart file on the 10.0.0.1 server
[[email protected] ~]# yum-y install System-config-kickstart The following options are required: Basic configuration Password reboot system text installation installation method FTP partition purge master boot Record network configuration add disable firewall
2. Configure the contents of the minimized installation file
[[email protected] ~]# vim/root/ks.cfg Find Packages section add @core, minimize installation%packages@core%endreboot
3. Put the good ks.cfg file in the PXE server
[[email protected] ~]# scp /root/ks.cfg [email protected]:/var/ftp/pub[email protected] ' s password: ks.cfg 100% 975 1.0kb/s 00:00 [[email protected] ~]# [[email protected] /]# vim /var/lib/tftpboot/pxelinux.cfg/ default label linux menu label ^install rhel6 <manual> menu default kernel rhel6/vmlinuz ks= #告诉系统 where to get ks.cfg files append initrd=rhel6/initrd.img
Kickstart the installation is complete.
Note: If the installation fails, the service is not up or the generation of kickstart has a problem, need to restart the build, to this time the experiment completed satisfactorily.
This article is from the "sub-non-fish" blog, please be sure to keep this source http://5323197.blog.51cto.com/5313197/1786744
Linux deployment pxe+kickstart Batch install Linux operating system implementation scenarios