Set up Spacewalk 2.3 on CentOS 6

Setting up Spacewalk software content management system on CentOS.

Check this article for Spacewalk 2.4.

Prerequisites

  1. CentOS 6 (x86_64) minimal – make sure your underlying OS is fully up-to-date,
  2. 20GB of free disk space on / is recommended, or
  3. /var/satellite mounted on a dedicated logical volume, with at least 6GB of disk space per channel,
  4. if using PostgreSQL database backend, /var/lib/pgsql mounted on a dedicated logical volume, with 5GB of disk space,
  5. SELinux enforcing mode is recommended,
  6. Iptables turned on with inbound TCP ports 80 and 443 open on iptables for WebUI,
  7. A fully qualified domain name (FQDN), we use puppetm.vb.local in this article.

Setup Spacewalk Server

$ cat /etc/redhat-release
CentOS release 6.6 (Final)

Configure Repositories

Configure required repositories for Spacewalk. EPEL is needed for dependencies (jabberd, dojo etc). At the time of writing, the lastest Spacewalk version is 2.3.

# rpm -Uvh http://yum.spacewalkproject.org/latest/RHEL/6/x86_64/spacewalk-repo-2.3-4.el6.noarch.rpm
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

Additional dependencies are needed from jpackage.

# cat << EOL >/etc/yum.repos.d/jpackage-generic.repo
[jpackage-generic]
name=JPackage generic
mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0
enabled=1
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
EOL

Yum repository list looks like this:

# yum clean all && yum repolist
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: mirrors.clouvider.net
 * epel: mirrors.coreix.net
 * extras: centos.serverspace.co.uk
 * jpackage-generic: ftp.heanet.ie
 * updates: centos.serverspace.co.uk
repo id                 repo name                                             status
base                    CentOS-6 - Base                                        6,518
epel                    Extra Packages for Enterprise Linux 6 - x86_64        11,750
extras                  CentOS-6 - Extras                                         38
jpackage-generic        JPackage generic                                       3,307
spacewalk               Spacewalk                                                115
updates                 CentOS-6 - Updates                                     1,370

Install and Setup Spacewalk

Let Spacewalk setup the PostgreSQL server on our machine without any manual intervention and install the set of RPMs required to get Spacewalk to run:

# yum install spacewalk-setup-postgresql spacewalk-postgresql
# spacewalk-setup --disconnected
* Setting up SELinux..
** Database: Setting up database connection for PostgreSQL backend.
** Database: Installing the database:
** Database: This is a long process that is logged in:
** Database:   /var/log/rhn/install_db.log
*** Progress: #
** Database: Installation complete.
** Database: Populating database.
*** Progress: #############################
* Configuring tomcat.
* Setting up users and groups.
** GPG: Initializing GPG and importing key.
** GPG: Creating /root/.gnupg directory
You must enter an email address.
Admin Email Address? root@localhost
* Performing initial configuration.
* Activating Spacewalk.
** Loading Spacewalk Certificate.
** Verifying certificate locally.
** Activating Spacewalk.
* Configuring apache SSL virtual host.
Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]?
Setup was unable to locate VirtualHost section in existing mod_ssl configuration.
* Configuring jabberd.
* Creating SSL certificates.
CA certificate password? **********
Re-enter CA certificate password? **********
Organization? CentOS6
Organization Unit [puppetm.vb.local]? Spacewalk
Email Address [root@localhost]?
City? Birmingham
State? West Midlands
Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? GB
** SSL: Generating CA certificate.
** SSL: Deploying CA certificate.
** SSL: Generating server certificate.
** SSL: Storing SSL certificates.
* Deploying configuration files.
* Update configuration in database.
* Setting up Cobbler..
Cobbler requires tftp and xinetd services be turned on for PXE provisioning functionality. Enable these services [Y]?
* Restarting services.
Installation complete.
Visit https://puppetm.vb.local to create the Spacewalk administrator account.

If you need to remove the database (say you broke something):

# /usr/bin/spacewalk-setup-postgresql remove --db rhnschema --user rhnuser

Enable and start the service:

