Cobbler, kickstart, and PXE boot

When working with Linux clusters, many tools used for operating system deployment can be integrated via Cobbler. Cobbler is a Linux installation server that allows for rapid setup of network installation environments. A typical process as a cluster administrator involves kickstart configuration files that need to be shared via HTTP, yum repositories, and perhaps a couple of different versions of the operating system that need to be available for over-the-network PXEboot install. Cobbler makes network installs much easier, maintaining your software repos, system profiles, and dhcp services.

Install RPMs
You can manually download the required RPMs into your own repo from EPEL or just install the epel-release-x.x.rpm if your system is online.

yum -y install cobbler cman createrepo dhcp httpd tftp-server yum-utils

Edit /etc/cobbler/settings

change “server” and “next_server” to internal IP address, ex: 192.168.0.100

server: 192.168.0.100
next_server: 192.168.0.100
manage_dhcp: 1
pxe_just_once: 1  # to avoid reinstall looping

Since we already have DNS running on another server, we don’t need to have Cobbler managing DNS or doing anything with bind.

Edit /etc/cobbler/dhcp.template
Note: this file takes precedence over /etc/dhcp.conf and overwrites it. First, copy /etc/dhcpd.conf to /etc/cobbler/dhcp.template, before starting cobbler services.

# /etc/cobbler/dhcp.template
ddns-update-style ad-hoc;
allow booting;
allow bootp;

subnet 192.168.0.0 netmask 255.255.255.0 {
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.0.255;
  option domain-name "test.fqdn.org";
  option domain-name-servers 192.168.0.100;
  option routers 192.168.0.254;
  filename "/pxelinux.0";
  range dynamic-bootp 192.168.0.101 192.168.0.200;
  next-server 192.168.0.100;
}
host node1 {
  hardware ethernet 00:AA::BB:CC::DD::EF;
  fixed-address 192.168.0.1;
  next-server 192.168.0.100;
  option host-name "node1";
}

Confirm that firewall ports are open:
tcp+udp 53, 68, 69, 80, 123, 25150, 25151, 25152
Use system-config-securitylevel if on RHEL or CentOS.

Start services:

/etc/init.d/cobblerd start
service httpd restart

Install content for net boot loaders.

cobbler get-loaders

Edit these files:
/etc/xinetd.d/tftp, /etc/xinetd.d/rsync: set disable to no

Set processes to start at boot:

for i in xinetd cobblerd httpd dhcpd
do
chkconfig $i on
/etc/init.d/$i start
done

service cobblerd restart
service httpd restart

cobbler check

Follow configuration suggestions listed by ‘cobbler check.’

Begin setting up Cobbler profiles
Now it’s time to set up the three elements of cobbler: distro, profile, and system.

1. Define the distro with “cobbler import” for Red Hat base. By default, Cobbler
rsyncs the rhel dvd for you to /var/www/cobbler, unless you use ‘–available-as’

cobbler import --path=/rhel-5-server-x86_64 --name=rhel-5.5 --arch=x86_64 \
--available-as=http://192.168.0.100:/rhel5
cobbler distro report

2. Add a repo for extra rpms to be included

cobbler repo add --mirror=/extras --name="extras"
cobbler reposync

3. Create the profile for compute nodes. If adding multiple repos, use quotes and space in between.
Copy the kickstart file to be used to a folder that is shared via the web, such as under /var/www/html and reference it here.

cobbler profile add --name=computenodes --repo="extras" --distro=rhel-5.5 \
--kickstart=http://192.168.0.100/kickstart.cfg

Edit these lines in the kickstart file to point to the web shared OS install path/repo:

url --url http://192.168.0.100/cobbler/ks_mirror/rhel-5.5-x86_64/
repo --name=extras --baseurl=http://192.168.0.100/cobbler/repo_mirror/extras

You will also have to configure each node’s IP address in the kickstart file, either manually or via a scripted variable. (grep last octet of IP address received on boot and dynamically add into configured IP in ifcfg-eth0 )

4. Add a system

cobbler system add --name=node1 --profile=computenodes --ip=192.168.0.1 \
--netmask=255.255.255.0 --hostname=node1 --mac=AA:BB:CC:DD:EE \
--static=true --netboot-enabled=true

Try running “cobbler system report” to view your new systems.

Run ‘cobbler sync’ one more time and the system should now be fully added to /tftpboot.

Remember that ‘cobbler sync’ also restarts dhcp services automatically. If you are part of a larger organization and not using central dhcp, it may be wise to double-check your dhcp.template to ensure that you are only broadcasting on your cluster’s internal network.

You should now be ready to install a new node on reboot.

If you choose to leave your system configured with the BIOS option to network boot first, simply disable the netboot option:

cobbler system edit --name=node1 --netboot-enabled=false

and re-enable it later if you need to rebuild it.

Cobbler is a great tool for system provisioning.

For those interested, check out my other blog page on automating Cobbler netinstalls with Ansible and VMware here.

Advertisements