ccie, vcp ccvp, rhce, giac, gcih, cisco, netscreen, netscaler, juniper, f5, security, virtualization, vmware

OpenStack Nerd, CCIE, DevOps Junkie

Changing the world, one person at a time

OpenStack Nerd, CCIE, DevOps Junkie header image 2

Setting up Cobbler PXE auto-deployment for Ubuntu Server 12.04 Precise

November 12th, 2012 · 9 Comments · OpenStack, Ubuntu

For those that don’t use it, Cobbler is a PXE installation manager for automating the deployment of systems and packages. It is an order of magnitude simpler then creating a custom PXE environment by hand.

In this case I am setting up my Cobbler environment to automatically deploy a base operating system and then hand off to Puppet for further configuration. After handoff Puppet will configure the systems in a multi-node OpenStack setup which will rebuild nightly.

The purpose of that entire system this is to do development testing of the Quantum Networking Service for the spring Grizzly release. I will document the process for that in a later blog post.

What we will do today, is get the base system up and running for deploying your server operating systems using Cobbler.

Installing Cobbler

First thing you need to do is install your base operating system. In this case since we are building out a lab environment to test OpenStack builds we should download and install ubuntu server 12.04 (precise).

Once this is up and configured with a static IP address, we need to install and configure cobbler

sudo apt-get install cobbler cobbler-web

This will install Cobbler, and the Cobbler web interface. Next we will run a sanity check of cobbler

sudo cobbler check

You may get some notifications of items that need to be addressed. Address as needed and run the check command to verify.

Next, you can set the username and password that you will use to manage the cobbler web interface. You can replace these items with whatever user / password you would like. In this case we have the username Cobbler and the password cobbler.

htdigest /etc/cobbler/users.digest "Cobbler" cobbler

After you have successfully run cobbler check you will need to synchronize cobbler by running the cobbler-sync command

cobbler sync

Importing Ubuntu Server ISO’s

Next thing we need to do is grab the ISO that we used to install the server we are on, and import it into cobbler. In this case we are making a folder to mount a NFS export called VMwareISO on a NAS at 10.0.76.2

sudo mkdir /mnt/VMwareISO
sudo mount 10.0.76.2:/volume1/VMwareISO /mnt/VMwareISO

Next we have to create an ISO mount point and mount the Ubuntu 12.04 ISO

sudo mkdir /mnt/iso
sudo mount -o loop ubuntu-12.04-server-amd64.iso /mnt/iso

You will get the following message, and that is all right.

mount: warning: /mnt/iso seems to be mounted read-only.

Next, we will import the ISO we just mounted into Cobbler.

sudo cobbler import --name=ubuntu-server --path=/mnt --breed=ubuntu

Configuring DHCP to point to your PXE server

This part will vary based on your lab setup. If you already have a DHCP server setup, then you need to set the “next-server ” option to the ip address of your Cobbler server.

If you want to run DHCP on the same server you are using for Cobbler you need to install and configure a DHCP server.

sudo apt-get instal isc-dhcp-server

Next we have to edit the configuration file /etc/dhcp/dhcpd.conf

sudo vim /etc/dhcp/dhcpd.conf

Now you need to add a statement configuring a DHCP scope on this server. In this case I am using the following options -

  • Subnet 10.0.76.0/24
  • IP Address range 100-254
  • Router 10.0.76.1
  • DNS Server 10.0.76.10
  • PXE server (cobbler) 10.0.76.30
Configuration to be added to dhcpd.conf

