Cobbler

From Leo's Notes
Last edited on 14 June 2020, at 23:33.


Add RH's repo to the system in /etc/yum.repos.d/blah

name = Extras
baseurl = http://dl.fedoraproject.org/pub/epel/6/x86_64
enabled = 1
gpgcheck = 0

yum install cobbler httpd xinetd tftp-server

vi /etc/selinux/config

- disable selinux

/etc/init.d/cobblerd start cobbler check

- should see an error message
- in /etc/cobbler/settings
  - change the 'server' and 'next_server' field 
  - change default password using `openssl passwd -1` 
- cobbler get-loaders
- yum install pykickstart cman
/etc/init.d/cobblerd restart
cobbler check   # should pass now except for the debian package manager.. but we don't care.

yum install cobbler-web

vi /etc/cobbler/modules.conf
[authentication]
module = authn_configfile

[authorization]
module = authz_allowall
htdigest -c /etc/cobbler/users.digest "Cobbler"cobbler
/etc/init.d/cobblerd restart
  1. if you get errors about authentication failure... try restarting cobbler again
  1. You will probaby want to make cobbler manage dhcp as well...
  2. see https://github.com/cobbler/cobbler/wiki/DHCP%20management
  1. Need to now add distros...
  2. They are stored in /var/www/cobbler/ks_mirror/<distro name>


cobbler distro add --name=CentOS6.3-x86_64 --kernel=/tftpboot/CentOS6.3-x86_64/isolinux/vmlinuz --initrd=/tftpboot/CentOS6.3-x86_64/isolinux/initrd.img
cobbler profile add --name=CentOS6 --distro=CentOS6.3-x86_64 --kickstart=/tftpboot/kickstart/centos6-ks.cfg

# adding some systems
cobbler system add --name=lab01 --hostname=lab01 --profile=CentOS6 --mac=00:50:56:3B:7A:4B --ip-address=10.10.2.11 --dns-name=lab01.lab.cpsc.ucalgary.ca
cobbler system add --name=lab02 --hostname=lab02 --profile=CentOS6 --mac=00:0C:29:68:C6:A3 --ip-address=10.10.2.12 --dns-name=lab02.lab.cpsc.ucalgary.ca
cobbler system add --name=lab03 --hostname=lab03 --profile=CentOS6 --mac=00:0C:29:45:81:F8 --ip-address=10.10.2.13 --dns-name=lab03.lab.cpsc.ucalgary.ca
cobbler system add --name=lab04 --hostname=lab04 --profile=CentOS6 --mac=00:50:56:27:0E:BD --ip-address=10.10.2.14 --dns-name=lab04.lab.cpsc.ucalgary.ca
cobbler system add --name=lab05 --hostname=lab05 --profile=CentOS6 --mac=00:50:56:34:DA:AA --ip-address=10.10.2.15 --dns-name=lab05.lab.cpsc.ucalgary.ca

# save changes
/etc/init.d/cobblerd restart
cobbler sync


  1. You will want to make cobbler manage dhcp and dns
  2. Be sure to edit the template files:

vi /etc/cobbler/dhcpd.template

- be sure that the dns server is set correctly
- ensure the gateway is set 
- example:
ddns-update-style interim;

allow booting;
allow bootp;

option domain-name "lab.cpsc.ucalgary.ca";
authoritative;

 subnet 172.20.1.0 netmask 255.255.255.0 {
     option routers             172.20.1.1;
     option domain-name-servers 172.20.1.2;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        172.20.1.10 172.20.1.254;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}


vi /etc/cobbler/named.template

- make listen-on port 53 on any port to ensure that your build servers and talk to it
- ensure that recursion is enabled for all ips that are going to access the ns server


Using better loaders If you want custom loaders, you will need to place them under /var/lib/cobbler/loaders and modify cobbler to copy them over to /tftpboot during a sync.

cd /var/lib/cobbler/loaders
wget -O menu.c32 http://pages.cpsc.ucalgary.ca/~leo/support/pxe/menu.c32
wget -O vesamenu.c32 http://pages.cpsc.ucalgary.ca/~leo/support/pxe/vesamenu.c32
wget -O pxelinux.0 http://pages.cpsc.ucalgary.ca/~leo/support/pxe/pxelinux.0
wget -O splash.png http://pages.cpsc.ucalgary.ca/~leo/support/pxe/splash.png

If you do add new loaders, you will need to add the code to copy them over manually. Edit /usr/lib/python2.6/site-packages/cobbler/pxegen.py

                utils.copyfile_pattern('/var/lib/cobbler/loaders/pxelinux.0',
                        dst, api=self.api, cache=False, logger=self.logger)
                utils.copyfile_pattern('/var/lib/cobbler/loaders/menu.c32',
                        dst, api=self.api, cache=False, logger=self.logger)
                utils.copyfile_pattern('/var/lib/cobbler/loaders/vesamenu.c32',
                        dst, api=self.api, cache=False, logger=self.logger)

/etc/init.d/cobblerd restart
cobbler sync

Note: If you want to get away from the complexity, you can just place the loaders/roms directly in /tftpboot and call it a day.