Sunday, April 01, 2007

Provisioning Linux Simplified with Cobbler

Well. RedHat Enterprise Linux 5 was release on 14th of last month. I hope alot of new changes will be there in it. But I still have RHEL5 Beta2 and this time I thought of trieing some new technology in my Beta2. I have heard alot of PXE(Pre-Execution Environment) but was never able to get time to try it. But recently I saw the RedHat Emerging Technologies webpage. This is a division in RedHat that is working on new technologies and one of them is Cobbler.

I studied about it and found that it is related to PXE in some way or the other but is more simplified and yet more powerful. So I thought to give it a try. Earlier I was not getting what I was doing but with a few posts at the mailing list of et-mgmt I got my self the way. So I am summarizing here what's the purpose of Cobbler.

If we left Cobbler for a moment and try to concentrate on Provisioning in Linux then what exactly does it means. It means how we can create and manage Linux machines. In simple terms we can install a lot of Linux machines (server or client) un-attendly (we need not be near the machine). We can have template based installation where we can specify a particular template to a given set of machines and another template to another set of machines and this way we can get all of them installed and running according to our configuration in very less time.

In earlier days (lol. still today) PXE installations were used to provision Linux machines so that we can get un-attended installations easily for a large number of machines. But RedHat is working on a technology called Cobbler that helps simplify PXE configuration and add to it alot of powerful features to mention some: Provisioning Xen Virtual Machines, Kickstart Templating and enchant.

I thought of trying Cobbler on my RedHat Beta2. Well to get started we need to install some dependencies. That are TFTP Server, DHCP Server, NFS Server, Portmap, HTTPD server and cheetah python template (required for Kickstart templating). All of the above packages can be found in the installation media of RedHat sources only required Cheetah can be downloaded from here. Once all of the dependencies are installed we proceed with installation of Cobbler. Cobbler can be downloaded from here. To install Cobbler just extract the tar you download and from the source directory give the command python install. This will install it. After installing Cobbler we need to do some pre-configuration steps which are necessary before we start with Cobbler.

First of all we need to enable TFTP Server. For that we need to edit /etc/xinetd.d/tftp and change the disable=yes to disable=no and then service xinetd restart and chkconfig xinetd on.

Second we need to configure our installation tree. I had dumped my whole Beta2 DVD in /rhel5/Dump. And configure any one either HTTPD or NFS so that later we can access the Dump during installation. I preferred HTTPD as I faced problems with NFS earlier. To do so I edited the /etc/httpd/conf/httpd.conf file. In the last write this:

<VirtualHost "">ServerAdmin
DocumentRoot /rhel5
<Directory "/rhel5">Options Indexes Includes
ErrorLog logs/
CustomLog logs/ common

We need not do anything we DHCP server configuration and PXE configuration as it will all be well taken care of by Cobbler. Now comes the crucial part of this configuration and that is creating a kickstart file to install clients. Creating a kickstart file is a very tricky thing. I prefer system-config-kickstart tool for this job as it is GUI and easy to use. It can give us a sample kickstart file which we can edit according to our use. I did the same thing created the file via system-config-kickstart and edited it according to my client machine (I had one client only). I am posting my ks.cfg here:

For Physical Machines:

url --url=
key 2515dd4e215225dd
lang en_US.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto static --ip --netmask --gateway --hostname
rootpw --iscrypted $1$QGYhCela$pNOZoWf4XoONvUdND/nS01
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Calcutta
bootloader --location=mbr --driveorder=hda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux
#part / --fstype ext3 --onpart sda3
#part swap --onpart sda6
#part /home --fstype ext3 --onpart sda7


