Automatic And Up-To-Date Fedora 9 Installations With Kickstart And Novi
Version 1.0
Author: Falko Timme
Kickstart allows you to do automatic Fedora/RedHat/CentOS installations (i.e., you do not have to sit in front of the computer and answer the questions of the installer). This is useful and time-saving if you have to deploy tens or hundreds of similar systems (e.g. workstations). Kickstart reads the installation settings from a Kickstart configuration file. The problem with Kickstart is that it usually uses the distribution's packages from the time the distribution was released, i.e., it does not consider updates which means you would have to update each system manually after the Kickstart installation. This guide explains how you can do up-to-date Kickstart installations with the help of a tool called novi.
This document comes without warranty of any kind! I do not issue any guarantee that this will work for you!
1 Preliminary Note
I will use a Fedora 9 server here (IP address 192.168.0.100) to set up a local yum repository for the Kickstart installation. The yum repository will be served using http (you can as well use ntp, ftp, etc.).
I will create the Kickstart configuration file ks.cfg on a second system, a Fedora 9 desktop, with the tool system-config-kickstart (which requires a desktop environment), and then transfer it to our Fedora 9 Kickstart server.
This tutorial is for the i386 architecture; if you're using x86_64, replace i386 with x86_64 where necessary.
2 Preparing The Kickstart Server
I want to serve the local yum repository using http, therefore I need a web server (e.g. Apache):
yum install httpd
After the Apache installation, we create the system startup links for Apache and start it:
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
The default document root for Apache on Fedora is /var/www/html.
Next we install the tool createrepo:
yum install createrepo
I want to place the basic Fedora 9 repository in /var/www/html/yum/base/9/i386 (including the repodata directory which holds metadata about the available rpm packages, and the Packages directory which contains the rpm packages) and the updates in /var/www/html/yum/updates/9/i386 (this directory will just hold the update rpms, no subdirectories). I need a third directory, /var/www/html/yum/base/9-prepatched/i386, in which I will merge the basic Fedora 9 repository and the updates. Therefore I create these directories now:
mkdir -p /var/www/html/yum/base/9/i386
mkdir -p /var/www/html/yum/updates/9/i386
mkdir -p /var/www/html/yum/base/9-prepatched/i386
Now we can fill the /var/www/html/yum/base/9/i386 directory. If you have the Fedora 9 DVD at hand, you can insert it into your DVD drive and copy its contents as follows:
mount /dev/cdrom /mnt
cd /mnt
cp -vfr * /var/www/html/yum/base/9/i386
cd /
umount /mnt
If you don't have the Fedora 9 DVD, you can fill the directory as follows (this will probably take a few hours, so please be patient):
rsync -avrt rsync://ftp-stud.hs-esslingen.de/fedora/linux/releases/9/Fedora/i386/os/ /var/www/html/yum/base/9/i386
(You can find a list of Fedora mirrors here: http://mirrors.fedoraproject.org/publiclist. Make sure you pick one that offers rsync.)
Next we download the update rpms to /var/www/html/yum/updates/9/i386:
rsync -avrt rsync://ftp-stud.hs-esslingen.de/fedora/linux/updates/9/i386.newkey/ --exclude=debug/ /var/www/html/yum/updates/9/i386
Now before we merge the basic packages and the updates, we copy some files/directories from /var/www/html/yum/base/9/i386 to /var/www/html/yum/base/9-prepatched/i386:
cd /var/www/html/yum/base/9/i386
cp GPL /var/www/html/yum/base/9-prepatched/i386/
cp -fr images/ /var/www/html/yum/base/9-prepatched/i386/
cp media.repo /var/www/html/yum/base/9-prepatched/i386/
cp README-BURNING-ISOS-en_US.txt /var/www/html/yum/base/9-prepatched/i386/
cp -fr repodata/ /var/www/html/yum/base/9-prepatched/i386/
cp RPM* /var/www/html/yum/base/9-prepatched/i386/
cp TRANS.TBL /var/www/html/yum/base/9-prepatched/i386/
mkdir /var/www/html/yum/base/9-prepatched/i386/Packages
Next we install novi...
rpm -ivh http://downloads.exmachinatech.net/novi/1.1.9/novi-1.1.9-1.fc9.i386.rpm
... and merge the basic packages and the updates into /var/www/html/yum/base/9-prepatched/i386/Packages as follows:
novi -a hardlink -t /var/www/html/yum/base/9-prepatched/i386/Packages /var/www/html/yum/base/9/i386/Packages /var/www/html/yum/updates/9/i386
This is a sample output:
[root@server1 i386]# novi -a hardlink -t /var/www/html/yum/base/9-prepatched/i386/Packages /var/www/html/yum/base/9/i386/Packages /var/www/html/yum/updates/9/i386
Loading RPMs from source /var/www/html/yum/base/9/i386/Packages
Now 2071 products loaded (2071 RPMs)
Loading RPMs from source /var/www/html/yum/updates/9/i386
Now 5748 products loaded (6631 RPMs)
Total 5748 products to process, from 6631 RPMs
[root@server1 i386]#
Now we must regenerate the metadata in /var/www/html/yum/base/9-prepatched/i386/repodata because it doesn't contain any details about the updates yet:
cd /var/www/html/yum/base/9-prepatched/i386
createrepo -g repodata/Fedora-9-comps.xml ${PWD}
That's it - our up-to-date Kickstart repository in /var/www/html/yum/base/9-prepatched/i386 is ready to be used.
You should create a cron job to fetch and merge the latest updates and regenerate the metadata, e.g. like this:
crontab -e
23 4 */2 * * /usr/bin/rsync -avrt rsync://ftp-stud.hs-esslingen.de/fedora/linux/updates/9/i386.newkey/ --exclude=debug/ /var/www/html/yum/updates/9/i386 && /usr/bin/novi -a hardlink -t /var/www/html/yum/base/9-prepatched/i386/Packages /var/www/html/yum/base/9/i386/Packages /var/www/html/yum/updates/9/i386 && cd /var/www/html/yum/base/9-prepatched/i386 && /usr/bin/createrepo -g repodata/Fedora-9-comps.xml ${PWD} |
(This would fetch the latest updates every second day at 04.23h.)