Automated Installations of Multiple RHEL Distributions using PXE Server and Kickstart


In world of IT, efficiency is key. Whether it's managing a data center, deploying a new software update, or configuring new hardware, streamlining processes can make all difference. One of most important areas where this is true is in installation and configuration of operating systems. And when it comes to deploying multiple instances of Red Hat Enterprise Linux (RHEL), there's no better solution than automated installations using PXE server and Kickstart files.

What is PXE Server?

PXE (Preboot Execution Environment) is a network protocol that allows a computer to boot from a server on network. Essentially, it means that you can install an operating system on a computer without having to use a physical installation media such as a CD or USB drive. Instead, computer boots over network and downloads operating system image from server. PXE can be used with various operating systems, including RHEL, and it can be incredibly useful for large-scale deployments where time and efficiency are critical.

What is Kickstart?

Kickstart is a configuration file used to automate installation and configuration of RHEL. With Kickstart, you can specify all installation options in advance, including partitioning, package selection, and network configuration. When installation process begins, installer reads Kickstart file and automatically applies specified settings. This can be a real time-saver, especially when installing multiple instances of RHEL with same configuration.

Setting up PXE Server

To set up a PXE server, you'll need a few things. First, you'll need a server running Linux with enough disk space to store RHEL images. You'll also need a DHCP (Dynamic Host Configuration Protocol) server to assign IP addresses to client machines. Finally, you'll need a TFTP (Trivial File Transfer Protocol) server to transfer boot files to client machines.

The first step is to install necessary packages on your Linux server. You can do this using following command on a RHEL-based system −

yum install tftp-server syslinux httpd dhcp

Once packages are installed, you'll need to configure TFTP server to serve boot files. PXE boot process uses a combination of several boot files, including pxelinux.0, menu.c32, and vesamenu.c32. These files are included in syslinux package, which you installed earlier.

Copy these files to TFTP server directory using following command −

cp /usr/share/syslinux/{pxelinux.0,menu.c32,vesamenu.c32} /var/lib/tftpboot/

Next, you'll need to configure DHCP server to assign IP addresses to client machines. Edit /etc/dhcp/dhcpd.conf file and add following lines −

subnet 192.168.1.0 netmask 255.255.255.0 {
   range 192.168.1.100 192.168.1.200;
   option routers 192.168.1.1;
   option domain-name-servers 192.168.1.1;
   filename "pxelinux.0";
}

These lines define a subnet with a range of IP addresses to be assigned to client machines. "filename" option specifies name of boot file to be downloaded from TFTP server.

Finally, you'll need to configure HTTP server to serve RHEL images. Copy contents of RHEL DVD to document root of HTTP server, which is typically located at /var/www/html/.

Creating Kickstart File

Now that you have your PXE server set up, it's time to create Kickstart file.

The Kickstart file is a simple text file that specifies installation options for RHEL. file can be created using any text editor, and there are several examples available online to help you get started. Here's a basic example −

# Kickstart file for RHEL 7

# System language
lang en_US.UTF-8

# Keyboard settings
keyboard us

# Network information
network --bootproto dhcp --hostname=myhost.example.com

# Root password
rootpw --iscrypted $6$...

# Firewall configuration
firewall --enabled --service=ssh

# Disk partitioning
autopart --type=plain

# Package selection
%packages
@^minimal
@core
chrony
vim-enhanced

# Installation log
logvol /var/log --size=512 --name=log

# Reboot after installation
reboot

This Kickstart file specifies system language, keyboard settings, network information, root password, firewall configuration, disk partitioning, package selection, installation log, and reboot options. You can customize these options to fit your specific needs.

Once you have created your Kickstart file, save it to document root of HTTP server, which is typically located at /var/www/html/. You can name file anything you like, but it should have a .cfg extension. For example, you could name file rhel7.cfg.

Booting Client Machines

To boot a client machine using PXE, you'll need to configure BIOS to boot from network. This option is typically located in boot menu of BIOS settings. Once you have selected network boot option, client machine will request an IP address from DHCP server and download boot file from TFTP server.

Once boot file is downloaded, client machine will display a menu that allows you to select RHEL version you want to install. This menu is created using menu.c32 and vesamenu.c32 files that you copied to TFTP server earlier. menu options are defined in a file called pxelinux.cfg/default, which you can edit to add or remove options.

When you select RHEL version you want to install, installer will read Kickstart file you created earlier and automatically apply specified settings. This can save you a lot of time and effort, especially if you need to install multiple instances of RHEL with same configuration.

Conclusion

Automated installations of RHEL using PXE server and Kickstart files can be a real time-saver for IT professionals. By setting up a PXE server and creating a Kickstart file, you can quickly and easily install RHEL on multiple machines with same configuration. This can save you a lot of time and effort, especially if you need to deploy a large number of RHEL instances. With a little bit of configuration and customization, you can streamline your installation process and make your job a lot easier.

Updated on: 31-Mar-2023

324 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements