Cobbler
A cobbler is a person who makes boots. "Koan" stands for "kickstart over a network", and is kind of a play on "Xen", a Linux virtualization technology. Those responsible for naming these applications have been sacked.
Cobbler helps set up the PXE environment to smooth out kickstarting. For modern systems that can boot from the network, this eliminates the need for a custom boot floopy or CDROM.
Set Up Notes
(Please see the comments from Michael DeHaan at the end of these notes which clarify a few things and could potentially save you some work.)
This installation is 0.3.1 on CentOS 4.4 i386. Using the notes here I have successfully PXE-booted VMWare virtual machines on the same system as the host operating system which has Cobbler installed.
I could not make the supplied rpms work (the .noarch.rpm would install, but kept barfing on a missing python piece when run; and the .src.rpm kept dying when I tried to rpmbuild it) so this was done from the source .tgz file.
This next bit is for turning on NFS and tftpd on a server which doesn't have it turned on ahead of time. This is because my kickstarts always happen over NFS (because when you do a Kickstart over httpd from a CD-based boot media, you can't eject the CD once the second stage kicks in; with NFS you can). Don't forget to make the appropriate edits to /etc/exports so you are actually exporting something.
# for i in nfs nfslock portmap tftp ; do
chkconfig $i on
service $i start
done
Take a spin through
/var/lib/cobbler/settings to see what options are available. I believe the only changes I made were:
manage_dhcp: 1
next_server: '10.0.10.1'
server: '10.0.10.1'
Warning: if you setup cobbler to control your dhcpd.conf file, it
will over-write your existing one.
Save it ahead of time. You will almost certainly need to look at the /etc/cobbler/dhcpd.template file. In my case I had to
- correct the IP addressing space
- add the appropriate options for my space (name servers, etc)
- add an "include" directive that told dhcp where to look for my other, non-cobbler-related reservations (so I didn't have to regenerate everything when reservations changed).
The three layers:
- a distro is a linux distribution (ie FC3, RHEL 4.2, CentOS 4.4). We probably already have it expanded and exported via NFS somewhere.
- a profile is a distro plus a ks.cfg file which controls how the installation will happen
- a system is a computer
If your distro is already on your disk somewhere you can "import" it:
# cobbler import --path=/export/kickstart/CentOS-4.3-i386
This imports the distribution and creates a default, empty profile:
# cobbler list
defaults
kernel options : append devfs=nomount ramdisk_size=16438 lang= text ksdevice=eth0distro 1 : export_kickstart_CentOS-4.3-i386_images_pxeboot
kernel : /export/kickstart/CentOS-4.3-i386/images/pxeboot/vmlinuz
initrd : /export/kickstart/CentOS-4.3-i386/images/pxeboot/initrd.img
kernel options :
architecture : x86
ks metadata :profile 1 : export_kickstart_CentOS-4.3-i386_images_pxeboot
distro : export_kickstart_CentOS-4.3-i386_images_pxeboot
kickstart : /etc/cobbler/default.ks
kernel options :
ks metadata :
virt name : export_kickstart_CentOS-4.3-i386_images_pxeboot
virt file size :
virt ram :
virt paravirt :
Because the indicated kickstart attached to the profile,
/etc/cobbler/default.ks is empty, selecting this profile for a system would result in a network-boot to a manual installation.
Alternatively, you can just add the distro; this requires only the vmlinuz and initrd.img files, but does not create an empty ks.cfg profile for you.
# cobbler distro add --name="RHEL-4ES-U2-i386" --kernel=/export/kickstart/RHEL-4ES-U2-i386/images/pxeboot/vmlinuz --initrd=/export/kickstart/RHEL-4ES-U2-i386/images/pxeboot/initrd.img
So I create a kickstart file, and place it on my web server so that it can be reached. Then I create a profile to use it:
# cobbler profile add --name="CentOS-4.3-i386-base" --distro="export_kickstart_CentOS-4.3-i386_images_pxeboot" --kickstart="http://10.0.10.1/ks/CentOS-4.3-i386-base.cfg"
Creating a kickstart file is left as an exercise to the reader.
So I define my system to use this profile:
# cobbler system add --name="00:0C:29:84:2F:55" --profile="CentOS-4.3-i386-base" --pxe-address=10.0.10.62
I think you need to specify the name as a MAC address if you want to use the pxe-address parameter.
(See
cobbler_byname for a script which might help you automate configuring large numbers of systems.)
There is a nice trick happening here. When you are setting the system to PXE-boot on a specific IP address, you are actually creating a DHCP reservation which the installed system can use after the installation is complete. This means you can let the ks.cfg file set the networking parameters from DHCP and it will come up on the correct IP address later. If you have your DNS set up correctly ahead of time, the system will use the DNS name when it boots.
Finally you need to flush the configuration out to the pieces that will use it (dhcp and tftp):
This is your last chance to save your dhcpd.conf file if you have not done so already....and then you should be good to go.
Using the notes here I have successfully PXE-booted CentOS onto VMWare virtual machines on the same system as the host operating system which has Cobbler installed.
Cobbler can supposedly do kickstart templating and other good stuff, but this is good enough for me. We use a single kickstart file for each OS, generalized as much as possible, so all systems with the same OS will be as identical as possible.
Other Stupid Cobbler Tricks
- I run cobbler on Solaris 9 with the csw python. I don't let it do any of the rsync, httpd, or the dhcp pieces because I manage them all through other means.
- I use cobbler to set up PXE environments for SuSE-family distributions (see Using Cobbler with SuSE)
Comments from Michael DeHaan
I wanted to make a few
comments that can potentially save some folks some work though. It's
probably not documented as clearly as it could be, and your examples are
definitely good to have.(a) the noarch rpm.The best thing to do is to rebuild the RPM, rather than deal with the
source tarball. "rpmbuild --rebuild cobbler*.src.rpm" will get you a
new RPM that will install more happily on your platform. This at
least keeps cobbler owning it's directories and the like, which is
goodness.(b) If your distro is already on your disk somewhere you can "import" it:# cobbler import --path=/export/kickstart/CentOS-4.3-i386If you don't have those locally, you can also do:cobbler import --mirror=*rsync*://*mirror*.anl.gov/*centos*/
--mirror-name=centosThe coolness of this is that you can now re-rsync that directory by
running an "update.sh" in /var/www/cobbler/localmirror/… and
additionally Apache serves up all of the files in the kickstart tree
from that URL. Also, if you import that way, cobbler can write fairly
sane default kickstart files for you, that automatically point into that
kickstart tree, which helps people out who just want "base" kickstart
ability and don't want to write their own kickstarts. Kickstarts
default to "cobbler" as the root password if you do this, though the
files used can be changed (they live in /etc/cobbler).(c) So I create a kickstart file, and place it on my web server so that
it can be reached.Actually, you don't have to even do that. If you have it anywhere on
your hard drive, cobbler will file it away on your Apache server
automagically. (Another reason to build from the RPM, really, as it
configures Apache for this purpose).(d) I think you need to specify the name as a MAC address if you want
to use the pxe-address parameter.True :)--Michael