subnet 10.0.76.0 netmask 255.255.255.0 { option routers 10.0.76.1; option domain-name-servers 10.0.76.10; option subnet-mask 255.255.255.0; range dynamic-bootp 10.0.76.100 10.0.76.254; filename “/pxelinux.0″; default-lease-time 21600; max-lease-time 43200; next-server 10.0.76.30;

Once this is added, restart the DHCP server to pick up your configuration

sudo /etc/init.d/isc-dhcp-server restart

Creating a custom seed file and pointing the Cobbler to it

FYI, this step may not be completely necessary in the future. However there is currently a bug open with Cobbler where when you are using it with a Ubuntu 12.04 file where the client installation will bomb out. You will get an error stating “Bad Archive Mirror An error has been detected while trying to use the specified archive mirror”

ubuntu 12.04 cobbler error

If you dig through /var/log/syslog you will find a more descriptive error shown here below

choose-mirror[3474] DEBUG command: wget -q http://gb.archive.ubuntu.com/ubuntu//dists/precise/Release -O – | grep -E ‘^(Suite|Codename):’ choose-mirror[3474] WARNING **: broken mirror: invalid Suite or Codename in Release file for $suite

After a bit of digging I found a bug logged with Cobbler here - https://bugs.launchpad.net/ubuntu/+source/cobbler/+bug/1000219. the bug itself hasn’t been fixed. Luckily however there are a couple ways to work around this.

Copying and Editing your new seed file

Cobbler keeps it’s auto installation files for all different operating system types in /etc/cobbler/ in the next steps we explore this directory and create a new file based on a sample provided.

cd /etc/cobbler
sudo cp ubuntu-server.preseed ubuntu-server.openstack.preseed

Pointing cobbler to the new file

The next  thing we need to do, is log into our Cobbler web interface to and make sure things are working.

your favorite web browser - http://<yourservername>/cobbler_web/ with username Cobbler password cobbler (or whatever username and pass you provided)

 

cobbler web login image

Next we need to navigate to PROFILES and click on EDIT to edit ubuntu-server-x86_64 instance

cobbler profiles

You will see a screen with a bunch of form fields. You need to navigate down to the “Kickstart” option and change from

/var/lib/cobbler/kickstarts/sample.seed

to the file we have just changed sample.seed.precise

/etc/cobbler/ubuntu-server.openstack.preseed

As you can see, all we did was add .precise to the end of the sample.seed file name.

cobbler preseed location

Click save, and now you should be ready to PXE install your first Ubuntu server. (if you use this file your username / pass will be ubuntu/ubuntu)

Whats Next?

In the next blog post in this series we will configure Puppet Master on our server and do a super dangerous thing – optimize our seed files to blow away our file system without any user interaction necessary. Needless to say we will all need to use this next one with caution….

 

Tags: ····

9 responses so far ↓

  • 1 Xmodulo // Jan 15, 2013 at 11:41 am

    Thanks a lot for the detailed cobbler instructions.
    Exactly what I was looking for.

  • 2 saintx // Feb 13, 2013 at 7:04 am

    Me too, this is very helpful. Also, thanks for pointing out that bug that you ran into, it’s really nice to have the potholes clearly flagged. Enjoy your day!

  • 3 Dave // Apr 27, 2013 at 10:00 am

    excellent! I will try this out

  • 4 Eli Marques // May 20, 2013 at 11:56 am

    how much disk space is usually necessary to have a server with Cobbler?

  • 5 colinmcnamara // Jun 2, 2013 at 2:11 pm

    It depends on how many operating systems you need to install from it. I normally start with an 8 gig partition and extend if needed

  • 6 space // Aug 3, 2013 at 7:58 pm

    it seems that during the installation of ubuntu, it will try to download packages from the Internet, which will slow down the installation, is there any alternative way to make this faster? as when I tried with centos DVD image, it ‘s really fast ,and won’t download packages from outside world…

  • 7 Larry P // May 1, 2014 at 6:39 am

    I know I’m late to the party here but…

    /var/lib/cobbler/kickstarts/sample.seed
    to the file we have just changed sample.seed.precise

    /etc/cobbler/ubuntu-server.openstack.preseed
    As you can see, all we did was add .precise to the end of the sample.seed file name.

    is a bit confusing… are we adding ‘precise’ (i.e., name of version) or .preseed to the end?

  • 8 car scratch repair Barnsley // Aug 20, 2014 at 3:43 am

    I absolutely love your blog and find most of your post’s to be just what I’m looking for.
    Do you offer guest writers to write content in your case?
    I wouldn’t mind creating a post or elaborating on many of the subjects
    you write about here. Again, awesome site!

  • 9 Weird Fetish // Sep 20, 2014 at 9:44 pm

    It’s really very difficult in this active life to listen news
    on Television, therefore I simply use web for that purpose, and obtain the most recent information.

Leave a Comment