How to setup Cobbler and deploy operating systems using Cobbler?

Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between many various commands and applications when deploying new systems, and, in some cases, changing existing ones. It can help with provisioning, managing DNS and DHCP, package updates, power management, configuration management orchestration, and much more.

We will now learn how to install Cobbler and boot a new linux box using PXE boot.

For simplicity and testing purposes, disable SELinux. However, SELinux is an added security and it is recommended not to disable it. You may face issues with the Cobbler setup if SELinux is enforced. If you decide to keep SELinux enforced, visit to ensure it works correctly in your SELinux environment.

[email protected] ~]# vi /etc/sysconfig/selinux

Reboot your system after applying SELinux Changes

To install the Cobbler packages, we first need to install the EPEL repository.

[email protected] ~]# rpm -ivh

Now we will install the required packages

[email protected] ~]# yum install dhcp cobbler pykickstart mod_python tftp -y

Enable xinetd tftp and rsync services

[email protected] ~]# vi /etc/xinetd.d/tftp
disable = no <- Change this line to “no”

[email protected] ~]# vi /etc/xinetd.d/rsync
disable = no <- Change this line to “no”

Start the xinetd, httpd, cobbler services and start the necessary services at boot time

[email protected] ~]# for i in xinetd httpd cobblerd; do service $i restart; chkconfig $i on; done;
[email protected] ~]# chkconfig tftp on
[email protected] ~]# chkconfig rsync on

Download the network boot-loaders for cobbler

[email protected] ~]# cobbler get-loaders

Change the default template of the dhcp file included with cobbler to match your network

[email protected] ~]# cp /etc/cobbler/dhcp.template /etc/cobbler/

[email protected] ~]# vi /etc/cobbler/dhcp.template
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet netmask {
option routers;
option subnet-mask;
range dynamic-bootp;
default-lease-time 21600;
max-lease-time 43200;
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”;

Now, we will modify the settings file.

[email protected] ~]# vi /etc/cobbler/settings
manage_dhcp: 1

Mount your CentOS 6.7 DVD to a mount point, here I am mounting on /mnt

[email protected] ~]# mount /dev/sr0 /mnt

Import the Distro details into cobbler using the below command.

[email protected] ~]# cobbler import –path=/mnt –name=CentOS_6.7_x86_64

Copy the default anaconda-ks.cfg to the default location of cobbler kickstart files

[email protected] ~]# cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/centos67.ks

Modify the centos67.ks file to the following or according to your requirement

[email protected] ~]# vi /var/lib/cobbler/kickstarts/centos67.ks
url –url
lang en_US.UTF-8
keyboard us
network –onboot yes –device eth0 –bootproto dhcp –noipv6
rootpw –iscrypted $6$4t6CgzQlwQKVFUEb$.mWJx35kMLobSabwpoKzlVpTvmTjxapy5GjSJdWkWANgV9J0SE4tm/oYMQjOYFdAyp5FgpevxXmzyy5/3xcHS.
firewall –service=ssh
authconfig –enableshadow –passalgo=sha512
selinux –enforcing
timezone Asia/Kolkata
bootloader –location=mbr –driveorder=sda –append=”crashkernel=auto rhgb quiet”

clearpart –linux –drives=sda
repo –name=”CentOS” –baseurl=cdrom:sr0 –cost=100
%packages –nobase

Add the distro information to the cobbler for PXE Boot

[email protected] ~]# cobbler distro add –name=CentOS_6.7_x86_64 –kernel=/var/www/cobbler/ks_mirror/CentOS_6.7_x86_64/isolinux/vmlinuz –initrd=/var/www/cobbler/ks_mirror/CentOS_6.7_x86_64/isolinux/initrd.img

Add the kickstart profile to the distro

[email protected] ~]# cobbler profile add –name=CentOS_6.7_KS –distro=CentOS_6.7_x86_64 –kickstart=/var/lib/cobbler/kickstarts/centos67.ks

Restart and synchronize the changes that were made into cobbler

[email protected] ~]# service cobblerd restart
[email protected] ~]# cobbler sync

Configure the firewall to allow ports 80 (HTTP) and 69 (TFTP)

[email protected] ~]# iptables -I INPUT -p tcp -s -d –dport 80 -j ACCEPT
[email protected] ~]# iptables -I INPUT -p udp -s -d –dport 69 -j ACCEPT
[email protected] ~]# service iptables save

Restart the below services once again to make sure all the changes are applied to the services

[email protected] ~]# for i in xinetd httpd cobblerd; do service $i restart; chkconfig $i on; done;

Boot a new linux box and make sure it boots via Network and at the menu prompt select the CentOS_6.7_KS option

Leave a Reply

Your email address will not be published. Required fields are marked *

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.