Linux KickStart – Automated Installation
Kickstart installations offer a means to automate the installation process, either partially or fully. Kickstart files contain answers to all questions normally asked by the installation program, such as what time zone you want the system to use, how the drives should be partitioned, or which packages should be installed. Providing a prepared Kickstart file when the installation begins therefore allows you to perform the installation automatically, without need for any intervention from the user. This is especially useful when deploying Red Hat Enterprise Linux on a large number of systems at once.
Kickstart files can be kept on a single server system and read by individual computers during the installation. This installation method can support the use of a single Kickstart file to install Linux on multiple machines, making it ideal for network and system administrators.
All scripts and the log files of their execution are stored in the /tmp
directory to assist with debugging installation failures.
Note
You must read your distribution documents about fresh installation and upgrading current OS because some distributions don’t support upgrading via KickStart.
How Do You Perform a Kickstart Installation?
Kickstart installations can be performed using a local DVD, a local hard drive, or via NFS, FTP, HTTP, or HTTPS.
To use Kickstart, you must:
- Create a Kickstart file.
- Make the Kickstart file available on removable media, a hard drive or a network location.
- Create boot media, which will be used to begin the installation.
- Make the installation source available.
- Start the Kickstart installation.
Creating a Kickstart File
The file itself is a plain text file which serve as directions for the installation. Any text editor able to save files as ASCII text, such as Gedit or vim on Linux systems or Notepad on Windows systems, can be used to create and edit files. The file name of your configuration does not matter; however, it is recommended to use a simple name as you will need to specify this name later in other configuration files or dialogs.
The recommended approach to creating Kickstart files is to perform a manual installation on one system first. After the installation completes, all choices made during the installation are saved into a file named anaconda-ks.cfg
, located in the /root/
directory on the installed system. You can then copy this file, make any changes you need, and use the resulting configuration file in further installations.
If you have a Red Hat Customer Portal account, you can use the Kickstart Configuration Tool available at https://access.redhat.com/labs/kickstartconfig/ in the Access Labs. This tool will walk you through basic configuration and allows you to download the resulting Kickstart file. However, the tool currently does not supported any advanced partitioning.
You can read RedHat documents about file structure, its sections and its keywords to write advanced KickStart file.
Example Configuration
Here is an example for configuration file:
#version=DEVEL #interactive install cdrom lang en_US.UTF-8 keyboard us network --onboot no --device eth0 --bootproto dhcp --noipv6 rootpw --iscrypted C8P8$ENbGfJxRkXFxZot4dwxWMu2kG07rqnlC7u8e64P0TT13olx9IDYfZnjRBU3OwNLz5OKVWkPWj.nJb4T93aOKb/ firewall --disable authconfig --enableshadow --passalgo=sha512 selinux --disabled firstboot --disabled services --disabled bluetooth,kdump,postfix,iptables,ip6tables,NetworkManager,lvm2-monitor services --enabled ntpd timezone --utc Etc/GMT bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" zerombr yes clearpart --all --drives=sda ignoredisk --only-use=sda part /boot --fstype=ext4 --size=512 part swap --size=32768 part / --fstype=ext4 --size=20480 part /u01 --fstype=ext4 --grow --maxsize=102400 --size=102400 part /tmp --fstype=ext4 --grow --maxsize=10240 --size=10240 part /var --fstype=ext4 --grow --maxsize=10240 --size=10240 %packages @base @client-mgmt-tools @core @debugging @basic-desktop @desktop-debugging @desktop-platform @development @directory-client @fonts @general-desktop @graphical-admin-tools @hardware-monitoring @input-methods @internet-browser @java-platform @legacy-unix @legacy-x @network-file-system-client @network-tools @perl-runtime @remote-desktop-clients @server-platform @server-policy @storage-client-multipath @uek4-kernel-repo @x11 mtools pax python-dmidecode oddjob wodim sgpio genisoimage device-mapper-persistent-data systemtap-client tigervnc-server abrt-gui gcc-gnat gcc-java jpackage-utils gcc-objc gcc-objc++ samba-winbind certmonger pam_krb5 krb5-workstation lm_sensors telnet-server telnet tcp_wrappers libXmu iptraf lksctp-tools perl-DBD-SQLite tsclient rdesktop vinagre tigervnc kernel-uek-devel libdtrace-ctf -ql23xx-firmware -rt73usb-firmware -ql2200-firmware -rt61pci-firmware -ql2100-firmware -kernel-firmware %end %post %end
The file has been copied from an exist Linux and I have customized that for other machines.
The file should be named as “ks.cfg”. It’s usual name for configuration file.
You can remove “#” from second line and active “Interactive” mode that means, administrator can override configuration, this mode is disabled by default.
If you face with “Storage Device Warning” then you should add “zerombr yes” in your configuration file.
Prepare Local Installation Media
After preparing configuration file, you need to create a boot media or prepare PXE for booting servers. I want to show you process of preparing boot and installation ISO on a single DVD.
I have used Oracle 6.8 ISO for that and you can use this instruction for RedHat Enterprise Linux and any other distributions that those are based on RHEL.
At first step, you need to a exist Linux and mount ISO on it and then follow the instruction:
- Mount the ISO file to a folder such as /mnt
- Make a folder for source files: /iso
- Copy all files and folders to /iso:
cp -Rp /mnt/DiskLabel/* /iso
It takes some minutes because more than 3GB should be copied.
- Two hidden files won’t copy by the above command, so copy the files manually:
cp /mnt/DiskLabel/.discinfo /iso cp /mnt/DiskLabel/.treeinfo /iso
- Then copy “ks.cfg” (KickStart configuration file) to “/iso/isolinux”
- Now, menu should be configure, so edit “/iso/isolinux/isolinux.cfg” and add the below lines to that:
label auto menu label ^Kickstart Installation menu default kernel vmlinuz append initrd=initrd.img ks=cdrom:/isolinux/ks.cfg inst.stage2=hd:LABEL=Linux-KickStart
Add them top of first “label” keyword. We are going to create an installation DVD for KickStart installation and normal installation, so don’t touch rest of menu sections. If you are using RHEL 7, use “inst.ks” instead of “ks” and also if you want to boot your machine by USB or hard disk, you should replace “cdrom” with “hd:LABEL”. Read “Boot Options” on RHEL document library or “Anaconda” document or “Oracle KickStart Boot Options” for more information.
- Now, you need to make ISO file from /iso directory:
mkisofs -r -T -J -V "Linux-KickStart" \ -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -o /tmp/linux-kickstart.iso /iso
Make sure that ISO label is same as label that you have added to “isolinux.cfg” in previous steps.
- After the ISO file has been created completely, ISO checksum should be calculated:
implantisomd5 /tmp/linux-kickstart.iso checkisomd5 /tmp/linux-kickstart.iso
If you don’t have access to the command above, make sure the “genisoimage” and “isomd5sum” RPMs have been installed on your system.
- Burn the ISO file and check it.
Please share with me, if you face with any error or issue.
If you want to have advanced configurations or find more details about configuration that i have used, please read your distribution vendor documents. You will find very useful information.
Further Reading
I/O Block Size (> 3 MB) Best Practice on EMC AFA/HFA and Linux (Physical and Virtual)
HBA Port and Linux: What’s The Best Solutions to Disable?
Guest Operating System Upgrade or New Virtual Machine?
Download and Install Windows Updates Remotely via PSWindowsUpdate PowerShell Module