# /usr/sbin/spacewalk-service enable ;/
 /usr/sbin/spacewalk-service start
# /usr/sbin/spacewalk-service status
postmaster (pid  3101) is running...
router (pid 3126) is running...
sm (pid 3134) is running...
c2s (pid 3142) is running...
s2s (pid 3150) is running...
tomcat6 (pid 3212) is running...           [  OK  ]
httpd (pid  3355) is running...
osa-dispatcher (pid  3379) is running...
rhn-search is running (3399).
cobblerd (pid 3430) is running...
RHN Taskomatic is running (3454).

Create Channels and Repositories

Go to Channels –> Manage Software Channels –> Manage Repositories –> Create New repository

Go to Channels –> Manage Software Channels –> Create New Channel

Go to Channels –> Manage Software Channels –> Select the created channel –> Repository –> Select the previously created repository –> Update repository

Once updated, click on Sync and then click on Sync Now to start package synchronisation from the upstream server.

Once the package synchronisation is completed, you can check packages:

Go to Systems –> Activation Keys –> Create New Key

Upload RPM Packages to Spacewalk

There are cases when you may need to push one or two customised RPMs to Spacewalk.

This can be done with rhnpush by specifying the channel the packages need to go to, for example:

# rhnpush -v --channel=checkinstall-el6 --server=http://localhost/APP --dir=packages
Connecting to http://localhost/APP
Username: admin
Password:
Package /root/packages/checkinstall-1.6.2-20.2.x86_64.rpm Not Found on RHN Server -- Uploading
Uploading package /root/packages/checkinstall-1.6.2-20.2.x86_64.rpm
Using POST request

Setup Spacewalk Client

Install the Spacewalk yum repository and matching EPEL repository.

# rpm -Uvh http://yum.spacewalkproject.org/2.3-client/RHEL/6/x86_64/spacewalk-client-repo-2.3-2.el6.noarch.rpm
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

Install client packages:

# yum install rhn-client-tools rhn-check rhn-setup rhnsd m2crypto yum-rhn-plugin

Install Spacewalk’s CA certificate on the server to enable SSL communication:

# wget -O /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT http://puppetm.vb.local/pub/RHN-ORG-TRUSTED-SSL-CERT

Register your system to Spacewalk using the activation key you created earlier:

# cat /usr/local/bin/spacewalk-register.sh
#!/bin/bash

if [[ $# -gt 0 ]]; then
    reg_opts="$*"
fi

if [[ $reg_opts =~ --(activationkey|profilename) ]]; then
    echo "usage: $0 "
    echo " are passed as is to rhnreg_ks"
    echo "       do not use profile name or activationkey opts these are"
    echo "       hardcoded into the script"
    exit 1
fi

read -p "Enter profile name: " profile
echo "Registering system as: ${profile}"
rhnreg_ks --force --activationkey="1-centos6-custom-spacewalk-key" \
  --serverUrl=https://puppetm.vb.local/XMLRPC \
  --sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT \
  --profilename=${profile} ${reg_opts}
# yum repolist
Loaded plugins: fastestmirror, rhnplugin, security
This system is receiving updates from RHN Classic or Red Hat Satellite.
Loading mirror speeds from cached hostfile
repo id                     repo name                     status
centos-6.6-parent-x86_64    centos-6.6-parent-x86_64      6,518
repolist: 6,518

References

https://fedorahosted.org/spacewalk/wiki/HowToInstall
http://wiki.centos.org/HowTos/PackageManagement/Spacewalk
http://www.itzgeek.com/how-tos/linux/centos-how-tos/configuring-spacewalk-upoading-content-on-spacewalk-in-centos-6-rhel-6.html
http://www.server-world.info/en/note?os=CentOS_6&p=spacewalk

Related Posts

Setup Spacewalk 2.4 on CentOS 6

2 thoughts on “Set up Spacewalk 2.3 on CentOS 6

  1. spacewalk-repo-2.4-3.el6.noarch.rpm

    NOTE: Above doc need small correction while download spacewalk repo.

Leave a Reply to Arsalan Cancel reply

Your email address will not be published. Required fields are marked *