Install and Configure Cobbler on Ubuntu 14.04

Thursday, November 26, 2015

Cobbler has always been my goto for provisioning bare metal servers. This is due in large part to its ability to provision CentOS, RHEL, Ubuntu, and Debian easily and quickly.

This post will cover setting up Cobbler on Ubuntu 14.04 and how to provision a server with Ubuntu Server 14.04.

Pick a Server

First and foremost, find and setup a server to act as your build server. The rest of this post will assume you are installing everything on that server.

Install Cobbler

Install the necessary packages:

apt-get install cobbler dhcp3-server

Configure the DHCP Server

A key part of PXE booting is the DHCP server. Cobbler supports both dhcp3-server and dnsmasq. This post will only cover dhcp3-server.

Open /etc/cobbler/settings and set the following parameters (you will need to search for these parameters in the configuration file):

manage_dhcp: 1
restart_dhcp: 1
next_server: <IP address of the network interface you want the PXE services to listen on>
server: <IP address of the network interface you want the PXE services to listen on>

Open /etc/cobbler/modules.conf and set the following parameter (you will need to search for this parameter):

module = manage_isc

Open /etc/default/isc-dhcp-server and configure the network interface for the DHCP server to listen on:

INTERFACES="Network interface you want the DHCP server to listen on"

Open /etc/cobbler/dhcp.template and configure your DHCP settings. Change the network, network ranges, and subnet mask to match your network:

subnet netmask {
     option routers   ;
     option domain-name-servers;
     option subnet-mask;
     range dynamic-bootp;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

Import Bootable ISOs

With the configuration files in place, it is now time to download the bootable ISOs and create a cobbler distro. This post will only cover importing Ubuntu Server 14.04.3.

Download the Ubuntu Server 14.04.3 ISO:


Mount the Ubuntu ISO:

mount -o loop ubuntu-14.04.3-server-amd64.iso /mnt

Import the Ubuntu ISO into cobbler to create a cobbler distro:

cobbler import --name=ubuntu-14.04.3-server-amd64 --path=/mnt

Unmount the Ubuntu ISO:

umount /mnt

Replace sources.list

Whether you use the included Preseed files with Cobbler or your own, unless explicitly set, Cobbler will rewrite the provisioned server’s sources.list file to pull packages from the Cobbler server. Unless you use Cobbler as a repository mirror, this is not a useful change.

The custom Preseed file in the next section will reference the default sources.list file you are able to download to ensure the provisioned server’s apt repositories download from instead of the Cobbler server.

Download the default Ubuntu 14.04 sources.list file:

wget -O /var/www/html/trusty-sources.list

Configure a Cobbler Profile

A cobbler profile maps a Kickstart or Preseed file to a particular cobbler distro.

The default Preseed file included with a Ubuntu based cobbler profile is not unattended and will require user interaction during installation. Download the following custom Preseed which is unattended:

wget -O /var/lib/cobbler/kickstarts/ubuntu-server-14.04-unattended-cobbler.seed

Next, create a new cobbler profile using the new Preseed file with the following command:

cobbler profile add \
--name ubuntu-14.04.3-server-unattended \
--distro ubuntu-14.04.3-server-x86_64 \
--kickstart /var/lib/cobbler/kickstarts/ubuntu-server-14.04-unattended-cobbler.seed

Finally, restart and sync Cobbler:

service cobbler restart

cobbler sync

At this point, you can PXE boot any server that is on the same network as the Cobbler services ((tftpd, dhcpd, httpd) are listening on. Each server will PXE boot to a menu where you can select to continue to local boot or boot to the cobbler profile you created above.

If you are setting up a Cobbler server in Virtual Box and are having issues obtaining a DHCP address for PXE booting, you may need to enable Promiscuous Mode in Virtual Box for the interface the Cobbler services are listening on.

Configure a Cobbler System

If you want to be able to reboot a server and have it automatically begin installing Ubuntu Server without user interaction, you are going to need to setup a cobbler system.

First, get the MAC address of the network interface enabled to PXE boot from the to be provisioned server.

Second, figure out a hostname for the server and figure out what IP address you want to assign it. In this example, I will use for the hostname, for the IP address, and em1 as the network interface enabled to PXE boot.

Finally, with that information, create the cobbler system:

cobbler system add \ \
--mac=00:01:02:03:04:05 \
--profile=ubuntu-14.04.3-server-unattended \ \
--interface=em1 \
--ip-address= \
--subnet= \
--gateway= \
--name-servers= \

Reboot the server you want to provision and it should begin PXE booting on its own. After about 10 minutes, you should be at the Ubuntu login screen.

Cobbler Gotchas

Static DHCP Entry Disappears

If you created a cobbler system with static=1 and assigned it a static IP address, then use cobbler system edit to set netboot to false, and run cobbler sync, the static DHCP entry in /etc/dhcp/dhcpd.conf will disappear.

The fix is to remove static=1 from the cobbler system entry.

comments powered by Disqus