Difference between revisions of "Cobbler installation on Ubuntu"

From Define Wiki
Jump to navigation Jump to search
Line 129: Line 129:
 
         ## Cobbler defaults to $next_server, but some users
 
         ## Cobbler defaults to $next_server, but some users
 
         ## may like to use $iface.system.server for proxied setups
 
         ## may like to use $iface.system.server for proxied setups
option domain-search            "domain.name.com"; <-- Domain name goes here
+
option domain-search            "domain.name.com"; # <-- Domain name goes here
 
         next-server $next_server;
 
         next-server $next_server;
 
         ## next-server $iface.next_server;
 
         ## next-server $iface.next_server;

Revision as of 15:51, 8 August 2013

Pre-Requisits

For this installation, we will need to have the following services installed: dhcp, bind & apache.

Install with the following yum command:

root@ubuntu:~# apt-get install apache2 isc-dhcp-server bind9

If necessary, the dhcpd service can be restricted to servicing dhcp requests on just one port. To do this, edit the /etc/default/isc-dhcp-server file and set the following line:

INTERFACES="eth1"

Install Cobbler

root@ubuntu:~# apt-get install cobbler cobbler-web

Restart Apache

root@ubuntu:~# service apache2 restart
 * Restarting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Add a few more packages to satisfy some cobbler requirements

Install debmirror with apt-get (needed to manage debian deployments):

root@ubuntu:~# apt-get install debmirror

Install createrepo with apt-get (needed for Redhat-based deployments):

root@ubuntu:~# apt-get install createrepo

Install pykickstart with apt-get (A python library for manipulating kickstart files):

root@ubuntu:~# apt-get install pykickstart

Configure cobbler

Get cobbler to manage dhcp and dns by setting the following in /etc/cobbler/settings:

manage_dhcp: 1
manage_dns: 1

Set server ip addresses in /etc/cobbler/settings:

next_server: 172.28.0.100
server: 172.28.0.100

Define domain name to use/manage in /etc/cobbler/settings:

# if using BIND (named) for DNS management in /etc/cobbler/modules.conf
# and manage_dns is enabled (above), this lists which zones are managed
# See the Wiki (https://fedorahosted.org/cobbler/wiki/ManageDns) for more info
manage_forward_zones: [domain.name.com]
manage_reverse_zones: [192.168.42.0]

Confirm the following are set in /etc/cobbler/modules.conf:

[dns]
module = manage_bind

[dhcp]
module = manage_isc

Edit /etc/cobbler/dhcp.template with relevant network information including the domain-search option which doesn't seem to be added automatically (for example):

# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************
	
ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

subnet 192.168.42.0 netmask 255.255.255.0 {
     option routers             192.168.42.1;
     option domain-name-servers 192.168.42.1;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.42.100 192.168.42.150;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}

#for dhcp_tag in $dhcp_tags.keys():
    ## group could be subnet if your dhcp tags line up with your subnets
    ## or really any valid dhcpd.conf construct ... if you only use the
    ## default dhcp tag in cobbler, the group block can be deleted for a
    ## flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
        #for mac in $dhcp_tags[$dhcp_tag].keys():
            #set iface = $dhcp_tags[$dhcp_tag][$mac]
    host $iface.name {
        hardware ethernet $mac;
        #if $iface.ip_address:
        fixed-address $iface.ip_address;
        #end if
        #if $iface.hostname:
        option host-name "$iface.hostname";
        #end if
        #if $iface.netmask:
        option subnet-mask $iface.netmask;
        #end if
        #if $iface.gateway:
        option routers $iface.gateway;
        #end if
        filename "$iface.filename";
        ## Cobbler defaults to $next_server, but some users
        ## may like to use $iface.system.server for proxied setups
	option domain-search             "domain.name.com"; # <-- Domain name goes here
        next-server $next_server;
        ## next-server $iface.next_server;
    }
        #end for
}
#end for

Attempt to start dhcpd:

service dhcpd restart

NB: if the dhcpd service isn't running and it fails to start, it may be because the default /etc/dhcpd.conf file is blank. Enter the above information and start the dhcpd service (it needs to be running for cobbler sync (below) to complete fully). The content of /etc/dhcpd.conf will be overwritten with the contents of /etc/cobbler/dhcp.template once cobbler sync has been performed.

Run cobbler check:

cobbler check

Run cobbler sync:

cobbler sync

Import a Ubuntu Server ISO for deployment

Mount a the Ubuntu Server ISO file to a local folder, for example:

mount -o loop ./ubuntu-12.04-server-amd64.iso /media/cdrom

Import the ISO into cobbler:

root@ubuntu:~# cobbler import --name=ubuntu1204 --path=/media/cdrom/ breed=ubuntu --arch=x86_64

Finish with a cobbler sync:

cobbler sync