In the above kickstart I have commented the partition scheme as I wanted it done manually (don't wanted to loose my data). I save this file at /rhel5/Dump/ks.cfg.

After we have configured all the required servers we should edit the file /var/lib/cobbler/settings. In this file we edit the lines so that they look like this:

manage_dhcp: 1
next_server: ''
server: ''

manage_dhcp: 1 tells cobbler to take care of the /etc/dhcpd.conf for us. For this cobbler use a template /etc/cobbler/dhcp.template. The next_server and server points to my cobbler server system. They will be used in /etc/dhcpd.conf as next-server. As I have only one dhcp server so there is no where else to look for dhcp information that's why my next-server is the same as my server.
After this step we run cobbler check. This commands checks that all things are in place and everything is fine. If this command reports the following:

No setup problems found.
Manual review and editing of /var/lib/cobbler/settings is recommended to tailor cobbler to your particular configuration.
Good luck.

Then we are done with our cobbler's pre-configuration steps. Now is the time to proceed and configure cobbler.

Before starting the configuration of Cobbler I would like to mention some terminology of it. In Cobbler we have Distro, Profile and Systems.
They can be viewed as in a hirearchy:
Distro -> Profile -> Systems.
Like for example:
Fedora Core 6 -> WebServer -> System A, System B
Fedora Core 6 -> MailServer -> System C, System D
Redhat 5 -> DNSServer -> System E
So we have one Distro within which we can have one or more than one profile and within that we can have one or more than one or even zero systems. I hope you got my point.
So in our case I created first of all a Distro entry for Cobbler with the cobbler distro add command.

cobbler distro add --name=rhel5-dvd --kernel=/rhel5/Dump/images/pxeboot/vmlinuz --initrd=/rhel5/Dump/images/pxeboot/initrd.img --arch=x86

This created a distro inside cobbler's configuration (which is stored in /var/www/cobbler).

After adding a distro we add a profile inside that distro. I create a profile for the new machines I am going to install later. To create a profile this command I gave:

cobbler profile add --name=redhat5y --distro=rhel5-dvd –kick-start=/rhel5/Dump/ks.cfg

The above command is simple to understand. It tells that the profile name is redhat5y and it's a profile for distro rhel5-dvd I created earlier. The –kick-start option tells the path of the ks.cfg I created earlier for my new physical machines going to be installed later. After creating the profile I can proceed by creating system within the profile.

For example I want to add a systemA in the profile redhat5y I can give the following command:

cobbler system add –name= --profile=redhat5y

Here name can be a ip address, MAC address or DNS resolvable hostname. I didn't tried the above command as it was a little confusing and the other thing was that I was going to have only one more system to install so I didn't need a system within redhat5y profile. I can use the profile itself to install the new system. It sounds a little confusing right? Well let me explain it a little bit more. We created a distro and within that distro we created a profile. Now what actually is going on is that there is a database getting created in cobbler in hirearchial manner. Under which on top is the distro within it is a profile. For further customization I can add system's data within that profile. But if I don't add any system within the profile then also I can continue. I can very well use the profile to boot systems. That way new systems will inherit the profile directly there is no need to be more specific about particular system but if in case we want customization we can add a system data within a cobbler profile.

After creating the profile we are done almost with the configuration of cobbler and now we proceed to start cobbler.

Starting cobbler is simple with the command cobbler sync. This commands reads the database distro, profile, systems (if any) and write's /etc/dhcpd.conf and starts the dhcp server service. After it's done we can see a cobbler report with the command cobbler report. This command lists the distro's the profiles within those distro's and systems if any.

After all this we switch to client side. On the client side we need a PXE boot enabled LAN card. I got one from my friend. Most of the LAN card today come with PXE support. I selected PXE boot as first boot device priority from within the BIOS and it booted from the PXE. Got IP address from my cobbler server managed dhcp. Then showed the boot: prompt. Here you can type in the profile name and press enter and it will boot into that profile automatically or if you have a system within a particular profile you can just enter the system name here and it will boot the configuration for that particular system. As I haven't created any systems within my redhat5y profile I typed in my profile name that is redhat5y and pressed enter. If you want to see the list of all the available profiles and systems within them you can type menu at the boot: prompt.

When I gave the profile name at the boot: prompt what it actually did was it read /tftpboot/pxelinux.cfg/default file inside which there was a entry for redhat5y profile telling what kernel to boot and which initrd image to use. All was specified when I added a new profile from cobbler profile add command earlier. And when I ran cobbler sync command it was written to /tftpboot/pxelinux.cfg/default. After the initial boot it switched to ks.cfg file to get install information. The only information it asked me was the partitioning which I left commented in ks.cfg (for the sake of my data you can very well specify this too). And after that it installed the client machine. It took very less time and a small user intervention (which can also be eradicated).

So I got a new client installation from provisioning. It all sounds a little complex but once we do this practically things become more clear. So in the next step I tried to install a xen virtual machine from PXE boot. For that all I did was create a new distro named rhel5-xen and within that distro a new profile named redhat5x

cobbler distro add –name=rhel5-xen –kernel=/rhel5/Dump/images/xen/vmlinuz –initrd=/rhel5/Dump/images/xen/initrd.img --arch=x86

See the above command the only major difference between the earlier distro I created and this one is the kernel and initrd images. These one are for xen (see the pathname).
Then I created a profile redhat5x within this distro:

cobbler profile addd --name=redhat5x --distro=rhel5-xen --kick-start=/rhel5/Dump/ks1cfg --virt-file-size=2 –virt-ram=256

For the sake of convience I am posting my ks1.cfg file I used to install the virtual machine. In this kickstart file I specified the partitioning information and in this one I used nfs as my installation method (that can be configured very easily).

nfs --server= --dir=/rhel5/Dump
key 2515dd4e215225dd
lang en_US.UTF-8
keyboard us
network --bootproto=bootp --device=eth0 --onboot=on
rootpw --iscrypted $1$VwD9nalr$06K0bUawzanX72gNk0es91
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Asia/Calcutta
bootloader --location=mbr --driveorder=xvda --append="console=xvc0"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=xvda
part /boot --fstype ext3 --size=100 --ondisk=xvda
part pv.2 --size=0 --grow --ondisk=xvda
volgroup VolGroup00 --pesize=32768 pv.2
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=144 --grow --maxsize=288


The above profile add command created a profile within distro rhel5-xen. With a new kickstart which was specially written for xen virtual machine. Now the new arguments in the above command one tells the image file size was 2GB. This image file is used to store the virtual machine on the hard disk just like vmware uses files to emulate hard disks within the virtual machine we see partitions but on hard disk they are files actually in case of xen they are .img files and if not specified are stored in /var/lib/xen/images/(cobbler stores them here). The second argument tells the amount of RAM to be given to the virtual machine. I have 512 MB physical RAM on my system out of which I gave 256 MB with the above argument. I tried to gave 128 MB RAM but it failed during booting of the virtual machine for the first time itself with some xen error reporting balloon error.

After I added the profile it was time to start the virtual machine installation. But wait it is not the same as we did earlier in case of physical machines it's different. We use a new technology software from RedHat named koan'. Koan helps start the virtual machine from the cobbler's profile. I installed the software from here. The installation was as that of cobbler. Just extract the file and from within the source directory run python install. After it's installed just run the following command:

koan --virt –server= –profile=redhat5x

The above command tells koan that we are going to install a virtual machine (--virt). The next argument tells the cobbler server's ip address and the last one tells the profile name on the cobbler server. This thing was really amazing. Koan communicated with cobbler server and checked for the profile redhat5x (which was there) and started the installation of the virtual machine. Actually it starts the installation and ends up. What it gives is a alpha-numeric number which we need to use in xm console command to get a console of the virtual machine (so that we can see what's going on during the installation). The number is like 00_16_3E_6B_D5_39. I used this and gave the below command after koan return me to the shell:

