Installing Spacewalk on CentOS 6

DISCUSSION
I’m installing Spacewalk (1.5) along with postgreSQL (8.4) on a fresh installation of CentOS 6.  This would be pretty straight forward except the CentOS team did not release updates for the selinux-policy and that leaves you with the error below.  I’m guessing that if youa re reading this you encountered this error while running your yum command to install spacewalk.  If so this should guide you through things:

Finished Dependency Resolution
Error: Package: spacewalk-common-1.5.1-1.el6.noarch (spacewalk)
Requires: selinux-policy-base >= 3.7.19-93
Installed: selinux-policy-targeted-3.7.19-54.el6_0.5.noarch (@updates)
selinux-policy-base = 3.7.19-54.el6_0.5
Available: selinux-policy-minimum-3.7.19-54.el6.noarch (base)
selinux-policy-base = 3.7.19-54.el6
Available: selinux-policy-minimum-3.7.19-54.el6_0.3.noarch (updates)
selinux-policy-base = 3.7.19-54.el6_0.3
Available: selinux-policy-minimum-3.7.19-54.el6_0.5.noarch (updates)
selinux-policy-base = 3.7.19-54.el6_0.5
Available: selinux-policy-mls-3.7.19-54.el6.noarch (base)
selinux-policy-base = 3.7.19-54.el6
Available: selinux-policy-mls-3.7.19-54.el6_0.3.noarch (updates)
selinux-policy-base = 3.7.19-54.el6_0.3
Available: selinux-policy-mls-3.7.19-54.el6_0.5.noarch (updates)
selinux-policy-base = 3.7.19-54.el6_0.5
Available: selinux-policy-targeted-3.7.19-54.el6.noarch (base)
selinux-policy-base = 3.7.19-54.el6
Available: selinux-policy-targeted-3.7.19-54.el6_0.3.noarch (updates)
selinux-policy-base = 3.7.19-54.el6_0.3
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

HOW DID I GET THE ERROR
Frankly, the instructions for install spacewalk on fedorahosted.org are awesome.  I followed those for the basic install along with the notes for setting up postgresql.  They are repeated here pulling out all of the notes for other OSes and leaving just CentOS 6.  Finally, I found the source code while reading a post from a nice fellow here.

PROCEDURE
Configure you prerequisites, I’m using 120GB for disk space and 4GB of RAM for the buildout, then I’ll reduce the RAM to 2GB for operation. I have a virtual environment so this is very simple for me.  I installed CentOS-6 as a minimal install setting up a DNS record for the system name.  After that I just start up upgrading the system.  The rest is just the facts.

yum upgrade -y
# Install some repos that make the install much easier
 rpm -Uvh http://spacewalk.redhat.com/yum/1.5/RHEL/6/x86_64/spacewalk-repo-1.5-1.el6.noarch.rpm
 rpm -Uvh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
 rpm -ihv http://spacewalk.redhat.com/yum/1.5-client/RHEL/6/x86_64/spacewalk-client-repo-1.5-1.el6.noarch.rpm
# Get your GPG keys for redhat
 yum install -y wget
 wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release http://www.redhat.com/security/37017186.txt
 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
# Setup to use available java packages (paste into the command line)
 cat > /etc/yum.repos.d/jpackage-generic.repo << EOF
 [jpackage-generic]
 name=JPackage generic
 baseurl=http://mirrors.dotsrc.org/jpackage/5.0/generic/free/
 enabled=1
 gpgcheck=1
 gpgkey=http://www.jpackage.org/jpackage.asc
 EOF
# Work on PostgreSQL 8.4 or better
 yum install -y 'postgresql-server > 8.4'
 chkconfig postgresql on
 service postgresql initdb
 service postgresql start
# Setup the PostgreSQL DB
 su - postgres -c 'PGPASSWORD=spacepw; createdb spaceschema ; createlang plpgsql spaceschema ; yes $PGPASSWORD | createuser -P -sDR spaceuser'
#Setup the security in the file below adding the lines show _before_ the lines that mention 'all' users
 vi /var/lib/pgsql/data/pg_hba.conf
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
 local   spaceschema     spaceuser                       md5
 host    spaceschema     spaceuser       127.0.0.1/8     md5
 host    spaceschema     spaceuser       ::1/128         md5
# Reload the server
 service postgresql reload
# Test the connection (exit with \q)
 PGPASSWORD=spacepw psql -a -U spaceuser spaceschema
 PGPASSWORD=spacepw psql -h localhost -a -U spaceuser spaceschema
