Ready to Start Your Career?

Red Hat System Administration: Automation using Cobbler

variiable 's profile image

By: variiable

May 3, 2018

Cobbler is a Linux installation server that allows for rapid setup of network installation environments. In this OP3N post, we’ll look at how to setup and configure Cobbler to be utilized in our network environment.

This could be a little complex at first, but it helps a lot with installations, all you need is to integrate new packages in Cobbler package manager and require no configuration at all, it’ll set up everything automatically for you.


Before getting started with Cobbler you should have a good understanding of PXE and the automated installation methodology of Red Hat Enterprise Linux.

This topic on Cybrary OP3N will only cover setting up Cobbler using the command line interface and not the web-based GUI.

Getting Started:

Before getting started with Cobbler set SELinux to “permissive mode”. Go to vim /etc/selinux/config and set SELINUX = permissive then save & quit. (Pressing Shift+: and then writing wq and press enter)

Now, we’ll install Cobbler using yum install cobbler this will pull in all the requirements that you need for a basic setup.

Configuring Cobbler:

Before starting cobber daemon or cobblerd service, we should configure a few things up. The configuration file for cobbler is stored in /etc/cobbler/settings. Make sure to keep the format of this configuration file in YAML, if it gets incorrectly formatted it’ll prevent cobblerd service from running.

Inside the Cobbler configuration file change the default_password_crypted using the command $ openssl passwd -1 and inserting the output string into the default_password_crypted along with the quotation marks.

The server option sets the IP that will be used for the address of the cobbler server. This IP should be used by hosts that are going to be built by cobbler server on protocols such as HTTP and TFTP.

The next_server option is used for DHCP/PXE as the IP of the TFTP server from which network boot files are downloaded. Usually, this is the same IP as the server.

In order to PXE boot, you need a DHCP server to hand out addresses and direct the booting system to TFTP server where it can download the network boot files. Cobbler manages this for you via the manage_dhcp setting, it’s 0 by default, set it to 1 so that cobbler will generate dhcpd.conf file based on DHCP template that is included in the cobbler.

Now, we should modify that DHCP template as well, according to our network settings

$ vim /etc/cobbler/dhcp.template

You only need to modify the following block:

subnet netmask {option routers   ;option domain-name-servers,;option subnet-mask;filename                   "/pxelinux.0";default-lease-time         21600;max-lease-time             43200;next-server                $next_server;}

DO NOT modify “next-server $next_server;” line, as this is how the next_server setting is transmitted into the configuration. Since, the file is formatted into Cheetah format, make sure to not to edit anything after this line:

#for dhcp_tag in $dhcp_tags.keys():

If you’d like to see the syntax of a cheetah formatted file you could see it at man dhcpd.conf

Files and Directory:

All the repository of Cobbler is situated at /var inside /var/www/cobbler/ks_mirror directory. So you need to make it of around 10GB in space. If you’ve already installed it to /var with much lesser space than i’ll be writing about how to relocate your installation properly down below in this article.

Cobbler Service:

Finally, after all the required configuration of Cobbler, we’ll start and enable cobbler daemon service

$ systemctl start cobblerd.service

$ systemctl enable cobblerd.service

If everything has gone well, you may see the status of this service as Active (running).

Now that cobbler service is up and running, we’ll look for problems! Yeah, that’s what system administrators do!

$ cobbler check

Well, if you decide to follow any of the suggestion, such as to install extra package, changing configurations, etc, be sure to restart the cobbler service as it applies the changes.

Synchronize for the first time

As we’ve checked for the configuration suggestions it’s time to synchronize for the first time

$ cobbler sync

And check for any errors in any of the configuration that we’ve done so far. If no issues are shown and it states TASK COMPLETE than we’re ready to move on the next step since everything is in good configuration state.

Importing distribution

In order to import a distribution to Cobbler, you will need DVD/ISO of RHEL.

NOTE: Don’t use Live CD ISO of your distributions.

Mount the DVD over /mnt to start the next step. If you don’t know how mounting happens, read my article of “Yum server configuration”.

Running the import

Since we’ve mounted our DVD on /mnt it’s time to run the import for cobbler server. To do that, simply type in the following command:

$ cobbler import --name=DISTNAME --arch=ARCHITECTURE --path=/mnt

The --arch option is not necessary and can be skipped as it is normally detected.

Listing Objects

If you get no error during the import, you can video details about distros and profiles that were created during the import

$ cobbler distro list

$ cobbler profile list

Creating a System

And it’s the time! Now that we have our distro and profile, we can create a system! Profiles can be used to PXE boot.

First, we’ll create a system object based on the profile that was created during the import.

$ cobbler  system add  --name=SYSTEMNAME  --profile=PROFILENAME

$ cobbler  system list


$ cobbler  system report  --name=SYSTEMNAME

This will show the complete report of newly created system. The reason behind creating a system is network configuration! While using profiles, you become limited to DHCP interfaces, but with systems you can specify many more network configuration options.

So now we’ll set up a single interface in network:

$ cobbler  system edit  --name=SYSTEMNAME  --interface=eth0 --mac=MACADDRESS --ip-address= --netmask= --static=1

Add a default gateway

$ cobbler system edit --name=SYSTEMNAME --gateway=

So now whenver a system is modified the cobbler executes lite sync that regenerates critical files such as PXE boot file in the TFTP root directory. It’ll not execute service management actions and you’ve to do that manually, such as restarting DHCP service, etc.

After adding a system with a static interface it is a good idea to execute a full cobbler sync to ensure that dhcpd.conf file is rewritten with the correct static lease and the service is bounded.

EXTRA: Relocating your installation

You may have already noticed that you can reconfigure the webdir location just by editing the configuration file of cobbler at /etc/cobbler/settings but it is not the proper way to do it as you’ll break things during updates.

The recommended way according to cobbler guidelines is to copy everything you have in /var/www/cobbler to another location of your choice. Make sure you’ve around 10GB of free space on the path you’re moving your cobbler files to.

Create a symlink or bind mount at /var/www/cobbler that points to your new destination and that’s it! You’ve successfully relocated your installation.

Schedule Demo