xm console 00_16_3E_6B_D5_39

This command connected me to the virtual machine 00_16_3E_6B_D5_39. This name is given by koan so that it maintains uniqueness of the virtual machine. Later we use this number as our virtual machine name. I haven't digged into this number but it's a sort of MAC address type which I will look into more detail later. For the time being my installation of the virtual machine started and ended very soon. Was fast.

After the installation finished the virtual machine rebooted and it was there. It was a working xen virtual machine installation using cobbler and koan in RedHat Enterprise 5 Beta2.

Later we can use the libvirt to manage the virtual machine as we did for other virtual machines that thing is the same.

So in this article I wrote about provisioning which is simplified and give more power with the new emerging technology like cobbler and koan. I will be working on some more things in the coming days specially kickstart templating and enchant. There are a lot of thing's in cobbler and koan we can use according to our use I haven't mentioned them all but I hope once you get started with this technology you will automatically start reading about them. Well there is no good documentation about cobbler except the man pages and of-course the mailing list.

Thanks for your time. Will see you soon!


pss said...

It is really worth reading. Keep it up. Enlighten Linux community people around the world.

buy wow gold said...

When the Wow Gold wolf finally found the wow gold cheap hole in the chimney he crawled cheap wow gold down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf.
The next day the Buy Wow Goldlittle pig invited hisbuy gold wow mother over . She said "You see it is just as mttgamingI told you. The way to get along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he buy cheap wow gold learned that lesson. And he just agamegold lived happily ever after!.

