Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Automatic And Up-To-Date Fedora 9 Installations With Kickstart And Novi


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.)

3 Creating A Kickstart Configuration File

Now we boot a Fedora 9 desktop and install system-config-kickstart. Go to System > Administration > Add/Remove Software:

1

Search for system-config-kickstart and install it:

2

After the installation, you can start it under Applications > System Tools > Kickstart:

7

In the Kickstart Configurator, you can configure your future Kickstart installations (most of the options are self-explanatory; I will add an explanation if I think there’s something important to take care of):

8

Under Installation Method, select Perform new installation and pick HTTP as the installation method. Then fill in the http server:

192.168.0.100

and the http directory:

/yum/base/9-prepatched/i386

9

Under Installation Method, select Perform new installation and pick HTTP as the installation method. Then fill in the http server:

192.168.0.100

and the http directory:

/yum/base/9-prepatched/i386

10

Under Partition Information, you should create the partition layout for your Kickstart installations. You should at least create a swap and a / partition. Click on Add:

11

Select swap and check Use recommended swap size:

12

Next create a / partition. Select Fill all unused space on disk:

13

14

Under Network Configuration, you must add a network device. Click on the Add Network Device button:

15

If you want to install Fedora desktops, DHCP is a good choice:

16

If you want to install Fedora desktops, DHCP is a good choice:

16

17

Under Firewall Configuration, you can configure or disable the firewall and enable or disable SELinux:

18

Under Display Configuration > General, select 32bit as color depth, a screen resolution that fits to the screens that are attached to your client systems and mark the checkbox below to start the X window system on boot.

19

On the Video Card tab you should leave the settings as they are to prevent problems with different graphics cards on your client systems.

20

On the Monitor tab you should leave the settings as they are if there are different screens attached to your client systems.

21

Now we reach the interesting part – the package selection. Select the packages or package groups that shall be installed on your client systems:

22

Under Pre-Installation Script, you can insert commands that shall be executed before the installation will start:

23

Under Post-Installation Script, you can insert commands that shall be executed at the end of the Kickstart installation:

24

If you have finished your configuration, go to File > Save File

25

… and save the configuration (e.g. as ks.cfg) on the hard drive (e.g. in your home folder):

26

Now open a terminal (Applications > System Tools > Terminal) and transfer the Kickstart file to the Kickstart server (to the /var/www/html/yum directory):

scp /home/falko/ks.cfg root@192.168.0.100:/var/www/html/yum

If all goes well, you should now have the file /var/www/html/yum/ks.cfg on the Kickstart server. Here’s a sample file to familiarize you with the format:

cat /var/www/html/yum/ks.cfg

#platform=x86, AMD64, or Intel EM64T
#version=F9
# Root password
rootpw --iscrypted $1$sLBnwcB/$BiFC/2rOmoPWyRBPrH1Mx/
# Firewall configuration
firewall --disabled
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# X Window System configuration information
xconfig  --defaultdesktop=GNOME --depth=32 --resolution=1024x768 --startxonboot
# System authorization information
auth  --useshadow  --passalgo=md5
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard de
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url=http://192.168.0.100/yum/base/9-prepatched/i386

# System timezone
timezone --isUtc Europe/Berlin
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part swap  --fstype="swap" --recommended --bytes-per-inode=4096
part /  --fstype="ext3" --grow --size=1 --bytes-per-inode=4096

%packages
@office
@editors
@system-tools
@legacy-fonts
@fonts
@text-internet
@gnome-desktop
@base
@java
@hardware-support
@legacy-software-support
@base-x
@graphics
@dial-up
@admin-tools
@graphical-internet
@sound-and-video
xorg-x11-fonts-ISO8859-1-100dpi

%end

4 Running A Kickstart Installation

Now it’s time to run our first Kickstart installation. Download http://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/9/Fedora/i386/os/images/boot.iso (or the full Fedora 9 DVD), burn it onto a CD, and boot the system from it.

At the boot prompt, press the Tab key:

27

You will then see a line beginning with vmlinuz. Add ks=http://192.168.0.100/yum/ks.cfg at the end of it (that’s the URL of our Kickstart file):

28

If all goes well, the system should install without interaction. After the installation you can try to update the system – yum should tell you that there are no updates available which is exactly what we wanted to achieve (unless there are new updates since the last time you downloaded the updates to the Kickstart server).

 

  • Fedora: http://fedoraproject.org/
  • Kickstart Documentation: http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/ch-kickstart2.html
  • Novi: http://www.exmachinatech.net/01/novi/

Comments

comments