|
First. Introduction
1.1 What is PXE
PXE (Pre-boot Execution Environment, Pre-Boot Execution Environment) is the latest technology developed by Intel, working in network mode Client / Server, and support for workstations through the network from a remote server to download the image, and thereby support the network boot operations system during startup, the terminal requires the server to assign IP addresses, and then TFTP (trivial file transfer protocol) or MTFTP (multicast trivial file transfer protocol) protocol to download a software package to start the machine's memory executed by the startup software complete basic terminal software settings to boot the operating system pre-installed on the terminal server.
Strictly speaking, PXE installation is not a way, but a boot mode. PXE installation of the necessary conditions is to be installed on the computer must contain a PXE support for NIC (NIC), namely card must have a PXE Client. PXE protocol allows the computer to boot through the network. This protocol is divided into Client-side and Server-side, and PXE Client in the card ROM. When the computer boots, BIOS into memory to perform PXE Client, and then by the PXE Client will be placed at the distal end of the file is downloaded to run locally through a network. Run PXE protocol need to set up a DHCP server and TFTP server. DHCP server will PXE Client (to be installed in the host system) assigned an IP address, because it is assigned to the PXE Client IP address when configuring DHCP server need to add the appropriate PXE settings. In addition, the PXE Client of the ROM, already exists TFTP Client, then it may be the TFTP Server TFTP protocol to download the files.
PXE working process:
1. PXE Client from their PXE boot NIC, to obtain a copy of this IP network DHCP server;
2. DHCP server returns the client allocated to the IP and place the PXE file (the file is usually placed on a TFTP server);
3. PXE Client Request pxelinux.0 file to this network TFTP server;
After the implementation of the document made pxelinux.0 4. PXE Client Files;
5. The results of the implementation of pxelinux.0, loading the kernel and file system via TFTP server;
6. Enter the installation screen, then you can choose one of HTTP, FTP, NFS way to install;
1.2 What are Kickstart
Kickstart is a way to install unattended. It works by recording typical manual intervention is required to fill in various parameters during installation, and generates a file named ks.cfg. If (not limited to generating Kickstart installation file machines) the situation appears to fill in the parameters of the installation process, the installer will first go to find Kickstart files generated, if the appropriate parameters to find, on the use of parameters found; if not found appropriate parameters, the installer will need to manually intervened. So, if Kickstart file covers all the parameters required to complete the installation process may appear, then the installer can only tell the installer where to take the ks.cfg file, then go do your own thing. Such as the installation, the installation program will be based ks.cfg settings restart the system and complete the installation.
Second, the system environment
Experimental environment: VMware Workstation 10
Platform: CentOS release 6.4 (minimum installation)
Network Mode: NAT mode (shared host's IP address)
DHCP / TFTP IP: 192.168.111.130
HTTP / FTP / NFS IP: 192.168.111.130
Firewall off / iptables: Firewall is not running.
SELINUX = disabled
Third, the preparatory work
Generate ks.cfg file requires system-config-kickstart tool, and this tool relies on X Windows, so we need to install X Windows and Desktop and reboot the system, as follows:
# Yum groupinstall "X Window System"
# Yum groupinstall Desktop
# Reboot
Fourth, configure HTTP installation
Installation of the system can select HTTP, FTP, NFS, HTTP us here installation methods, install the other two methods, we can own Baidu.
4.1 install and configure HTTP
# Yum install httpd -y
# Rpm -qa | grep httpd
Open Services and set the boot
# /etc/init.d/httpd Start
# Chkconfig --level 35 httpd on
4.2 ISO image loading
ISO image settings are loaded in the virtual machine.
4.3 copy the entire contents of the disc to http root directory / var / www / html / under
# Cp -r / mnt / cdrom / / var / www / html /
HTTP part set.
5, configuration TFTP
5.1 Installing tftp-server
# Yum install tftp-server -y
5.2 Enable tftp service
# Vi /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s / var / lib / tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Will disable set to no
5.3 Start tftp service
Because the tftp service is mounted under xinetd super process, so to start the tftp service by starting xinetd.
# /etc/init.d/xinetd Restart
Setting boot xinetd
# Chkconfig xinetd on
Sixth, configuration support PXE boot program
6.1 pxelinux.0 copy files to / var / lib / tftpboot / folder
# Cp /usr/share/syslinux/pxelinux.0 / var / lib / tftpboot /
Description: syslinux is a very powerful boot loader, and is compatible with a variety of media. More precisely: SYSLINUX is a small Linux operating system, which is intended to simplify the installation of Linux first time, and the establishment of repair or other special-purpose boot disks.
6.2 Copy iso mirror and vmlinux of /image/pxeboot/initrd.img to / var / lib / tftpboot / folder
# Cp /var/www/html/cdrom/images/pxeboot/{initrd.img,vmlinuz} / var / lib / tftpboot /
6.3 iso image copy of /isolinux/*.msg to / var / lib / tftpboot / folder
# Cp /var/www/html/cdrom/isolinux/*.msg / var / lib / tftpboot /
6.4 pxelinux.cfg a new directory in / var / lib / tftpboot / in
# Mkdir /var/lib/tftpboot/pxelinux.cfg
6.5 iso image in the / isolinux directory isolinux.cfg pxelinux.cfg copied to the directory, and change the file name to default
# Cp /var/www/html/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
6.6 modify the default file
# Vi /var/lib/tftpboot/pxelinux.cfg/default
default ks # is enabled by default 'label ks' marked boot kernel
prompt 1 # show 'boot:' prompt. When '0' is not prompt, it will directly start 'default' parameter specifies.
timeout 6 # before the user input timeout in 1/10 seconds.
display boot.msg # displays the path contents of a file, note the file. The default is in the / var / lib / tftpboot / directory. You can also specify bit similar '/install/boot.msg' this path + file name.
The documents show that after F1 boot.msg # Press 'F1' such key.
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux # 'label' you specified in the 'boot:' prompt enter the keyword, such as boot: linux [ENTER], this starts the kernel and initrd.img files under 'label linux' tag.
kernel vmlinuz #kernel parameter specifies the start of the kernel.
append initrd = initrd.img #append specify additional kernel parameters, parameters can be appended to the kernel in grub in use here also can be used.
label text
kernel vmlinuz
append initrd = initrd.img text
label ks
kernel vmlinuz
append ks = http: //192.168.111.130/ks.cfg initrd = initrd.img # tell the system where to get ks.cfg file
label local
localboot 1
label memtest86
kernel memtest
append -
VII. Configuring DHCP
7.1 Installing the DHCP Service
# Yum -y install dhcp
7.2 Copy configuration template file to the DHCP configuration directory
# Cp -f /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
7.3 /etc/dhcp/dhcpd.conf modify the configuration file, as follows:
ddns-update-style interim;
ignore client-updates;
filename "pxelinux.0"; #pxelinux startup file location;
next-server 192.168.111.130; IP address of #TFTP Server;
subnet 192.168.111.0 netmask 255.255.255.0 {
option routers 192.168.111.130;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.111.100 192.168.111.200;
default-lease-time 21600;
max-lease-time 43200;
}
7.4 start the DHCP service
# /etc/init.d/dhcpd Start
Eight generate ks.cfg file
8.1 Kickstart installation
# Yum install system-config-kickstart
8.2 Configuration Kickstart desktop environment
Start X Windows environment
# Startx
Configuration Kickstart
# System-config-kickstart
A. Setting the language, keyboard, time zone, Root password, installed after the restart and the like.
B. Set installation, this article describes the installation of HTTP methods, so choose HTTP
C. Installation MBR
D. Set partition
E. Subdivision Overview
F. Configure Network
G. Authentication
H. SELinux and firewall configuration
I. graphical environment configuration
J. package installation options
K. Preview
L. generate ks.cfg file, stored in / var / www / html / folder
/var/www/html/ks.cfg We can open the file for viewing and making changes.
platform = x86, AMD64, or Intel EM64T
# Version = DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url = http: //192.168.111.130/cdrom/ # This option tells Setup: cdrom file server 192.168.111.130 to the HTTP folder under the root directory of the installation media to find
# Root password
rootpw --iscrypted $ 1 $ vsvtP. / e $ 6PVMNfJd.shq2LgFJjYfA1
# System authorization information
auth --useshadow --enablemd5
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level = info
# Reboot after installation
reboot
# System timezone
timezone --isUtc Asia / Shanghai
# Network information
network --bootproto = dhcp --device = eth0 --onboot = on
# System bootloader configuration
key --skip
bootloader --append = "rhgb quiet" --location = mbr --driveorder = sda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --fstype = "ext4" --size = 8192
part swap --fstype = "swap" --size = 1024
part / home --fstype = "ext4" --size = 2048
% Packages
@base
% End
Description: key --skip if Red Hat system, this option can skip entering the serial number of the process; if it is CentOS series, you can not retain the contents of this;
reboot This option must exist, it must also be set in the position paper, or kickstart displays a message and waits for the user to press any key after reboot;
clearpart --all --initlabel this command must be added, otherwise the system will let the user choose whether to clear all the data manually, which requires human intervention, and thus lead to an automated process to fail;
IX test installation
Automated Installation system configuration is complete, start following a new machine to test the network connection mode select NAT mode.
Start the virtual machine, select the card from the start, DHCP server is to assign IP addresses to clients. |
|
|
|