You are well aware that when installing Linux operating system, you have to enter a lot of input like IP address, hostname, partition details, root password, etc. and when you need to do this operation by the number of hosts. There is of course a VMWare image option for a Linux installation. But you can also perform an automatic Kickstart Linux installation. This article will teach you how to perform a silent Kickstart Linux installation with minimal requirements.
Please note: we do not use instead of any DHCP server for IP assignment, we use it from VMware. For this demo, we used the following:
- 8 VMware Workstation
- Kickstart file
- FTP server (we share the kickstart file via FTP) for network installation.
So let’s get straight to the automated Linux kickstart installation.
Step 1: FTP server
We ran a RHEL server with IP address “192.168.216.134” inside VMware with FTP.
Step 2: The Kickstart File
Whenever you install any RHEL server, the default file “/root/anaconda-ks.cfg“ is generated:
[[email protected] ~]# ll /root/anaconda-ks.cfg -rw-------. 1 root root 1394 Dec 27 12:05 /root/anaconda-ks.cfg [[email protected] ~]#
You need to change this as per your requirement. However, this kickstart file works great. You can use the same to automatically install Linux kickstart. Create one file “/var/ftp/pub/anaconda-ks.cfg” and copy the content below.
# Kickstart file automatically generated by anaconda. #version=DEVEL install cdrom lang ru_RU.UTF-8 keyboard ru #Network card Definition with hostname and all network --onboot yes --device eth0 --bootproto dhcp --noipv6 --hostname localhost.localdomain # grab the hash from an account in /etc/shadow that has the password you want to use this is hash of password "root987" rootpw --iscrypted $6$.Z9thd3gOdXvddLD$66rjO2syNkQ/8qRo3wjZI/9pg2W9U4PWXYzVr/3yra47k1TZfK2/ufwsWnXu.FA4I8pVj9RrlAjQk3lQld/ZQ/ firewall --service=ssh authconfig --enableshadow --passalgo=sha512 selinux --enforcing timezone --utc Europe/Moscow bootloader --location=mbr --driveorder=sda --append=" rhgb crashkernel=auto quiet crashkernel=auto quiet rhgb" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work clearpart --linux --drives=sda --all --initlabel ignoredisk --only-use=sda #part pv.008002 --grow --size=1 ### part /boot --fstype=ext4 --size=500 part /home --fstype=ext4 --size=10240 part swap --size=1024 part / --fstype=ext4 --grow --size=200 repo --name="Red Hat Enterprise Linux" --baseurl=file:///mnt/source --cost=100 %packages @Base @Core @base @client-mgmt-tools @console-internet @core @debugging @directory-client @hardware-monitoring @java-platform @large-systems @network-file-system-client @performance @perl-runtime @server-platform @server-policy certmonger krb5-workstation oddjob pam_krb5 pax perl-DBD-SQLite python-dmidecode sgpio %end
You can refer to the small explanations of some of the parameters above for more information. In the above file, the hash for the root password is “root123”. You should use the same one after successful installation for root login. You can change it to another strong password you prefer by simply copying the hash value from / etc / shadow.
You can check the above file for any errors using the following command. An empty exit means everything is fine.
[[email protected] ~]# ksvalidator /var/ftp/pub/anaconda-ks.cfg [[email protected] ~]#
If you have not installed ksvalidator, then use the following command to install.
[[email protected] ~]# yum install pykickstart
Step 3: Check FTP at /var/ftp/pub/anaconda-ks.cfg.
Now try to access the link “ftp://192.168.216.134/pub/anaconda-ks.cfg~~pobj” from your browser to make sure it is available over the network for installation. Please note that 192.168.216.134 is the IP address of the FTP server. You should get below output in your browser.
This is what you did with the server configuration.
Step 4: Create Guest VM in VMWare Workstation.
It is now easy to create one sample having a RHEL 6 ISO virtual machine as a configuration CD in VMWare Workstation.
Step 6: Boot the VM.
Turn on the virtual machine. After installation, the installation screen below appears using the up or down arrow key.
Now select the cursor on the first option, ie “Install or update an existing system” and press Tab so that we can change the option. Issue the following command on the command line.
vmlinuz initrd=initrd.img ks=ftp://192.168.216.134/pub/anaconda-ks.cfg
and press Enter.
Now you don’t need to do anything other than the reboot message in the last step to reboot. Just grab a coffee and enjoy the automatic Linux kickstart installation. After a successful installation, kickstart Linux will ask for a reboot.