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 required user intervention while installation process. Oh. ūüôā sounds awesome but how this is going to accomplish.? In this Kickstart method we are going to create config file which contains all answers for operating system installation.

 Automated OS Installation Advantages

  • Install More than one server yet the same time
  • Save lot of time by creating auto answer file
  • Multiple Distributions also supported
  • Post installation scripts helps 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 your 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
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package system-config-kickstart.noarch 0:2.9.2-4.el7 will be installed
--> Processing Dependency: system-config-keyboard >= 1.3.1 for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Processing Dependency: system-config-date for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Processing Dependency: system-config-language for package: system-config-kickstart-2.9.2-4.el7.noarch
--> Running transaction check
---> Package system-config-date.noarch 0:1.10.6-2.el7 will be installed
--> Processing Dependency: system-config-date-docs for package: system-config-date-1.10.6-2.el7.noarch
---> Package system-config-keyboard.noarch 0:1.4.0-4.el7 will be installed
--> Processing Dependency: system-config-keyboard-base = 1.4.0-4.el7 for package: system-config-keyboard-1.4.0-4.el7.noarch
---> Package system-config-language.noarch 0:1.4.0-6.el7 will be installed
--> Running transaction check
---> Package system-config-date-docs.noarch 0:1.0.11-4.el7 will be installed
---> Package system-config-keyboard-base.noarch 0:1.4.0-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================
 Package Arch Version Repository Size
==================================================================
Installing:
 system-config-kickstart noarch 2.9.2-4.el7 RHEL7 351 k
Installing for dependencies:
 system-config-date noarch 1.10.6-2.el7 RHEL7 619 k
 system-config-date-docs noarch 1.0.11-4.el7 RHEL7 527 k
 system-config-keyboard noarch 1.4.0-4.el7 RHEL7 33 k
 system-config-keyboard-base noarch 1.4.0-4.el7 RHEL7 103 k
 system-config-language noarch 1.4.0-6.el7 RHEL7 132 k

Transaction Summary
==================================================================
Install 1 Package (+5 Dependent packages)

Total download size: 1.7 M
Installed size: 6.4 M
Is this ok [y/d/N]: y
Downloading packages:
------------------------------------------------------------------
Total 39 MB/s | 1.7 MB 00:00:00 
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 1Installing : system-config-date-1.10.6-2.el7.noarch 1/6 
 2Installing : system-config-date-docs-1.0.11-4.el7.noarch 2/6 
 3Installing : system-config-language-1.4.0-6.el7.noarch 3/6 
 4Installing : system-config-keyboard-base-1.4.0-4.el7.noarch 4/6 
 5Installing : system-config-keyboard-1.4.0-4.el7.noarch 5/6 
 6Installing : system-config-kickstart-2.9.2-4.el7.noarch 6/6 
 1Verifying : system-config-date-docs-1.0.11-4.el7.noarch 1/6 
 2Verifying : system-config-keyboard-1.4.0-4.el7.noarch 2/6 
 3Verifying : system-config-date-1.10.6-2.el7.noarch 3/6 
 4Verifying : system-config-kickstart-2.9.2-4.el7.noarch 4/6 
 5Verifying : system-config-keyboard-base-1.4.0-4.el7.noarch 5/6 
 6Verifying : system-config-language-1.4.0-6.el7.noarch 6/6

Installed:
 system-config-kickstart.noarch 0:2.9.2-4.el7

Dependency Installed:
 system-config-date.noarch 0:1.10.6-2.el7 system-config-date-docs.noarch 0:1.0.11-4.el7 system-config-keyboard.noarch 0:1.4.0-4.el7 
 system-config-keyboard-base.noarch 0:1.4.0-4.el7 system-config-language.noarch 0:1.4.0-6.el7

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
Kickstart Installation Method

Installation Method

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

Linux RHEL7 Kickstart method

Boot Loader options

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

Clear Master boot record

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 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

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

Added Network Device

Added Network Device

Authentication type

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

Firewall Options

Decision to Enable / Disable firewall and its security level

Display Configuration

Display Configuration

Would like to install graphical environment then simply select option

Package selection

Package selection

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

Pre-installation script

Pre-installation script

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

Post-Installation script

Post-Installation script

After installation run script

save configuration file

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 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 only one which you would like to do.

Steps for 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 
httpd.service - The Apache HTTP Server
 Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
 Active: active (running) since Sat 2017-02-25 14:38:57 IST; 13s ago
 Main PID: 9962 (httpd)
 Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
 CGroup: /system.slice/httpd.service

Install http packages, enable web service and start web service. Enable service and port number in 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

[root@ArkIT ~]# yum install vsftpd*

[root@ArkIT ~]#systemctl enable vsftpd.service 
ln -s '/usr/lib/systemd/system/vsftpd.service' '/etc/systemd/system/multi-user.target.wants/vsftpd.service'
[root@ArkIT ~]#systemctl start vsftpd.service 
[root@ArkIT ~]#systemctl status vsftpd.service 
vsftpd.service - Vsftpd ftp daemon
 Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
 Active: active (running) since Sat 2017-02-25 14:57:42 IST; 7s ago
 Process: 10794 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 10795 (vsftpd)

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

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

Boot Menu

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

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

Hi Enter.

That’s It. Your Installation process start and will complete automatically.¬†Automated OS installation

Conclusion Kick start method

Setting up kick start method is very easy and simple. Kickstart installation process very useful when you would like to deploy Linux in 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

Stay Connected with us. Learn More and Earn More

ARK

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

You may also like...

Leave a Reply