梦中林 said...

A slim, wide-eyed mygamegoldwoman almost human in virbanksfeatures eyed agamegold the pair. Her nose was sharp, but very elegant. She had tbcgold a pale, trade4gamebeautiful face the color of ivory, and veryge for hair she wore a wondrous mane of downy feathers. Her gown fluttered as she walked—on two delicate worldofgolds but still sharply-taloned feet. “Awake, awake you are,” she said with a pvp365 slight frown. “You should rest, rest.” Krasus bowed to her. “I am ezmmorpg grateful for your ighey hospitality, mistress, but I am well enough to continue on9a9z now.” She cocked her head as a bird might, giving the mageltk365 a reproving look. “No, no…too soon, toogold4guild soon. Please, sit.” The duo looked around u4game and discovered that two chairs, made in the same ready4game fashion as the nest, waited behind happygolds them. Malfurion waited for Krasus, who finally nodded and sat.

milf said...

find air beds in wisconsinbest air beds in wisconsincloud air beds

best cloud inflatable air bedssealy air beds portableportables air bedsrv luggage racksaluminum made rv luggage racksair bed raisedbest form raised air bedsbed air informercialsbest informercials bed airmattress sized air beds

bestair bed mattress antique doorknobsantique doorknob identification tipsdvd player troubleshootingtroubleshooting with the dvd playerflat panel television lcd vs plasmaflat panel lcd television versus plasma pic the bestadjustable bed air foam The best bed air foam

hoof prints antique equestrian printsantique hoof prints equestrian printsBuy air bedadjustablebuy the best adjustable air bedsair beds canadian storesCanadian stores for air beds

migraine causemigraine treatments floridaflorida headache clinicdrying dessicantair drying dessicant

milf said...

black mold exposureblack mold symptoms of exposurewrought iron garden gatesiron garden gates find them herefine thin hair hairstylessearch hair styles for fine thin hairnight vision binocularsbuy night vision binocularslipitor reactionslipitor allergic reactionsluxury beach resort in the philippines

afordable beach resorts in the philippineshomeopathy for big with great mineral makeup bargainsmineral makeup wholesalersprodam iphone Apple prodam iphone prahacect iphone manualmanual for P 168 iphonefero 52 binocularsnight vision Fero 52 binocularsThe best night vision binoculars here

night vision binoculars bargainsfree photo albums computer programsfree software to make photo albumsfree tax formsprintable tax forms for free craftmatic air bedcraftmatic air bed adjustable info hereboyd air bedboyd night air bed lowest price

milf said...

new houston house houston house txstains removal dyestains removal clothesstains removalteeth whiteningteeth whiteningbright teeth

jennifer grey nosejennifer nose jobscalebrities nose jobsWomen with Big NosesWomen hairstylesBig Nose Women, hairstyles

milf said...

dessicant air dryerpediatric asthmaasthma specialistasthma children specialistcarpet cleaning dallas txcarpet cleaners dallascarpet cleaning dallas

vero beach vacationvero beach vacationsbeach vacation homes veroms beach vacationsms beach vacationms beach condosmaui beach vacationmaui beach vacationsmaui beach clubbeach vacationsyour beach vacationscheap beach vacations

bob hairstylebob haircutsbob layeredpob hairstylebobbedclassic bobCare for Curly HairTips for Curly Haircurly hair12r 22.5 best pricetires truck bustires 12r 22.5

washington new housenew house houstonnew house san antonionew house ventura