Ubuntu Lucid 10.04 Cobbler Kickstart Setup How To

Tags: , , , , , , , , , , , ,

Importing the ISO

At the time of this writing the version of cobbler available for CentOS-5 via the EPEL repo was 2.0.3.1. This version doesn’t seem to include proper support for “breeds” other than redhat, allthough it is alluded to in the documentation. So, in order to import the ubuntu media, I had to perform a few extra manual steps.

Copy the ISO contents to a directory that corresponds to the name of your distro

In my case this is Ubunutu-10.04-x86_64. I created the directory /var/www/cobbler/ks_mirror/ and copied the entire contents of the mounted ubunutu lucid installer ISO to this location.

To mount an iso file in linux the command is something like

mount -o loop /path/to/lucid.iso /mnt/foo

Creating the .treeinfo file manually

Once the files have been copied, you should put a .treeinfo file in place too. Koan freaked out when this file wasn’t present when I attempted to perform a –virt install. I think this is safe to omit if you aren’t planning on using Koan.

[general]
family = Ubuntu
timestamp = 1272326522.13
totaldiscs = 1
version = 10.04
discnum = 1
packagedir = dists
arch = x86_64
 
[images-x86_64]
kernel = install/netboot/ubuntu-installer/amd64/linux
initrd = install/netboot/ubuntu-installer/amd64/initrd.gz

Creating the Distro

Now, it’s time to create the cobbler distro manually. This is straightforward enough, just double check all your paths and names to make sure evertyhing matches up.

Here’s what mine looks like:

[root@cobbler cobbler]# cobbler distro report --name="Ubuntu-10.04-x86_64"
Name                           : Ubuntu-10.04-x86_64
Architecture                   : x86_64
Breed                          : generic
Comment                        : 
Initrd                         : /var/www/cobbler/ks_mirror/Ubuntu-10.04-x86_64/install/netboot/ubuntu-installer/amd64/initrd.gz
Kernel                         : /var/www/cobbler/ks_mirror/Ubuntu-10.04-x86_64/install/netboot/ubuntu-installer/amd64/linux
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {'tree': 'http://@@http_server@@/cblr/links/Ubuntu-10.04-x86_64'}
Management Classes             : []
OS Version                     : generic26
Owners                         : ['admin']
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

In my case I specificed a Breed of “generic” and an OS Version of “generic26”. Here’s hoping that this gets sorted out formally and makes its way through the EPEL repo soon.

Creating the Ubuntu 10.04 Lucid Kickstart Template

Here’s an example kickstart that is working for automated installes of Ubunutu 10.04 Lucid. It’s not 100% dynamic, but it works well.

#/var/lib/cobbler/kickstarts/lucid.ks
#
 
#System language
lang en_US
 
#Language modules to install
langsupport en_US
 
#System keyboard
keyboard us
 
#System mouse
mouse
 
#System timezone
timezone America/New_York
 
#Root password
rootpw --iscrypted $default_password_crypted
 
#Initial user
user --disabled
 
#Reboot after installation
reboot
 
#Use text mode install
text
 
#Install OS instead of upgrade
install
 
# Use network installation
url --url=$tree
 
#System bootloader configuration
bootloader --location=mbr 
 
#Clear the Master Boot Record
zerombr yes
 
#Partition clearing information
clearpart --all --initlabel 
 
#Disk partitioning information
part swap --size 512
part / --fstype ext3 --size 1 --grow 
 
#System authorization infomation
auth  --useshadow  --enablemd5
 
#Network information
network --bootproto=dhcp --device=eth0
 
#Firewall configuration
firewall --enabled --trust=eth0 --ssh 
 
#Do not configure the X Window System
skipx
 
%pre
 
#services
services --enabled=ntpd,nscd,puppet
 
#Package install information
%packages
ubuntu-standard
man-db
wget
postfix
openssh-server
sysstat
nfs-common
nscd
postfix
quota
ntp
puppet
 
%post
#raw
sed -i 's/no/yes/' /etc/default/puppet 
#end raw

Creating the Profile

Creating the profile is much like creating the distro, matching up the vairables. I’ve also specified some extra kernel options to output the installer to the serial console (ttyS0) which I find preferable for –virt installs.

[root@cobbler cobbler]# cobbler profile report --name="Ubuntu-10.04-x86_64"
Name                           : Ubuntu-10.04-x86_64
Comment                        : 
DHCP Tag                       : default
Distribution                   : Ubuntu-10.04-x86_64
Enable PXE Menu?               : False
Kernel Options                 : {'text': '~', 'console': ['tty0', 'ttyS0,9600n8'], 'nofb': '~'}
Kernel Options (Post Install)  : {'console': ['tty0', 'ttyS0,9600n8'], 'nofb': '~'}
Kickstart                      : /var/lib/cobbler/kickstarts/lucid.ks
Kickstart Metadata             : {}
Management Classes             : []
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : ['ubuntu-lucid-x86_64']
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 0
Virt Bridge                    : br345
Virt CPUs                      : 1
Virt File Size(GB)             : 5
Virt Path                      : 
Virt RAM (MB)                  : 512
Virt Type                      : qemu

Note: I manually created an apt-mirror named ubunutu-lucid-x86_64. You could use any other ubuntu repo you’d like, local or remote.

Notes & Future Improvements

This should get you going in the right direction towards automating your ubuntu builds with a cobbler install sourcesd from EPEL. Hopefully soon a fix for this will make its way into the EPEL repos.