How to install RHEL5 in batches using PXE + Kickstart

Source: Internet
Author: User

This document describes how to use Kickstart for unattended installation and how to set up a RHCE lab environment. The environment used in this article is RHEL 5, which is also applicable to CentOS. Andrew Yu, author of the article, is an experienced Linux/Unix system engineer who once worked as a RHCE lecturer for a while.

Principles and concepts

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 NIC supported by PXE. PXE Pre-boot Execution Environment (preboot 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 host where the PXE client will install the system. Because the IP address is assigned to the PXE client, you must add the 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, it is not limited to the machine that generates the KickStart Installation File.) When a parameter is 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.

PXE + KickStart installation conditions

The devices required for executing PXE + KickStart installation are:

Installation Steps

1. Install httpd

yum -y install httpd*

Ii. Mount the RHEL5 DVDAnd copy all the content files and folders on the first CD to/var/html/www.

mount /dev/cdrom   /mntcp –rf   /mnt/*   /var/html/www

3. Install tftp-serverAnd enable the tftp service to restart the xinetd process.

Rpm-ivh tftp-server-0.39-1.i386.rpmvi/etc/xinetd. d/tftp # default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. the tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp {socket_type = dgram protocol = udp wait = yes user = root server =/usr/sbin/in. tftpd server_args =-s/tftpboot disable = no # The direct change of disable from yes to no per_source = 11 cps = 100 2 flags = IPv4} service xinetd restart

Iv. Configuration support for PXE startup

Note that I have copied the content of the first CD to the/var/www/html directory, so I only need to copy the required files from the/var/ftp directory, however, during the description, I still indicated the actual location of the file. For example, in which file is on the DVD, I copied the file from the/var/www/html directory, you can also learn from me.

1. Go to the tftpboot folder and create one if there is no such folder.

cd /tftpboot/

2. Copy pxelinux.0 to/tftpboot /.

cp /usr/lib/syslinux/pxelinux.0 /tftpboot

3. Copy/image/pxeboot/initrd. img and vmlinux to/tftpboot /.

      cp /var/ftp/image/pxeboot/initrd.img   /tftpboot      cp /var/ftp/image/pxeboot/vmlinux   /tftpboot

4. Copy the isolinux/*. msg on the first installation disc to/tftpboot /.

cp /var/ftp/isolinux/*.msg   /tftpboot

5. Create a New pxelinux. cfg directory in tftpboot.

mkdir pxelinux.cfg

6. Copy the isolinux. cfg file in the isolinux directory on the first installation CD of Linux to the pxelinux. cfg directory, and change the file name to default.

cd pxelinux.cfgcp /var/ftp/isolinux/isolinux.cfg   /tftpboot/pxelinux.cfg/default

7. In the previous step, do not modify the default file. In fact, when this step is reached, I will be able to boot through the network. After network boot, I will be able to install it manually. But here we will discuss unattended installation, the so-called unattended installation does not need to be manually specified from boot to installation. Next we will continue to explain.

6. Install the dhcp serviceAnd modify the configuration at the same time.

1. Installation

rpm -ivh dhcp-3.0.1-12_EL.i386.rpm

2. Copy the configuration template file to the specified directory and rename it.

cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf

3. modify the configuration file and add a line: filename "/pxelinux.0". You can complete other modifications by yourself. Pay attention to the location of this file, otherwise it will fail, remember

[Root @ localhost isolinux] # vim/etc/dhcpd. confddns-update-style interim; ignore client-updates; next-server 192.168.1.14; # PXE server IP Address
Filename "/pxelinux.0"; # Pay Attention to the location of the row. If it is written under subnet, it will fail.

Subnet 192.168.1.0 netmask 255.255.255.0 {

# --- Default gateway
Option routers 192.168.1.254;
Option subnet-mask limit 255.0;

Option nis-domain "example.com ";
Option domain-name "example.com ";
Option domain-name-servers 192.168.1.254;

Option time-offset-18000; # Eastern Standard Time
# Option ntp-servers 192.168.1.1;
# Option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- You understand Netbios very well
# Option netbios-node-type 2;

Range dynamic-bootp 192.168.1.128 192.168.1.254;
Default-lease-time 21600;
Max-lease-time 43200;

# We want the nameserver to appear at a fixed address
# Host ns {
# Next-server marvin.redhat.com;
# Hardware ethernet 12: 34: 56: 78: AB: CD;
# Fixed-address 192.168.1.110;
#}
}

4. Start the dhcp service.

service dhcp start

7. install and configure kickstart

First install Kickstart:

rpm -ivh system-config-kickstart-2.5.16-2.noarch.rpm

The command to configure kickstart in gnome is as follows:

system-config-kickstart

The subsequent configuration steps are as follows:

8. Modify the/tftpboot/pxelinux. cfg/default file, Specifying the ks. cfg read method ks = http: // 192.168.1.40/ks. cfg)

Vi/tftpboot/pxelinux. cfg/defaultauth -- useshadow -- enablemd5key -- skip # This line must be skipped, otherwise, the bootloader -- location = mbrclearpart-all-initlabeltextfirewall -- disabledfirstboot -- disablekeyboard uslang en_USlogging -- level = infourl -- url = http: // 192.168.1.14/network -- bootproto = dhcp -- device = eth0 -- onboot = onrebootrootpw -- iscrypted $1 $ HEJKfwF9 $ encrypt -- disabledtimezone -- isUtc Asia/Shanghai -- defaultdesktop = GNOME-depth = 8 -- resolution = 640x480part swap -- bytes-per-inode = 4096 -- fstype = "swap" -- size = 512 part/boot -- bytes-per-inode = 4096 -- fstype-"ext3" -- size = 200 part/-- bytes-per-inode = 4096 -- fstype = "ext3" -- grow -- size = 1% packages @ cluster-storage @ mysql @ development-libs @ editors @ text-internet @ x-software-development @ virtualization @ legacy-network-server @ dns-server @ gnome-desktop @ dialup @ core @ base @ ftp-server @ network-server @ clustering @ java-development @ base-x @ chinese-support @ web-server @ smb-server @ printing @ admin-tools @ development-tools @ graphical-internetkmod-gnbd-xenkmod-gfs-xenperl-Convert-ASN1perl-Crypt-SSLeaymesa-libGLU-develtftp-serverkexec-toolsbridge-utilsdevice-mapper-multipathypservopenldap-serversvnc-serverdhcpxorg-x11-server-Xnestxort-x11-server-Xvfbimakegcc-objcexpect

Finally, reboot the installation. The above is my configuration step. If there is no access, it will be successful!

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.