Cobbler

Cobbler

Cobbler is a Linux provisioning server that facilitates and automates the network-based system installation of multiple computer operating systems from a central point using services such as DHCP, TFTP, and DNS.

It can be configured for PXE.

Cobbler is able to manage complex network scenarios like bridging on a bonded Ethernet link.

Cobbler can help with provisioning, managing DNS and DHCP, package updates, power management, configuration management orchestration, and much more.

Cobbler builds on the Kickstart mechanism and offers installation profiles that can be applied to one or many machines. It also features integration with Yum to aid in machine installs. This will help to install several servers in a data centre without physically accessing them.

All the servers should be on the same series of the network, as servers need to interact with each other. The first boot order for Test-VM must be network.

Disable SELinux

Before getting started with Cobbler, it would be better to disable selinux and firewall or apply the firewall rules. The better option would be to disable initially and enable firewall rules after completion.

Cobbler runs on ports 69, and 25151, http ports (80/443).

Install Cobbler

Cobbler is not available on CentOS default repositories, so let us add EPEL repository first, and install Cobbler.

How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x

 

## RHEL/CentOS 7 64-Bit ##

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

# rpm -ivh epel-release-7-5.noarch.rpm

 

## RHEL/CentOS 6 32-Bit ##

# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

# rpm -ivh epel-release-6-8.noarch.rpm

 

## RHEL/CentOS 6 64-Bit ##

# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

# rpm -ivh epel-release-6-8.noarch.rpm

 

## RHEL/CentOS 5 32-Bit ##

# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

# rpm -ivh epel-release-5-4.noarch.rpm

 

## RHEL/CentOS 5 64-Bit ##

# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

# rpm -ivh epel-release-5-4.noarch.rpm

 

Install the pre-requisite software packages

#yum install -y createrepo httpd mkisofs mod_wsgi mod_ssl python-cheetah python-netaddr python-simplejson python-urlgrabber rsync dhcp nsyslinux tftp-server yum-utils wget debmirror ​fence-agents syslinux dnsmasq

Now, install cobbler, cobbler web interface, and its dependencies as shown below.

# yum install cobbler PyYAML Django cobbler-web dhcp debmirror pykickstart system-config-kickstart dhcp mod_python tftp cman -y

Enable TFTP and rsync in XINETD Change disable = yes to disable = no.

# chkconfig httpd on

# chkconfig xinetd on

# chkconfig cobblerd on

# service httpd start

# service xinetd start

# service cobblerd start

Configure DHCP

Copy the sample dhcpd configuration file.

#cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

Edit dhcpd.conf file,

#vi /etc/dhcp/dhcpd.conf

Find the following directive, and match to suits your configuration. Here is mine.

[…]

# A slightly different configuration for an internal subnet.

subnet 192.168.1.0 netmask 255.255.255.0 { 

range 192.168.1.100 192.168.1.254; 

option domain-name-servers server.sysadminslab.com; 

option domain-name ” sysadminslab.com “; 

option routers 192.168.1.1; 

option broadcast-address 192.168.1.255; 

default-lease-time 600; 

max-lease-time 7200;

}

Now, start service.

#service dhcpd start

Make service to start automatically on every reboot.

#chkconfig dhcpd on

Start the Cobbler services.

[root@cobbler ~]# systemctl enable cobblerd

ln -s ‘/usr/lib/systemd/system/cobblerd.service’ ‘/etc/systemd/system/multi-user.target.wants/cobblerd.service’

[root@cobbler ~]# systemctl start cobblerd

[root@cobbler ~]# 

[root@cobbler ~]# systemctl enable httpd

ln -s ‘/usr/lib/systemd/system/httpd.service’ ‘/etc/systemd/system/multi-user.target.wants/httpd.service’

[root@cobbler ~]# systemctl start httpd

 

The package cobbler-web provides a beautiful web interface with default user and password as ‘cobbler’. The web interface can be accessible using below link.

https://ip-address-of-cobbler/cobbler_web.

Configuration

Configuration includes changes in the settings file. Settings for cobbler/cobblerd are stored in /etc/cobbler/settings. This file is a YAML formatted data file.

This setting default_password_crypted controls the root password that is set for new systems during the kickstart. This should be modified by running the command openssl passwd -1 and inserting the output into the above string.

In order to PXE boot, you need a DHCP server to hand out addresses and direct the booting system to the TFTP server where it can download the network boot files. Cobbler can manage this for you, via the manage_dhcp setting.

