Kickstart Oracle Linux from Ubuntu

Jan 09, 2012

As my new job involves working on Oracle Linux, I figured I should migrate my home server to it, which would also mean I could move it to a proper RAID10 configuration rather than relying on multiple RAID1s.

My laptop runs Ubuntu, and I wanted to install the server from it using PXE and Kickstart, so here’s how I did it.

Configure dhcpd

DHCP is required for two things, to give the server its network configuration, and to point it at the PXE boot loader we want to use.

$ sudo apt-get install isc-dhcp-server
$ sudo vi /etc/dhcp/dhcpd.conf

Here’s the configuration I used, which says to configure with a dynamic DHCP range between –, and to boot machines using pxelinux.0 which is relative to the TFTP root directory (configured in the next section):

subnet netmask {
    filename "pxelinux.0";

The isc-dhcp-server install automatically tries to start the server, but will fail as it isn’t configured, so we restart it now that there is a working configuration installed

$ sudo /etc/init.d/isc-dhcp-server restart

Configure tftpd

TFTP is a simple protocol used to transfer files over the network, and due to its simplicity it is the primary way to network boot, as it can be easily embedded into firmware.

All we need to do is install the TFTP daemon and syslinux which includes the PXE boot loader, then put the pxelinux file into the tftproot area:

$ sudo apt-get install syslinux tftpd-hpa
$ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot

Configure Oracle Linux DVD

To save space on the laptop we can just mount the DVD read-only and install from that:

$ sudo mkdir /media/ol6.2
$ sudo mount -o loop,ro /path/to/OracleLinux-R6-U2-Server-x86_64-dvd.iso /media/ol6.2

However, we do need to copy the kernel and initrd image from the DVD into the tftproot as they are required for booting:

$ sudo mkdir /var/lib/tftpboot/ol6.2 /var/lib/tftpboot/pxelinux.cfg
$ sudo cp -a /mnt/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/ol6.2/

Configure pxelinux

All that’s left for the PXE stage is to configure the boot loader, and tell it what kernel and initrd we want to use:

$ sudo vi /var/lib/tftpboot/pxelinux.cfg/default

This configuration has just one entry which is booted after a short wait, but pxelinux has many more options, including the ability to boot from local disk.


LABEL ol6.2
    KERNEL /ol6.2/vmlinuz
    APPEND initrd=/ol6.2/initrd.img ks=

Note the ks argument which specifies the kickstart file we will use, that and the web server required to serve it will be set up next.

Configure nginx

I chose nginx as it is small and simple to configure, but any web server will do.

$ sudo apt-get install nginx
$ sudo vi /etc/nginx/sites-available/default

The install will be performed over HTTP, so we need to make the DVD we mounted earlier available. This entry in the server { } section makes the DVD available via

server {
    location /ol6.2 {
        root /media;
        autoindex on;
        allow all;

Then start nginx (unlike isc-dhcp-server this isn’t done automatically):

$ sudo /etc/init.d/nginx start

Configure kickstart

Finally, we create a kickstart configuration which specifies exactly how our target machine is to be installed, and this allows a completely unattended installation.

Ideally I should create a specific area for holding files like this, but as a quick hack I simply put it into the default nginx web root (and thus available as as configured earlier in the pxelinux.cfg/default file:

sudo vi /usr/share/nginx/www/ks.cfg

Here is my ks.cfg file in full. The only thing missing is a rootpw line to automatically set a root password, however for maximum security I am happy to forego a completely unattended installation and instead have the installer prompt me to type it in during the install.

Some notes:

  • UK keyboard language and timezone selected.
  • Automatically reboot when the installer is finished.
  • Point to the Oracle Linux DVD using the url directive.
  • I have 4 disks configured with RAID1 for /boot, and RAID10 for swap and /.
  • Disks are referred to by path, to ensure correct ordering.
  • A small set of packages are installed, containing just the functionality I require.
  • A small %post section is used to perform any fixes I want for the first boot.
# Miscellaneous options.
keyboard uk
lang en_GB.UTF-8
selinux --enforcing
timezone Europe/London

# User setup.  I'd create my local user here and configure sudoers, but
# kickstart doesn't yet support creating a user with uid/gid of 1000 (the
# gid is always 500, even if you add the named group first).
authconfig --enableshadow --passalgo=sha512

# Networking.  The 'network' line needs to be on a single line
# for kickstart to work - it is only split here for the blog.
firewall --service=ssh
network --bootproto=static \ \
        --ip= \
        --netmask= \
        --gateway= \
        --nameserver=, \
url --url=

# Disk configuration.
bootloader --location=mbr --driveorder=sda,sdb,sdc,sdd
clearpart --all --initlabel
# /boot (RAID1 necessary as booting from RAID10 isn't supported)
part raid.00 --asprimary --size=1024 --ondisk=/dev/disk/by-path/pci-*-0*0
part raid.01 --asprimary --size=1024 --ondisk=/dev/disk/by-path/pci-*-1*0
part raid.02 --asprimary --size=1024 --ondisk=/dev/disk/by-path/pci-*-2*0
part raid.03 --asprimary --size=1024 --ondisk=/dev/disk/by-path/pci-*-3*0
raid /boot --level=1 --device=md0 --fstype=ext4 raid.00 raid.01 raid.02 raid.03
# swap, RAID10 of size RAM+2GB, give or take..
part raid.10 --asprimary --size=6144 --ondisk=/dev/disk/by-path/pci-*-0*0
part raid.11 --asprimary --size=6144 --ondisk=/dev/disk/by-path/pci-*-1*0
part raid.12 --asprimary --size=6144 --ondisk=/dev/disk/by-path/pci-*-2*0
part raid.13 --asprimary --size=6144 --ondisk=/dev/disk/by-path/pci-*-3*0
raid swap --level=10 --device=md1 --fstype=swap raid.10 raid.11 raid.12 raid.13
# /, RAID10 of remainder (have to specify an arbitrary --size even with --grow)
part raid.20 --asprimary --size=1024 --grow --ondisk=/dev/disk/by-path/pci-*-0*0
part raid.21 --asprimary --size=1024 --grow --ondisk=/dev/disk/by-path/pci-*-1*0
part raid.22 --asprimary --size=1024 --grow --ondisk=/dev/disk/by-path/pci-*-2*0
part raid.23 --asprimary --size=1024 --grow --ondisk=/dev/disk/by-path/pci-*-3*0
raid / --level=10 --device=md2 --fstype=ext4 raid.20 raid.21 raid.22 raid.23

# Packages.  @base and @core are pre-selected.
@console-internet --optional
@legacy-unix --optional
@network-server --optional

# Post-install fix-ups.
# The 'network' directive doesn't support DNS search paths, so set those
# manually, and disable Network Manager.
printf "/^NM_CONTROLLED/s/yes/no/\nw\nq\n" \
  | ed /etc/sysconfig/network-scripts/ifcfg-eth0
printf "/^#/s/.*/search\nw\nq\n" \
  | ed /etc/resolv.conf
# Disable unwanted services
chkconfig --del cups

All done.

Share this post on Twitter, HackerNews, Facebook or Google+

All Posts