I. Concepts and Principles
What is PXE?
Strictly speaking, PXE is not an installation method, but a boot method. A prerequisite for PXE installation is that the computer to be installed contains a network card (NIC) supported by PXE, that is, the network card must have a PXE Client. PXE (Pre-boot Execution Environment) Protocol enables the computer to start over the network. The Protocol is divided into client and server. The PXE client is in the ROM of the NIC. When the computer boots, the BIOS transfers the PXE client to the memory for execution, the PXE client downloads the files stored on the remote end to the local computer for running through the network. To run the PXE protocol, you must set the DHCP server and TFTP server. The DHCP server is used to assign an IP address to the PXE client (the host on which the system is to be installed). Because the IP address is assigned to the PXE client, you need to add relevant PXE settings when configuring the DHCP server. In addition, TFTP client already exists in the PXE Client ROM. The PXE Client uses the TFTP protocol to download the required files to the TFTP Server.
What is KickStart?
KickStart is an unattended installation method. The working principle of KickStart is to record various parameters required for manual intervention during a typical installation process and generate a file named ks. cfg file. In the subsequent installation process (not limited to the machine that generates the KickStart Installation File), when parameters are required, the installer first looks for the file generated by KickStart. When a proper parameter is found, the parameter is used. If no proper parameter is found, manual intervention is required by the installer. In this way, if the KickStart file covers all the parameters that need to be filled in during the installation process, the installer can only tell the installer where to get ks. cfg file, and then busy with your own affairs. After the installation is complete, the installer restarts the system based on the restart option set in ks. cfg and ends the installation.
II. Environment Description
Run pxe + kickstart to install the system in batches. the required environment is
1. DHCP server
2. TFTP Server
3. httpd server, ftp server, nfs server, and other servers that can provide File Access
4. ks. cfg file
5. pxelinux.0 file provided by syslinux
6. A host with a NIC supporting pxe Protocol
7. Disable firewall and selinux to ensure lab availability
Iii. Installation Steps
1) System Version
[root@station125 ~]# uname -r
2.6
.
32
-
431
.el6.x86_64
[root@station125 ~]# cat /etc/issue
CentOS release
6.5
(Final)
Kernel \r on an \m
a
2) configure the network environment and yum Source
The yum source used in this article is a local CD, with the IP address 192.168.1.20, subnet mask 255.255.255.0, and gateway 192.168.1.253.
Configuration file of yum Source
[root@station125 yum.repos.d]# cat media.repo
[base]
name=local media base
baseurl=file:
///mnt/cdrom
enabled=
1
gpgcheck=
0
[root@station125 ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr
00
:0C:
29
:E4:A8:B0
inet addr:
192.168
.
1.20
Bcast:
192.168
.
1.255
Mask:
255.255
.
255.0
inet6 addr: fe80::20c:29ff:fee4:a8b0/
64
Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:
1500
Metric:
1
RX packets:
2519
errors:
0
dropped:
0
overruns:
0
frame:
0
TX packets:
398
errors:
0
dropped:
0
overruns:
0
carrier:
0
collisions:
0
txqueuelen:
1000
RX bytes:
227897
(
222.5
KiB) TX bytes:
49799
(
48.6
KiB)
3) install the DHCP service
[Root @ station125 ~] # Yum install-y dhcp
Configure the dhcp server to provide the IP address 192.168.1.200-192.168.1.230. The subnet mask is 255.255.255.0.
Add the following content to/etc/dhcpd. conf. Note that the number must be added after each line. Otherwise, it will not succeed.
4) install the httpd service (this article provides services through http)
[Root @ station125 ~] # Yum install httpd-y
Http is only available to provide services without any configuration. The httpd configuration will be available soon.
Set httpd to auto start upon startup
[Root @ station125 ~] # Chkconfig httpd on
5) install the tftp-server
Root @ station125 ~] # Yum install tftp-server xinetd-y
Xinetd provides a daemon for tftp. Set xieted and tftp to start automatically and start the service.
[root@station125 ~]# chkconfig tftp on
[root@station125 ~]# chkconfig xinetd on
6) prepare the required rpm package
Attach a CD to the/var/www/html/wangfeng7399 directory.
[root@station125 ~]# mkdir /
var
/www/html/wangfeng7399
[root@station125 ~]# mount --bind /mnt/cdrom/ /
var
/www/html/wangfeng7399/
Start the httpd service
[root@station125 ~]# service httpd start
Starting httpd: httpd: apr_sockaddr_info_get() failed
for
station125.magelinux.com
httpd: Could not reliably determine the server's fully qualified domain name, using
127.0
.
0.1
for
ServerName
[ OK ]
7) Prepare the files under tftpboot.
Install syslinux. This service provides the pxelinux.0 file for pxe.
[Root @ station125 ~] # Yum install syslinux-y
Copy the files required for pxe startup to the tftp directory.
[root@station125 ~]# cp /
var
/www/html/wangfeng7399/images/pxeboot/{vmlinuz,initrd.img} /
var
/lib/tftpboot/
[root@station125 ~]# cp /
var
/www/html/wangfeng7399/isolinux/boot.msg /
var
/lib/tftpboot/
[root@station125 ~]# cp /
var
/www/html/wangfeng7399/isolinux/vesamenu.c32 /
var
/lib/tftpboot/
[root@station125 ~]# cp /
var
/www/html/wangfeng7399/isolinux/splash.jpg /
var
/lib/tftpboot/
[root@station125 ~]# cp /usr/share/syslinux/pxelinux.
0
/
var
/lib/tftpboot/
[root@station125 ~]# mkdir /
var
/lib/tftpboot/pxelinux.cfg
[root@station125 ~]# cp /
var
/www/html/wangfeng7399/isolinux/isolinux.cfg /
var
/lib/tftpboot/pxelinux.cfg/
default
Modify/var/lib/tftpboot/pxelinux. cfg/default
8) for the first test, test whether the system can be installed through pxe
9) provides the kictstart File
There are two ways to generate a kickstart file:
1. Copy the template/root/anaconda-ks.cfg. Then use vim to edit the configuration
2. Use system-config-kiskstart to generate, it is recommended to use the/root/anaconda-ks.cfg template to generate
This article is generated in the first way. Modify the parameters you need. For details about ks. cfg, go to my blog! Link address for http://wangfeng7399.blog.51cto.com/3518031/1369553
Copy the generated ks. cfg file to/var/www/html.
10) configure the Bootstrap program to automatically load the kictstart File
Modify the default file of/var/lib/tftpboot/pxelinux. cfg
Add the read permission to the ks. cfg file under/var/www/html
11) test and install
Test successful !!!!