February 20, 2014

Automatic RHEL 6 Installation with Kickstart

Introduction

Today the requirement are higher to quicker responds to the market. For a computer operation that means, they must be quicker to bring up new machine. The Red Hat solution for this is to use kickstart to standardize and automate the installation of a new RHEL instances.

The simplest way to create a working kickstart file is to actually install a new system (the way you want) and then use the kickstart created by anaconda to install new machine with.

The more advanced way is to start from scratch and use the system-config-kickstart tool and create you kickstart file. But there are some shortcoming with this tool and that is it can not handle LVM.

The pragmatic way is to start from a anaconda generated kickstart file and then edit with system-config-kickstart and finally manually add the LVM partition.

Here I will show you the easy way and use the anaconda generated file.

Prerequisite

Lets get started and install a new RHEL instance the manually way. We will install this machine as a virtualized machine and as hypervisor we will use KVM.

The requirement for this machine are:

  • 8 GB Disk Space
  • Basic Storage Devices
  • Use All Space

We will select the last checkbox 'Review and modify...', so we can see what is actually done.

What we see above is that two primary partitions are created - vda1 and vda2.

  • vda1 will contain standard ext4 file system for boot. The size of 500 MB is good for boot partition and should rarely be changed.
  • vda2 will be formatted with LVM and will fill up the rest of the available disk. This is also good.

The next step is the logical volumes: lv_root and lv_swap.

Note the few partition that are here created. For a server installation you would probably create more partitions, e.g. a separate partition for /var/log directory for a production server and for desktop installation you would probably create a separate partition for /home. But here we will keep to the basic suggested partition layout.

The second thing that is noteworthy is the small swap space. The thumb rule for a minimal installation production server is:

  • < 2GB RAM, use 2 * RAM
  • >= 2GB RAM, use RAM + 2GB

But remember these are not hard rules and dependce how often you will restart you system. For a desktop installation you will get away with smaller swap space.

Finally we will select to install a minimal installation. When installation is finish we will end up with a anaconda generated kickstart file located in /root/anaconda-ks.cfg.

Kickstart file

To make this kickstart file automatic we need to do three things:

  1. Uncomment the LVM partitioning. I also renamed the volume group to vg_rhel6.
  2. Add zerombr, to answer yes to the prompt question that all existing partitions will be destroyed.
  3. And finally automatically restart the system after installation.

Test

The last step is to test it. First we need to make it accessible during installation. The easiest way to do that, is to use either a FTP or HTTP server. There are also other ways, such as using a shared network disk, accessible via NFS or CIFS. But I would recommend using a known FTP server.

Now start a new RHEL installation. At the first menu, press TAB.

Then at the end enter 'ks=ftp://<server>/<path>' and press ENTER.

Reference

No comments: