A Weekend of fun Customizing the Kickstart File

This is part of a larger series on earning an RHCE.  For the first article, click here, and for the one immediately previous to this one, click here.

I have covered how to do an automated installation of RHEL 7 or CentOS 7.  I would like to cover how to customize the kickstart file to setup the networking and how to include other RPMs that you would like installed during the automated build.

There are a few different ways to get a kickstart file generated.  There is a kickstart generator on Red Hat’s site under the Tools tab and in the Deployment section.  Here is a quick link to that generator.  Unfortunately, those of you who do not have a Red Hat support account will not be able to access the generator.  Do not fret.  There are other options to get a kickstart file generated.

The easier option, but the most time consuming, is to create a machine manually.  Once the machine is up and running, log in as root.  In the root home directory, /root, there will be a file called “anaconda-ks.cfg”.  This is a file that is created by the installation helper.  It creates the file in case you want to recreate the machine.

One of the things that you will want to modify from the unattended installations, which I show in the previous blog and video, is the network adapter.  The default for VirtualBox is to use eth0.  With the drivers that come with RHEL 7, the adapter should show up as enp0s17 or something similar.

As an added visual aid, I’ve again included a video to make following along easier.

In the Unattended kickstart file, you should see a line similar to:

network  --bootproto=dhcp --device=enp0s17 --onboot=on --hostname=server1.example.com

We will want to change it to something like:

network  --bootproto=static --device=enp0s17 --gateway= --ip= --nameserver= --netmask= --ipv6=auto --activate --hostname=server1.example.com

This will make it static and allow you to port forward into the labNAT network from your laptop or server.

VBoxManage natnetwork modify --netname labNAT --port-forward-4 "server1:tcp:[]:2210:[]:22"

Using this modification, and the port forward rule, you will now be able to ssh into the machine from a terminal.  Doing the same thing for control and server2, you will make setup on the labs much easier since you do not have to use the VirtualBox console window.  You can now ssh to the server1 machine by using:

ssh user@localhost -p 2210


About the Author

With over 18 years of advanced professional work experience in various Information Technology and Storage Platforms, David provides the ability to deliver enterprise solutions to Fortune 500 companies.