Saturday, September 11, 2010

Customizing / Remastering Fedora Using Kickstart

Today we'll talk about Fedora customization but first off lemme warn you that this game is not for the people who don't know the basics of shell scripting and don't understand the basics of rpm. If you are a total newbie and still wanna customize a Linux, check out this post I wrote some time back.

First of all let me tell you what is a Kickstart file. Red Hat introduced Kickstart installation so that mass install can be done smoothly with minimum effort form the system admin. So, Kickstart is nothing but an ordinary file having some configuration settings written on it so that you can sit back and enjoy you coffee and impress your boss by installing Fedora or Red Hat in 100 of computers in less than an hour. But we are going to create live CD using kickstart file and livecd tools.

So now you need to install spin-kickstarts and livecd-creator. You know the usual yum command to get these packages, right? Cool. Now go to /usr/share/spin-kickstarts. This is the folder where the kickstart files with the .ks extensions will be. There is one for every Fedora spin.

The easiest way to build the Live CD is to modify one of the .ks already present but be smart and copy your favorite kickstart along with fedora-live-base.ks to a new folder, say myks. In case you are curious about which kickstart to pick and what is there in it, lemme tell you, it is mostly the desktop environment that'll change with the different ks files.

Now I am assuming that you have picked fedora-livecd-kde.ks for the building, open the file in your favorite editor (kate for me!). First of all I suggest that you just have a look around. Read it and I am sure that you'll understand a lot of stuff. Done?

Cool. Now you can add some repo if you want like this:
repo --name=MyRepo --baseurl=file:///repo/

Add repo in the beginning of the Kickstart after the "%include" tag. Now time to add and remove stuff. Since you have decided to use KDE environment, stuff like kde-desktop will already be there. To add packages, simply write the name of the package and it'll be added there. To remove make a minus sign (-) and write the package name. Don't remove libraries unless you are absolutely sure that it is not a dependency for anything but you can always remove applications, like I remove k3b (-k3b to get rid of it) for my Netbook spin iso. You can also do some configurations if you are good at shell scripting. Check out the KDE Netbook spin Kickstart file I wrote sometime ago here.

Now to create the live cd just fire the command below:
livecd-creator --config=./fedora-livecd-kde.ks --cache=/var/cache/live

Replace ./fedora-livecd-kde.ks with the path to your kickstart and create the cache directory manually, if it is not there already.