Configuring Spacewalk Server


Configuring Channels and Repositories

Configure channels and repositories as described on this page.

The command executed when you schedule a sync is (for example):

/usr/bin/python -u /usr/bin/spacewalk-repo-sync --channel epel-i386 --type yum

Syncing repositories manually

Scheduling syncs via the Spacewalk server will almost always require you to tail files in /var/log/rhn/reposync and will produce a strange directory structure (see sections below). However, if you wanted to do these things yourself, you could try this:

# Sync repositories to a local folder  
# Make the Spacewalk server aware of synced repos  

Determing GPG information

Adding a channel requires the key URL, ID and fingerprint. This is easy to determine:

wget [](  
gpg --import RPM-GPG-KEY-CentOS-testing  
gpg --list-public-keys --fingerprint

This will produce output like:

pub   1024D/F24F1B08 2002-04-23 [expired: 2004-04-22]  
      Key fingerprint = D8CC 06C2 77EC 9C53 372F  C199 B1EE 1799 F24F 1B08  
uid                  Red Hat, Inc (Red Hat Network) <>  
pub   2048R/C236FD2B 2010-12-20 [expires: 2011-12-20]  
      Key fingerprint = 8E05 7113 DF16 CB7A E7A5  0422 A8E4 0177 C236 FD2B  
uid                  Nikhil Anand <>  
pub   1024D/910620BF 2010-05-12  
      Key fingerprint = B3B6 A608 6012 F724 52C3  03F4 D085 AAC6 9106 20BF  
uid                  Nicolai <>  
sub   4096g/29673670 2010-05-12  
pub   1024D/7203F491 2005-11-19  
      Key fingerprint = BCD0 0AEB A3C0 39D7 25E0  663C 5C37 C0B1 7203 F491  
uid                  CentOS-testing (CentOS Developers testing key) <>  
sub   2048g/537F5CB3 2005-11-19

7203F491 is your key ID.

Local repositories and Log files

RPMs are staged in /var/cache/reposync and then moved to /var/satellite/redhat. The directory structure looks like this:

[root@spacewalk /var/satellite/redhat/1]# tree 62c
|-- hmaccalc`  
|   `-- 0.9.6-3.el5  
|       `-- i386  
|           `-- 62cdfcfe805ee49082434653625f84f4  
|               `-- hmaccalc-0.9.6-3.el5.i386.rpm  
|-- python-docs`  
|   `-- 2.4.3-1.1  
|       `-- noarch  
|           `-- 62cbc246046f1cb5306758842f738725  
|               `-- python-docs-2.4.3-1.1.noarch.rpm  
`-- tkinter  
    `-- 2.4.3-27.el5  
        `-- i386  
            `-- 62c1a8dc30931e7ec0d947dbef6db2d7  
                `-- tkinter-2.4.3-27.el5.i386.rpm

Log files are stored in /var/log/rhn. When you schedule a sync action, you’ll see log files appear in /var/log/rhn/reposync. For other actions, use rhn_taskomatic_daemon.log (use ls -ltr to see which log files have changed after you’ve done something!)

Syncing Errata

This page has a fantastic Python script that goes through mail archives, digests and mailing list websites for errata and pushes them to the Spacewalk server. It does have a few limitations you should be aware of (on the download page). It takes care of duplicates and takes a considerable amount of time.

Also remember that you won’t get the current month’s errata this way. The gzipped archives are only available at the end of every month from the CentOS lists.

The script attempts to pull information on a given package using its ID. If this fails, it looks at package_dir (see below). The problem is that it expects package_dir to be a flat directory with all the RPMs in it. This is not the default case.

I run this command daily. Not appending the --password option results in the script asking for a RHN password.

/opt/spacewalk-errata/ --config=/opt/spacewalk-errata/centos-errata.cfg \  
                                       --password="XXXXXXXXX" \  

You can also write a small script that gunzip’s archive files from the actual mailing list. Here’s a sample script:

# Processes CentOS Errata and imports it into Spacewalk

DATE=`date +"%Y-%B" +d '1 month ago'`

# Fetch and uncompress errata data from the CentOS lists`  
wget -P /opt/spacewalk-errata/errata$DATE.txt.gz
gunzip -f /opt/spacewalk-errata/errata/$DATE.txt.gz

# Processes and imports the errata.
cd /opt/spacewalk-errata/ && \
   /opt/spacewalk-errata/ --format=archive /opt/spacewalk-errata/errata/$DATE.txt \
   --config=/opt/spacewalk-errata/centos-errata.cfg >> /var/log/centos-errata.log

I don’t know why you have to supply your password; it should already be in the config file (/opt/spacewalk-errata/centos-errata.cfg). Speaking of, here’s what mine looks like:

[centos errata]  
#Required to identify applicable messages on the centos-announce mailing list  
#Useful for interpolation below, not used by tool itself  
#If true the script will attempt to use the Redhat Network to populate the errata description  
# I only set spacewalk and not "dir" since I want the script to rely on Spacewalk   
# exclusively to get package signatures  
#Maximum number of errata to process at once. Only relevant to format ''  
#The tool will prompt you if you don't specify a password  
# Enter the name of the channel that the errata will link to.  
# Enter the name of the channel that the errata will link to.  

(Stateful) Firewall Rules

You’ll have to accept incoming connections on port 443 (HTTPS) for basic functionality. If you want to push configs to clients, here are the relevant stateful iptables rules. Port 5222 shows up in /etc/services as “xmpp-client”.

# On server  
iptables -A INPUT -p tcp --dport 5222 -m state --state NEW -j ACCEPT  
iptables -A INPUT -p udp --dport 5222 -m state --state NEW -j ACCEPT  
# If you're filtering outputs on client  
iptables -A OUTPUT -d $SPACEWALK_SERVER -p tcp --dport 5222 -m state --state NEW -j ACCEPT  
iptables -A OUTPUT -d $SPACEWALK_SERVER -p udp --dport 5222 -m state --state NEW -j ACCEPT

Error with repodata.xml with EPEL

For some reason /var/cache/rhn/repodata/epel-i386 doesn’t have the repodata.xml file. The source I configured the repository with doesn’t have it either. I had to manually download it:

wget -P /var/cache/rhn/repodata/epel-i386/

Pertinent services


xinetd and tftpd need to be started if you plan on kickstarting nodes. jabberd is very essential to push configs to nodes.

Enable Monitoring

Now you need to configure each client. See the appropriate section in the client config page for how to do this. Essentially, you’ll use a keyless SSH login as user nocpulse (a company acquired by Red Hat) to get metrics from clients.

Although the default port for NOCpulse is 4545, you can monitor via port 22 as well. Just look for the port option when creating a probe. You can test a connection by issuing this from the RHN server:

ssh -l nocpulse -p 4545 -i /var/lib/nocpulse/.ssh/nocpulse-identity

Getting ready to register clients

Working with the Oracle XE Database

Some quick points:

You can do a:

I personally do a ‘cold’ backup since I couldn’t get startup mount to work with setting up

Weird Fonts in History Graphs

Spacewalk uses jFreeChart for graphing. jFreeChart relies on the JVM for font configuration. This is found in the $JAVAHOME/lib/fontconfig.* files (there’s more information on this).

Basically, you need to install the DejaVu font package on your server if you see weird, cursive fonts:

yum -y install dejavu-lgc-fonts

Cleaning your log files

reposync generates a lot of logs and doesn’t have a logrotate configuration. So I added this to crontab to prevent things from getting out of control:

# Clean the log directory every day at noon  
0 0 * * * /usr/bin/find /var/log/rhn/reposync/ -type f -ctime +0 | xargs rm -rf