The server option sets the IP that will be used for the address of the cobbler server. 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 will be the same IP as the server setting.

Configure Cobbler

Now, we have to edit cobbler’s settings file, and do some a couple changes.

#vi /etc/cobbler/settings

Find the line “default_password_crypted”, and set the new generated password which is created with command “opennssl password” command:

[…]

default_password_crypted: “$1$ndjyqT1S$rR/kwWjcem7t6VdNyWIC3.”

[…]

Find the line “manage_dhcp: 0” line, and change it’s value to 1 to enable conbbler’s dhcp management features.

[…]

manage_dhcp: 1

[…]

Set your Cobbler’s IP address in “server” and “next_server” fields.

[…]

next_server: 192.168.1.222

[…]

server: 192.168.1.222

[…]

Once you modified all the above settings, save and close the file.

Now, edit file /etc/cobbler/dhcp.template, This template will most likely need to be modified as well, based on your network settings. The parameter range dynamic-bootp should have the range of IPs.

#vi /etc/cobbler/dhcp.template

Make the changes as shown below. Replace the IP range with your own range.

 subnet 192.168.1.0 netmask 255.255.255.0 {

option routers             192.168.1.1;

option domain-name-servers 192.168.1.1;

option subnet-mask         255.255.255.0;

range dynamic-bootp        192.168.1.100 192.168.1.254;

default-lease-time         21600;

max-lease-time             43200;

next-server                192.168.1.222;

class “pxeclients” {

match if substring (option vendor-class-identifier, 0, 9) = “PXEClient”;

if option pxe-system-type = 00:02 {

filename “ia64/elilo.efi”;

} else if option pxe-system-type = 00:06 {

filename “grub/grub-x86.efi”;

} else if option pxe-system-type = 00:07 {

filename “grub/grub-x86_64.efi”;

} else {

filename “pxelinux.0”;

}

}

Specify your Cobbler server’s Ip address in the next_server field. Once you made all changes, save and close the file.

Next, we should enable Cobbler’s web interface, and set username and password for Cobbler’s web interface.

To enable, Cobbler’s web interface, edit file /etc/cobbler/modules.conf,

#vi /etc/cobbler/modules.conf

Change the following settings as shown below.

[…]

[authentication]

module = authn_configfile

[…]

[authorization]

module = authz_allowall

[…]

Finally, restart all services once or reboot your server.

#service httpd restart

#service dhcpd restart

#service xinetd restart

#service cobblerd restart

Then, run the “cobbler check” command to check if everything is OK on the Cobbler server.

#cobbler check

Sample result:

No configuration problems found.  All systems go.

 

Restart cobblerd service, and then run ‘cobbler sync’ to apply changes. Cobbler check will list the potential configuration item to fix. It’s kind of a warning. Cobbler sync applies the changes.

#service cobblerd restart

#cobbler sync

 

Importing the First Distribution ISO to Cobbler server

Mount and import iso distro (CentOS 6.5):

There are other options available for distro import ie, usb, cdrom, dvd etc.

 

[root@cobbler ~]# mkdir /mnt/iso

[root@cobbler ~]# mount -o loop /dev/cdrom /mnt/iso 

[root@cobbler ~]# cobbler import –arch=x86_64 –path=/mnt/iso –name=CentOS_6.5

 

Adding Multiple Distributions

If you want to add different distros like Ubuntu, its also possible. For example, let me add Ubuntu 14.04 server distribution to Cobbler server. To do that, first mount Ubuntu 14.04 ISO to any preferred location:

#mount -o loop ubuntu-14.04-server-i386.iso /mnt/

Then, import the Ubuntu 14.04 ISO image to the cobbler server as shown below.

#cobbler import –path=/mnt/ –name=Ubuntu14

Now, boot up your PXE client. This time you’ll find the Ubuntu distro has been added to the PXE server.

cobbler

Like this way, you can add as many as distributions you wanted to the Cobbler server, and start installing different distros from a single PXE server. Sounds awesome? yes It should be.

Reference:

http://www.unixmen.com/setup-pxe-boot-environment-using-cobbler-centos-6-5/

http://www.olindata.com/blog/2015/07/cobbler-setup-centos7

http://www.ibm.com/developerworks/library/l-cobbler/

http://www.openclouddesign.org/articles/automation-operations/cobbler-installation-centos-65

http://cobbler.github.io/manuals/quickstart/