Rate this page del.icio.us  Digg slashdot StumbleUpon

Cobbler: How to set up a network boot server in 10 minutes

by

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.

For more information, see the Cobbler website and the mailing list. If you’re on IRC, there is also a #cobbler on irc.freenode.net. Stop by, ask questions, and share your ideas. Happy installing!

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.

19 responses to “Cobbler: How to set up a network boot server in 10 minutes”

  1. Michael DeHaan says:

    Hi folks. Looks like the online formatting of this article converted some double dashes “–” for long options to short dashes “-“. If you encounter any trouble, cross reference this doc with the manpage.

  2. Basil Gohar says:

    The link to the mailing list appears to have a typo in it. It is prefixed with http://http//

  3. Michael DeHaan says:

    Thanks! here’s the correct link.

  4. Michael DeHaan says:

    It seems gremlins mangled my attempt to post a new link. Remove the extra http and you’ll be fine.

  5. RHCT/AhmedShabana says:

    Very good article “Michael DeHaan” this really simple and power
    I will try it today isA

  6. Viswanath T K says:

    Hi Michael,
    I am relatively new to using Linux. My main idea is to install Fedora 7 over raw machines over the network. All machines do have PXE boot support. Now we have machine “A” over which TFTP Server, name Server,web server run.Machine “A” also has images of Fedora 7. The DHCP server runs on another machine “B” in the network. I have installed cobbler on the machine “A” configured it and added a distribution to cobbler. Now there are a couple of raw machines on which I want to install F7. But as mentioned in the tutorial as well as in this article I didnt find while booting, either boot prompt or place where I could type “menu” and then choose a Cobbler profile to install from the menu.

    Could you please help me in this regard or guide me to some article where I could get some information on how to go about.
    Thanks & Regards,
    Viswanath T K

  7. Abhishek says:

    Very good article and i think this is one of the powerful tool for System Administrators.Can i use koan for new system installation if i don’t want to use PXE.

  8. Michael DeHaan says:

    Yes, you can, by using koan to build a live CD. You might like to stop by #cobbler on irc.freenode.net (or join and post to the mailing list) if you have other questions.

  9. Abhishek says:

    how to define root password when installing by using koan.

  10. Viswanath T K says:

    Hi Michael,

    I need some info on using cobbler. Could you please help me on this.
    My main idea is to install Fedora 7 over raw machines over the network. All machines do have PXE boot support. Now we have machine “A” over which TFTP Server, name Server,web server run.Machine “A” also has images of Fedora 7. The DHCP server runs on another machine “B” in the network. I have installed cobbler on the machine “A” configured it and added a distribution to cobbler. Now there are a couple of raw machines on which I want to install F7. But as mentioned in the tutorial as well as in this article I didnt find while booting, either boot prompt or place where I could type “menu” and then choose a Cobbler profile to install from the menu.

    Could you please help me in this regard or guide me to some article where I could get some information on how to go about.
    Thanks & Regards,
    Viswanath T K

  11. Michael Dehaan says:

    Hi, I’m happy to help, though this isn’t the best place to do it. Ask the mailing list, or join #cobbler on irc.freenode.net

  12. Viswanath T K says:

    Thanks Michael for your response,
    I will join irc

    Thanks & Regards,
    Viswanath T K

  13. Marky Goldstein says:

    Thanks… what’s the difference between a “Reinstall” and an “Update”? How can cobbler and koan be used to upgrade existing Red Hat 4 machines towards Red Hat 5?

  14. Michael DeHaan says:

    For anyone else reading this article, I won’t be answering questions here.

    I will, however, gladly answer them on the mailing list and on IRC.

    Please direct your questions there.

    Thanks very much!

  15. Aidan Delaney’s weblog » Blog Archive » Of Fedora 8 and Sony’s PS3 says:

    […] My plan over summer, to get the University of Brighton games development lab up and running, is to turn the Gen1 PS3 into a server providing DHCP, LDAP authentication, NFS and Cobbler. Cobbler is particularly nice, it’s an automagic provisioning service for boxes. It should make provisioning of the 20 PS3s and associated workstations much easier. Furthermore, it’ll allow me to manage and maintain the software over time. So I may have a PS3-bare-metal config and an Intel-core-games-workstation config. It’s much more work than I want to do, but in the long run it’s easier than depending on the existing services. Essentially, to get one lab up and running I’ll have to fork most of the network services. […]

  16. Michael DeHaan says:

    Norbert,

    See http://fedoraproject.org/wiki/Anaconda/Kickstart — most all options apply to Red Hat installations. If you have further questions, post to kickstart-list@redhat.com after subscribing.

  17. Michael DeHaan says:

    For those reading this article and wondering why some URLs don’t work, visit http://fedorahosted.org/cobbler — we’ve moved the website there to consolidate all the documentation on the Wiki.

  18. Anonymous Coward says:

    … but it took me 10 minutes to read this article, so it’s really a “How to setup cobbler in 20 minutes” article.

  19. Raja says:

    Thanks. Great intro to Cobbler.
    Will experiment with it now.

    Helps thats its available in EPEL. Makes it easy to install