How to use PXE Kickstart File to Install Linux

Share on Social Media

Learn how to use a PXE Kickstart file to install Linux on clients with this detailed guide. Follow step-by-step instructions to automate and streamline your Linux installation process over the network. #centlinux #linux #pxe

What is Kickstart?

Kickstart is an installation method, used by Red Hat to automatically perform unattended Operating System installation and configuration. With Kickstart, a system administrator can create a single file containing the answers to all the questions that would normally be asked during a typical installation.

In our previous post “Setup a PXE Boot Server in RHEL 7”, we have configured a PXE boot server for network installations of new systems. However, the installation method is manual. Now, in this article, we will combine the Kickstart with PXE boot Server to setup fully automated, unattended and consistent installations for our PXE clients.

How to use PXE Kickstart File to Install Linux
How to use PXE Kickstart File to Install Linux

Linux Server Specification

We use the same Linux server that we have configured as PXE Boot Server in our previous article. The specifications have been re-mentioned below for convenience of the readers.

  • CPU – 2 Core (2.4 Mhz)
  • Memory – 2 GB
  • Storage – 50 GB
  • Operating System – RHEL 7.5
  • Hostname – pxe-server.itlab.com
  • IP Address – 192.168.116.41/24

Recommended Training: Linux Administration: The Complete Linux Bootcamp in 2025 from Andrei Dumitrescu, Crystal Mind Academy

3371848 9ea9 18

Create a PXE Kickstart file to Install Linux

Kickstart file is a text file and can be created using any available text editor. Furthermore, we also have a very handy GUI tool in Linux called Kickstart Configurator. With Kickstart Configurator, we can simply select the options and the Kickstart file will automatically generated by the software.

Kickstart configurator is provided in system-config-kickstart.noarch package. And can be run using command system-config-kickstart (you need an X-Server to display the software interface). Some screenshots of the Kickstart Configurator are as follows:

Kickstart Configurator - Basic Configuration
Kickstart Configurator – Basic Configuration
Kickstart Configurator - Installation Method
Kickstart Configurator – Installation Method
Kickstart Configurator - Partition Information
Kickstart Configurator – Partition Information

Kickstart Configurator is quiet handy tool and anyone can create a complicated Kickstart file in just a few clicks.

Alternatively, we can use a system generated Kickstart template, which is created by the Anaconda installer during operating system installation in the home directory of root user (i.e. /root/anaconda-ks.cfg). This file contains the actual user inputs/selections that has been made during the installation of Operating System on that machine. Therefore, we can use this Kickstart template after adjusting the contents according to our requirements.

Copy the anaconda-ks.cfg to our FTP public directory.

# cp anaconda-ks.cfg /var/ftp/pub/rhel7/rhel7.cfg
# chmod +r /var/ftp/pub/rhel7/rhel7.cfg

Now edit the rhel7.cfg file.

# vi /var/ftp/pub/rhel7/rhel7.cfg

The final contents of the rhel7.cfg are:

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$vyNMLtgd$VmtByshddZSBK..uuFhoH0
# Use network installation
url --url="ftp://192.168.116.41/pub/rhel7"
# System language
lang en_US
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --enforcing

# Firewall configuration
firewall --enabled --ssh
# Network information
network  --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System timezone
timezone Asia/Karachi
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
# Packages to be installed
%packages
@core
%end

We have successfully created a Kickstart file for automated installations. To make it usable by our PXE boot server, we have to include it in the menu command of tftp.

Configure PXE boot server to use Kickstart file

Edit the PXE boot menu for BIOS based clients.

# vi /var/lib/tftpboot/pxelinux.cfg/default

and append the kickstart directive therein. Contents of this file after editing are:

default menu.c32
prompt 0
timeout 30
menu title Ahmer's PXE Menu
label Install RHEL 7.5
kernel /networkboot/rhel7/vmlinuz
append initrd=/networkboot/rhel7/initrd.img inst.repo=ftp://192.168.116.41/pub/rhel7 ks=ftp://192.168.116.41/pub/rhel7/rhel7.cfg

Similarly, edit the PXE boot menu for UEFI based clients.

# vi /var/lib/tftpboot/grub.cfg

and append the kickstart directive therein. Contents of this file after editing are:

set timeout=60

menuentry 'Install RHEL 7.5' {
        linuxefi /networkboot/rhel7/vmlinuz inst.repo=ftp://192.168.116.41/pub/rhel7/ inst.ks=ftp://192.168.116.41/pub/rhel7/rhel7.cfg
        initrdefi /networkboot/rhel7/initrd.img
}

Test the configurations with BIOS and UEFI based machines. Now, the whole installation is automated, and operating system will be installed and configured as per our PXE Kickstart file.

Final Thoughts

If you found this guide on using a PXE Kickstart file to install Linux useful and need further assistance, I’m here to help. I offer professional services to ensure your PXE Kickstart setup and Linux installations are seamless and efficient. Visit my Fiverr profile for more details and to get started: Linux System Engineer. Let’s streamline your Linux deployment process together!

Looking for something?

13 responses to “How to use PXE Kickstart File to Install Linux”

  1. marklorenz_007 Avatar

    Everything here works like a charm. I got my first pxe boot server working with automated installation in 1 client. Thank you so much for this!

  2. Unknown Avatar

    Daaang!!! Great article. Steps are very clear with description to follow!! �� i appreciated it all your effort! I learn some good stuff from your Blog! I have only one concern regarding search engine. You should include a search engine in your blog to easily navigate/search to the website. But beside that everything is awsome.

  3. Ahmer M Avatar

    Hi,
    Thanks you for the appreciation.
    A search box is already embedded in the page. But as per you advice, I will move it a better place for more accessibility.

  4. Anonymous Avatar
    Anonymous

    Bhai you are awesome as i mentioned earlier in my post…your tutorial are very well written. person like me who have no prior Linux experience can follow and achieve. i learned too many things from your blog… i would like to say thankyou for your dedication and effort. I just faced one issue what so far is root passwd in ks.cfg file. which i reset it through emergency mode. what i did is i copied my root passwd from shadow file exactly and copied into ks.cfg file. after installation i won't able to login with the same passwd. can you please suggest? what could be wrong? i make sure i copy/paste correct root passwd from my shadow file or is there anyway that i want root set there passwd on login? i will really appreciate.

    thankyou again…

  5. Anonymous Avatar
    Anonymous

    Sorry Forget to mention about Search box. now you set it up on the right place easy to access and view. thankyou for that too..

  6. Ahmer M Avatar

    Thanks for appreciation.

    May be there is some issue of character sets or encryption scheme.
    Try to use a plain text password as follows.

    rootpw 123

  7. Anonymous Avatar
    Anonymous

    How can I do this postscript when the installation is done via PXE and not with a cdrom? "mount dev/cdrom /mnt/cdrom"

  8. Ahmer M Avatar

    You can do this in following ways.

    1) Mount the CDROM at a directory on the server and use it in PXE.
    2) Copy the Content of CDROM at a directory on the Server and use it in PXE.

  9. Sameera Dissanayaka Avatar

    sir is it possible to do with dual boot,if system already have windows 7 installed.i need to dualboot centos 7 along side with windows 7 in lab

  10. Ahmer M Avatar

    Yes. just boot you system from network and the rest of the steps are same as installing from a CDROM.

  11. Anonymous Avatar
    Anonymous

    Great article with a great value as all that I have read from you

Leave a Reply