Wednesday, 1 August 2012

Centos 6/RHEL rebuild/install Cobbler-2.2.1 (32bit)

Cobbler is the pxe boot config program written in Python and is used for, amongst other things, booting over a network to perform a network install on one or more machines.

Cobbler-2.2.3 is the version available in the standard repo for 32bit, however it has some issues on Centos 6.3 and doesnt work properly on, prompting an extensive search of forums for a fix which may or may not be successful.

Cobbler-2.2.1 works perfectly without issues but is hard to find, a least in installable rpm format. One solution is to build your own from one of the src.rpms which can be found online.

A major advantage of rebuilding a src.rpm is that it fits perfectly with your system and architecture.

I have made available the src.rpm below in case you have problems finding one to rebuild.

Please note it is not recommended to do this as root user as you can cause permanent damage to your system.

To proceed we must first install the build tools and an rpmbuild environment.

First, make sure you have matching kernel files and kernel-headers/kernel-devel installed, go here and scroll down to the small section on kernels to check and fix, then return.

Now install the necessary compile tools and dependencies.

$sudo yum -y install python rpm-build make m4 gcc-c++ autoconf automake redhat-rpm-config mod_dav_svn mod_ssl mod_wsgi    

Now we construct a build environment in the home directory to perform the rebuilds.

$mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

This gives you the necessary rpmbuild directory with the sub folders for building and processing the files, then

$echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

To complete the preparation process, check it with

$rpm --showrc | grep topdir                 returns

-14: _builddir  %{_topdir}/BUILD
-14: _buildrootdir      %{_topdir}/BUILDROOT
-14: _rpmdir    %{_topdir}/RPMS
-14: _sourcedir %{_topdir}/SOURCES
-14: _specdir   %{_topdir}/SPECS
-14: _srcrpmdir %{_topdir}/SRPMS
-14: _topdir    %(echo $HOME)/rpmbuild
[anton@Centos ~]$ 

Assuming we have installed the compile tools as above we are ready to go. Move to the build directory.

$cd rpmbuild/BUILD              

$mkdir cobbler                    

$cd cobbler    

Download the src.rpm file to the cobbler directory.


Now we rebuild it

$rpmbuild --rebuild cobbler-2.2.1-1.el6.src.rpm

after some terminal activity including the lines below

Wrote: /home/anton/rpmbuild/RPMS/noarch/cobbler-2.2.1-1.el6.noarch.rpm
Wrote: /home/anton/rpmbuild/RPMS/noarch/koan-2.2.1-1.el6.noarch.rpm
Wrote: /home/anton/rpmbuild/RPMS/noarch/cobbler-web-2.2.1-1.el6.noarch.rpm

you should have 3 rpm files in the RPMS/noarch folder, being cobbler, cobbler-web and koan, all matching versions.

cd back to the home directory


So we can install them

$sudo rpm -Uvh rpmbuild/RPMS/noarch/*.rpm

It may install Django as a dependency.

Now you have your rpmbuild environment set up, you can use it to build other source rpms, just make a new directory in the BUILD directory and dowload your source file, then repeat the process.

Watch out for missing dependencies which you will have to resolve, not all rebuilds will be as straightforward as the one above.

In case there were any problems with the above you can get the finished rpms below.




64 bit users have it little easier, they can just

$sudo yum -y --enablerepo=rpmforge --disablerepo=epel install cobbler

to get the same version.

No comments:

Post a Comment