Piment Noir Wiki

Introduction

This page present a cobbler's software description :

  • installation;
  • configuration;
  • exploitation.

Installation

RHEL/CentOS/Scientific Linux

Cobbler is packaged for RHEL variants through the Fedora EPEL (Extra Packages for Enterprise Linux) system. Follow the directions there to install the correct repo RPM for your RHEL version and architecture. For example, on for a RHEL6.x x86_64 operating system:

$ sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-X-Y.noarch.rpm

Be sure to use the most recent X.Y version of the epel-release package.

Once that is complete, simply use the yum command to install the cobbler package:

$ sudo yum install cobbler cobbler-web

As noted above, new releases in the Fedora packaging system are held in a “testing” repository for a period of time to vet bugs. If you would like to install the most up to date version of cobbler through EPEL (which may not be fully vetted for a production environment), enable the -testing repo when installing or updating:

$ sudo yum install --enablerepo=epel-testing cobbler cobbler-web

or

$ sudo yum update --enablerepo=epel-testing cobbler cobbler-web

Once cobbler is installed, start and enable the service:

$ service cobblerd start
$ chkconfig cobblerd on

Then start and enable the HTTP server:

$ service httpd start
$ chkconfig httpd on 

Then install, start and enable the DHCP server:

$ yum install dhcp
$ service dhcpd start
$ chkconfig dhcpd on 

Debian/Ubuntu based distribution

TODO

Configuration

Relocation

Move the data directory that cobbler will use to generate repositories, installation configuration, and so on to a more appropriate place with a lot of disk space:

$ mv /var/www/cobbler /data/
$ ln -s /var/www/cobbler /data/cobbler

Operating system

The cobbler server will be connected to network via two NICs :

---------         ---------
|cobbler|--eth1-- |E.C.   |
|server |         |network|
---------         --------- 
    |
   eth0 
    |
---------
|Install|
|network|
--------- 

Installation network IP address space is 152.31.108.0/24, ideally, it should not overlap the E.C. networks IP address space - which is not the case actually -. IP address space overlapping can be good only if you want to configure the NICs on each computer during the installation and just PnP the installed computer on the destination network.

IP on the install network : 152.31.108.250
IP on the E.C. network : 152.31.108.168.

DHCPD template

$ vi /etc/cobbler/dhcp.template

Relevant configuration block to change or adapt to your network address space:

--- 8< --- /etc/cobbler/dhcp.template
...
subnet 192.168.1.0 netmask 255.255.255.0 {
     option routers             192.168.1.1;
     option domain-name-servers 192.168.1.210,192.168.1.211;
     option subnet-mask         255.255.255.0;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}
...
--- >8 ---

DHCPD configuration

Ensure that dhcpd will only listen on the installation network :

$ vi /etc/sysconfig/dhcpd
--- 8< --- /etc/sysconfig/dhcpd
DHCPDARGS=eth0
--- >8 ---

Cobbler

Run

$ clobbler check

and correct the items listed that exhibit configuration troubles.

Modifications to cobbler main configuration file :

$ vi /etc/cobbler/settings
--- 8< --- /etc/cobbler/settings
...
# default, localhost
server: 152.31.108.250
...
# default, localhost
next_server: 152.31.108.250
...
# default, don't manage
manage_dhcp: 1
...
--- >8 ---

Once you've finished, do not forget to run

cobbler sync

Exploitation

cobbler design is layered : system configuration inherit profile configuration that inherit from distro configuration. You should keep that in mind when you work on it to design each layer that will fit your workflow. For example, distro layer should not have custom kickstart template, reserve the kickstart template to an upper layer.

This section is somewhat Debian or RHEL centric for now.

Distribution's importation

Mount the installation media of the targeted GNU/Linux distros as a loopback block device :

$ mkdir /mnt/loop0
$ mount -o loop /path/to/distro/iso /mnt/loop0

RHEL

$ cobbler import --name=rhel5.7 --arch=i386 --path=/path/to/rhel/mountediso
$ cobbler import --name=rhel5.7 --arch=x86_64 --path=/path/to/rhel/mountediso

Debian

For Debian, import the debian-6.0.6-<arch>-CD-1.iso preferably or even an higher revision of the same major version if you do not have a network connection.

$ cobbler import --name=debian6 --arch=i386 --path=/path/to/debian/mountediso
$ cobbler import --name=debian6 --arch=x86_64 --path=/path/to/debian/mountediso