# Make sure you don't have any conflicting packages
 yum remove cobbler-web
 vi /etc/yum.conf and make sure you exclude=cobbler-web
# Build the RPM that is missing from CentOS
 # This means we need some tools for the build environment and
 # specifically, some tools for the RPM (policycoreutils-python)
 yum install rpm-build redhat-rpm-config make gcc policycoreutils-python
wget ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/selinux-policy-3.7.19-93.el6.src.rpm
 rpm -ivv selinux-policy-3.7.19-93.el6.src.rpm
 cd ~/rpmbuild
 rpmbuild --rebuild ../selinux-policy-3.7.19-93.el6.src.rpm
 yum localinstall --nogpgcheck /root/rpmbuild/RPMS/noarch/*.rpm
# Install Spacewalk
 yum install spacewalk-postgresql

I have some other notes about setting up Spacewalk on this site.  I found that more complicated than working through the above steps and hope they may be useful to you.

 

NOTE BENE:

If you upgrade cobbler above version 2.0 and you are running Spacewalk 1.5 (and probably 1.6) then you can expect it to break.  You should probably disable the epel-testing repo and exclude cobbler from the peel repo “exclude=cobbler*, jabberpy”

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.

Installing a System with Spacewalk

I am not going to cover the installation of Spacewalk in this article as there are nice articles on the spacewalk site detailing most of what you need to install it properly.  Yes, it’s tricky and yes, if you have any install questions I’ll do my best to help with those.  However, the goal of this document is to talk about using Spacewalk after you have it installed and configured it.  So this is more of and end user’s guide.  The links directly below are how I got were I was going.

# Installing Spacewalk – The installation
https://fedorahosted.org/spacewalk/wiki/HowToInstall
http://wiki.centos.org/HowTos/PackageManagement/Spacewalk

# Setting up DHCP in Windows
http://unattended.sourceforge.net/pxe-win2k.html

# Setting up Spacewalk – Post install
https://fedorahosted.org/spacewalk/wiki/HowToKickstartCobbler 

IN A NUTSHELL

There are  three ways to force a system rebuild.

  1. Interacting with the PXE menu – Yes, actually touching the system.
  2. Using the System Record in Cobbler
  3. Using Koan from the system to rebuild the system.

Terminology

Cobbler – Uses DHCP, TFTP and DNS to enable network-based installs.  Spacewalk does a lot of writing to cobbler to get things done, but there is a handy command line too.

Koan – A traditional koan is a story told by a Zen master to help enlighten a student.  Little things like “What is the sound of one hand clapping, grasshopper?”  In our case koan is an RPM package that is installed to enable us to request a system rebuild from within the system.

PXE – is the Preboot eXecution Environment that loads on any decent server prior to the OS.  With PXE we can boot from the network and give cobbler and spacewalk a chance at guiding the installation

Spacewalker – Spacewalk is an open source system management system that is upstream from the Redhat Satellite Server.  This means that you and I can run the same software distribution system they use at Redhat which is nice.  For one thing you get a web interface, and a robust system that was built for work in vary large organizations.

HOW TO DO IT

Assuming you have Spacewalk all setup and working this is all pretty simple, but I’ll be editing this article a bit until I’ve worked out all the issues.  Please help me to learn for your experiences as well.

From the PXE Menu – On my Dell servers generally hitting the F12 key on boot will invoke the PXE menu.  Once you invoke the PXE menu and having done nothing else you will see a menu of potential profiles.  Select one and you system will rebuild with that kickstart.

Using Cobbler – This can be done remotely, but you’ll need to ……

sorry, I have to work on other things at the moment.  No more documentation time.

cobbler system add –name <nameOfYourSystem> –mac <mac addr of netboot interface> –profile <a profile from ‘cobbler profile list’>

If you have already added the system to cobbler and simply want to have it rebuild on the next boot use this command:

cobbler system edit –name <nameOfYourSystem> –netboot-enabled=1

koan –replace-self –server=cobbler.example.org [--profile=profile-name] [--system=system-name]

About Jay Farschman - Jay currently works as a Senior Systems Administrator for an asset management company in Colorado where he works with companies that produce hardware, telecommunications software and financial services.  Jay previously owned a consulting company and provided training and consulting services for three Fortune 500 companies and numerous small businesses where he leveraged Linux to provided exceptional value.