If you’ve ever had to install a large number of Linux systems, you are probably aware how tedious the install process can be. While tools like kickstart can help automate an installation, there are other pieces to the puzzle. There really hasn’t been a tool to unify all the ways you can install Linux–until now.
The most common way to do network installations is network booting via PXE, which requires setup of a TFTP server and DHCP configuration. However, PXE is not viable in some situations due to external constraints–for instance, what if your department does not have control of your DHCP server? What if you are at home and don’t have a server of your own? Solutions for installing machines without PXE are useful in those cases. For virtualization technology like Xen and KVM, other fully automatic installation solutions are required.
If you’re a systems administrator, gluing all of this (PXE, reinstalls, and virtualization) together manually is something you might prefer not to do. You’d really like a tool to do this setup and configuration for you.
Cobbler is a universal boot server that sets up everything you need for software installation–PXE, reinstalls, and virtualization. You can set up a Cobbler boot server for your favorite distros in just a few minutes. And as your provisioning needs grow, you can take advantage of more advanced features to further automate and simplify your systems administration requirements.
The first thing you’ll want to do (obviously) is install Cobbler. Cobbler is installable on Fedora® and Red Hat® Enterprise Linux® via yum–you can find out more at http://cobbler.et.redhat.com/download.php. You’ll also be interested in koan, which is a client-side application that works with Cobbler.
Once you have Cobbler installed, check to see if the rest of your system is configured properly as a boot server. You can do this with one simple command, which will tell you if you need to adjust other settings:
# cobbler check
Cobbler commands must be run as root.
Now you’ll want to import a few distributions to install from. You can import distributions from a public rsync mirror or a DVD image that you have locally. For this article, we’ll use DVD images. You’ll need some extra space in /var to hold the content you wish to mirror.
# cobbler import –name=F7 –mirror=/mnt/dvd1 # cobbler import –name=RHEL5 –mirror=/mnt/dvd2
To make sure everything is set up correctly, we’ll ask Cobbler to sync its configuration with the filesystem:
# cobbler sync
You now have a working network boot server, built with just a few commands. Taking advantage of the PXE server Cobbler just set up, you can now walk up to a fresh machine while it is booting, type “menu” from the boot prompt, and then choose a Cobbler profile to install from the menu. That machine will then start booting via PXE. Note that if you are running your boot server on RHEL 4, installing a newer ‘syslinux’ package from source is required to make PXE menus work. RHEL 5 already has a new enough syslinux.
If you’re so inclined, Cobbler can even generate your DHCP configuration for you–to do things like assign specific IPs to specific MAC addresses. Newer versions (>=0.5.0) can also work with dnsmasq to manage the hostnames assigned to specific machines. See the cobbler manpage for more details.
What if you already know what software and configuration a particular system should receive? Run the following command to map a particular machine to the profile that should be installed on it, substituting AA:BB:CC:DD:EE:FF for the MAC address of the system:
cobbler system add –name=AA:BB:CC:DD:EE:FF –profile=RHEL5-i386
That system will be set to PXE boot the Red Hat Enterprise Linux 5 i386 profile. The default kickstart uses the password “cobbler” for root. Change the default kickstarts by editing the files in /etc/cobbler, or assign your own by making your own cobbler profiles. It is good practice to create specific profiles, like “rhel5webserver” or “rhel5dbserver”–thinking about what roles your machines play, as opposed to just what OS runs on them.
In many cases, you’ll want to reinstall an existing system without relying on PXE. In this case, cobbler’s helper tool, koan, comes into play. Perhaps you have your own lab and would like to make installations simple, but some other part of the building provides DHCP. Cobbler and koan are here to help. Koan will allow you to re-provision existing Linux machines at will, straight from the cobbler server. Upstream koan also has a Live CD, for doing the same kind of thing from baremetal. (This is described in the koan man page).
koan –server=cobbler.example.org –list-profiles koan –replace-self –server=cobbler.example.org --profile=RHEL5-xen-i386 reboot
Koan also knows how to install virtualized systems. Assuming you are running Red Hat Enterprise Linux 5, Fedora Core 6, or Fedora 7, you can do the following:
yum install kernel-xen xen libvirt python-virtinst koan –server=cobbler.example.org –list-profiles | grep xen koan –virt –server=cobbler.example.org –profile=F7-xen-i386
This will create a new virtual machine from the cobbler profile without any user intervention. In a real world configuration, you would also use cobbler to define the RAM and disk space requirements for the virtual guests. Newer versions of koan (try the source checkout) can also help out with KVM installation (another virtualization technology), and offer advanced controls for things like installation into specific LVM partitions.
This article has shown how easy it is to get going with Cobbler, though there are a lot of other advanced features in both Cobbler and koan to explore. For instance, Cobbler can automatically manage your DHCP configuration, help you use templating to customize your kickstarts, mirror yum repositories for updates, and log your kickstart activity remotely over the network. There is also a Cobbler Python API for integration with other software, as well as a “Triggers” system for notifying other software when things change in Cobbler. While this may sound like a lot, Cobbler allows you to start simple and adopt the additional features you need over time.
About the author
Michael DeHaan is a member of Red Hat’s Emerging Technologies group. His interests include automated deployment solutions, systems management, and things with lots of shiny blinking lights on them.