Grab the netboot tarball :

$ wget http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64/current/images/netboot/netboot.tar.gz -O netboot-am64.tar.gz
$ wget http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-i386/current/images/netboot/netboot.tar.gz -O netboot-i386.tar.gz

Untar the netboot tarball to an appropriate location :

$ mkdir -p /data/images/debian6-amd64
$ tar zxvf netboot-am64.tar.gz -C /data/images/debian6-amd64
$ mkdir -p /data/images/debian6-i386
$ tar zxvf netboot-i386.tar.gz -C /data/images/debian6-i386

Change the distro Debian cobbler layer kernel and initramfs to the netboot ones :

$ cobbler distro edit --name=debian6-x86_64 --kernel=/data/images/debian6-amd64/debian-installer/amd64/linux --initrd=/data/images/debian6-amd64/debian-installer/amd64/initrd.gz
$ cobbler distro edit --name=debian6-i386 --kernel=/data/images/debian6-i386/debian-installer/i386/linux --initrd=/data/images/debian6-i386/debian-installer/i386/initrd.gz

You might encounter bugs with the Debian installer on squeeze (or not) : Debian kernel do not see disks for example. Try backported squeeze iso and netboot tarball here http://kmuto.jp/debian/d-i/

The initial import will create on very recent cobbler version some pre-configured repositories that you will need to synchronize.

View newly created repositories :

$ cobbler repo list

Adapt environment variables to fit proxy settings :

$ cobbler repo edit --name=repo_name --environment="http_proxy=http://username:password@proxy-ec.eu.eurocopter.corp:8080/"

Synchronize the repository :

$ cobbler reposync --only=repo_name

If you have a network connection, have a look at :

https://fedorahosted.org/cobbler/wiki/DebianDeployment

Ubuntu

TODO

Third party repositories mirroring

To mirror EPEL repository for RHEL5, grab a mirror URL located nearby and:

$ cobbler repo add --mirror=http://mirror.affix.me/epel/5/i386/ --name=EPEL5-i386 --arch=i386 --environment="http_proxy=http://username:password@proxy-ec.eu.eurocopter.corp:8080/"
$ cobbler repo add --mirror=http://mirror.affix.me/epel/5/x86_64/ --name=EPEL5-x86_64 --arch=x86_64 --environment="http_proxy=http://username:password@proxy-ec.eu.eurocopter.corp:8080/"

Then run :

$ cobbler reposync --only=EPEL5-i386
$ cobbler reposync --only=EPEL5-x86_64

Profile creation

Create a profile reusing previous kickstart template (NOTE: kickstart raw file must be adapted to fit cobbler kickstart template engine : Cheetah).

$ cobbler profile add --name=rhel5.7-i386-ks --distro=rhel5.7-i386 --kickstart=/data/KS/redhat/5/rhel-common.ks --repos="repo_name_01 repo_name_02"
$ cobbler profile add --name=rhel5.7-x86_64-ks --distro=rhel5.7-x86_64 --kickstart=/data/KS/redhat/5/rhel-common.ks --repos="repo_name_01 repo_name_02"

The same goes for debian and its preseed system :

First rename the Debian x86_64 profile in case you want to use it directly, Debian installer do not like underscore :

$ cobbler profile rename --name=debian6-x86_64 --newname=debian6-amd64
$ cobbler profile add --name=debian6-i386-ec --distro=debian6-i386 --kickstart=/data/KS/debian/6/debian-common.seed 
$ cobbler profile add --name=debian6-amd64-ec --distro=debian6-x86_64 --kickstart=/data/KS/debian/6/debian-common.seed

All kickstart and preseed files are in /data/KS.

System creation

If you want to install two boxes with two different MAC addresses and two different hostnames for two different processor types, first create a system that will inherit configuration from a profile:

$ cobbler system add --name=rhelwsec-i386 --profile=rhel5.7-i386-ks --hostname=computer_name --mac=AA:BB:CC:DD:EE:FF
$ cobbler system add --name=rhelwsec-x86_64 --profile=rhel5.7-x86_64-ks --hostname=computer_name --mac=GG:HH:II:JJ:KK

Troubleshooting

  1. Make sure the local switch is powered and the install network cable is wired
  2. Run
cobbler check 

and

cobbler sync