Automated OS Installation using Kickstart Method Linux RHEL7

Kickstart Means automated. Automated os installation using Kickstart method Linux RHEL7 is made very simple. We can use Kickstart method to install N number of servers yet the same time because this method does not require user intervention while the installation process. Oh. 🙂 sounds awesome but how this is going to accomplish.? In this Kickstart method, we are going to create a config file which contains all answers for operating system installation.

 Automated OS Installation Advantages

  • Install More than one server at the same time
  • Save lot of time by creating auto answer file
  • Multiple Distributions also supported
  • Post-installation scripts help in automating more tasks

Kickstart Method uses below protocols

  • NFS
  • HTTP
  • FTP

Step 1: Mount ISO and Dump Media Source files

First choose the protocol which you’re going to use for this Kickstart method installation, above mentioned protocols will be supported. HTTP, HTTPS, NFS, and FTP. 

For NFS server location you can make any directory under / (slash) and copy the media

If HTTP / HTTPS use default path as /var/www/html

FTP protocol use /var/ftp/pub/as default path

Mount ISO file or CD/DVD media

ISO file mounting

[root@ArkIT]# mount /tmp/RHEL7.iso /mnt

CD/DVD media mounting

[root@ArkIT]# mount /dev/sr0 /mnt

Web server Path: cp -rfv /mnt/* /var/www/html/

FTP server Path: cp -rfv /mnt/* /var/ftp/pub/

NFS Server Path: cp -rfv /mnt/* /nfsserver/

Step 2: Installation and generate Kickstart file / Auto Answer File

[root@ArkIT ~]# yum install system-config-kickstart
Total download size: 1.7 M
Installed size: 6.4 M
Is this ok [y/d/N]: y
Complete!

Step 3: Generating Auto Answer File

After installing Kickstart config generator we have to open the tool and generate auto answer file.

[root@ArkIT ~]# system-config-kickstart
Opening Kickstart File Generator

Opening Kickstart File Generator

As shown in above screenshot select required options

  • Default Language
  • Keyboard
  • Time Zone
  • Root Password and Confirm Password
  • Target Architecture
  • Reboot system After Installation

Installation Method

Select Installation method either perform a fresh installation or upgrade an existing installation. Kickstart supports upgrade option as well.

Boot Loader options

If you would like to install new bootloader then select to install a new bootloader or else select do not install the bootloader. If you’re interested in setting up the GRUB password you can also do that by selecting the GRUB password option and provide a password.

Partition Information Tab

Using Partition Information tab declare partition details which are the partitions you would like to create. 

  • Clear Master Boot Record — Will clear before boot record if any
  • Do Not Clear Master Boot Record — It will not touch the previous boot record
  • Remove all – Will remove all existing partitions and create new
  • Remove only existing Linux partitions – it will not delete NTFS partitions
  • Preserve existing partitions – Will does not touch any of existing partitions

Note: There is no option to create LVM partitions in this tool, Add config definition after file generation.

Network Configuration Tab

Network configuration tab will help you to configure NIC, IP Address and Network Device

Added Network Device

Authentication Tab

Authentication Configuration is the option where you can select the option to join to NIS, LDAP, Kerberos and local encrypted authentication

Firewall Options

The decision to Enable / Disable firewall and its security level

Display Configuration

Would like to install graphical environment than simply select option

Package selection

Note: Package option did not have an option to select packages, after generating config file will add

Pre-installation script

Before starting installation would like to run any script you can include

Post-Installation script

After installation run script

save auto answer configuration file

Step4: Adding LVM config and Packages list

Simply generating Kickstart file will not work as expected, we have to add LVM configuration and Packages which you would like to install, edit the config file and add

Edit config file and add below lines to create LVM partitions and packages installation Automated OS installation

# Partition clearing information
clearpart --all --initlabel
volgroup rhel --pesize=4096 PV0
part PV0 --fstype=lvmpv --ondisk=sda --size=50000
part /boot --fstype=xfs --size=500
logvol / --vgname=rhel --name=root --fstype=xfs --size=10000
logvol /var --vgname=rhel --name=var --fstype=xfs --size=8000
logvol swap --vgname=rhel --name=swap --fstype=swap --size=8000
logvol /home --vgname=rhel --name=home --fstype=xfs --size=7000
logvol /usr --vgname=rhel --name=usr --fstype=xfs --size=7000

%packages
@base
@core
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@input-methods
@internet-browser
@mariadb
@multimedia
@print-client
@x11
kexec-tools

Step5: Sharing Auto Answer file using protocols

I would like to write all the protocol steps here, but follow the only one which you would like to do.

Steps for the HTTP protocol

[root@ArkIT ~]# yum install http*
[root@ArkIT ~]#systemctl enable httpd.service
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@ArkIT ~]#systemctl start httpd.service 
[root@ArkIT ~]#systemctl status httpd.service

Install HTTP packages, enable web service and start web service. Enable service and port number in a firewall. Automated OS installation

[root@ArkIT ~]#firewall-cmd --permanent --add-service=http
success
[root@ArkIT ~]#firewall-cmd --permanent --add-service=https
success
[root@ArkIT ~]#firewall-cmd --reload 
success

copy the auto answer file and RHEL7 media to default path /var/www/html

Steps for FTP Protocol Linux RHEL7

Installing required packages for FTP and start ftp service

# yum install vsftpd*
# systemctl enable vsftpd.service 
# systemctl start vsftpd.service 
# systemctl status vsftpd.service 

# firewall-cmd --permanent --add-service=ftp 
# firewall-cmd --reload

Copy Kickstart file and Media files to /var/ftp/pub/ path

NFS server installation and configuration see this full guide

Client Side OS Installation

Boot client machine with OS CD/DVD

Boot Menu

When you see above boot menu options do not select anyone just press Escape button

boot: linux ks=http://192.168.4.27/rhel7/ks.cfg

Hi Enter.

That’s It. Your Installation process starts and will complete automatically. Automated OS installation

Conclusion Kickstart method

Setting up kick start method is very easy and simple. Kickstart installation process very useful when you would like to deploy Linux in a large number of servers.

Download Kickstart Config File

Related Articles

Installation and Configuration of FTP server step by step guide

Installation and configuration web server step by step guide

setting up PXE boot server

HTTPS setup step by step guide

Thanks for your wonderful Support and Encouragement