Installing Spacewalk server on CentOS 7

About Spacewalk

Spacewalk is an open source Linux systems management software. Spacewalk is the upstream community project, derived from Red Hat Satellite software.

Using Spacewalk, we can easily configure, manage and deploy software packaged to Linux distros such as CentOS, Red Hat, Fedora and such. It has nice web interface, that we can use to monitor the status of software updates on our servers and start update process. Spacewalk provides provisioning capabilities that enables the user to kickstart provision systems and manage and deploy configuration files. This piece of software also has virtualization capabilities to enable you to provision, control, manage, and monitor virtual KVM and Xen guests.

Features

Using Spacewalk, you have the capabilities for:

  • Inventory your systems (hardware and software additional information)
  • Install and update software on your running systems
  • Collect and distribute your custom software packages into manageable groups
  • Provision (kickstart) your systems Manage and deploy configuration files to your systems
  • Provision and start/stop/configure virtual guests
  • Distribute content across multiple geographical sites in an efficient manner
  • And many other options

Our test system on which we install Spacewalk:

  • OS: CentOS Linux release 7.3.1611 x86_64
  • IP Address: 10.10.0.101
  • Hostname: spacewalk.dzhorov.com

Install the necessary repositories:

Epel:

yum install epel-release

Official Spacewalk repo:

rpm -Uvh http://yum.spacewalkproject.org/2.3/RHEL/7/x86_64/spacewalk-repo-2.3-4.el7.noarch.rpm

JPackage repository. Run the following code to import it in your repos list:

cat > /etc/yum.repos.d/jpackage-generic.repo << EOF
[jpackage-generic]
name=JPackage generic
#baseurl=http://mirrors.dotsrc.org/pub/jpackage/5.0/generic/free/
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
EOF

You can check out your currently enabled repositories with the following command:

yum repolist

We can now begin with the installation of Spacewalk. We will use the default PostgreSQL database setup. You will install spawalk along with PostgreSQL and other packages such as Tomcat, Perl modules, Ruby, Java, Jboss and etc:

yum -y install spacewalk-setup-postgresql postgresql-server

You might get an error such as this:

file /usr/share/java/commons-fileupload.jar conflicts between attempted installs of jakarta-commons-fileupload-1:1.2.1-1.jpp5.noarch and apache-commons-fileupload-1.3.2-3.el7.noarch

This is because the new package of apache-commons-fileupload no more provides jakarta-commons-fileupload. This has been fixed in epel-testing repository. You might need to enable this repo in order to install spacewalk-postgresql. In order to do that, open the following file:

/etc/yum.repos.d/epel-testing.repo

and change

[epel-testing]
name=Extra Packages for Enterprise Linux 7 - Testing - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

to this:

[epel-testing]
name=Extra Packages for Enterprise Linux 7 - Testing - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

Save the file and try to issue yum -y install spacewalk-setup-postgresql once more and you should be good to go!

In order to complete the initial configuration of Spacewalk, your server must have a Fully Qualified Domain Name (FQDN). If you don't have such at hand, you can add an entry to your /etc/hosts. Here is what mine looks like:

127.0.0.1       localhost
10.10.0.101     spacewalk spacewalk.dzhorov.com

Then we need to setup the PostgreSQL initial database:

postgresql-setup initdb

Edit the file /var/lib/pgsql/data/pg_hba.conf and add the following entries before the first ones:

local spacewalkdb spacewalk md5
host  spacewalkdb spacewalk 127.0.0.1/8 md5
host  spacewalkdb spacewalk ::1/128 md5
local spacewalkdb postgres  ident

And start the service:

service postgresql start

If you get an error like this:

** Database: Setting up database connection for PostgreSQL backend.
The spacewalk-setup-postgresql does not seem to be available.
You might want to use --external-oracle or --external-postgresql command line option.

You will need to install the spacewalk-setup-postgresql package:

yum install -y spacewalk-setup-postgresql

Next, we need to setup our PostgreSQL database. In order to do that, swith to user "postgres" like that:

su postgres -

And create the database:

-bash-4.2$ PGPASSWORD=spacewalkpass
-bash-4.2$ createdb spacewalkdb
-bash-4.2$ createlang plpgsql spacewalkdb
createlang: language "plpgsql" is already installed in database "spacewalkdb"
-bash-4.2$ createuser -P -sDR spacewalk
Enter password for new role: 
Enter it again: 
-bash-4.2$ exit

We can now issue the final Spacewalk installation with the following command. It will Install the satellite in disconnected mode:

spacewalk-setup --disconnected

Sample output of the above command if you've followed this guide successfully:

** Database: Setting up database connection for PostgreSQL backend.
Database "rhnschema" does not exist
** 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? [email protected]
* 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]? Y
** /etc/httpd/conf.d/ssl.conf has been backed up to ssl.conf-swsave
* Configuring jabberd.
* Creating SSL certificates.
CA certificate password? 
You must enter a password.
CA certificate password? 
Re-enter CA certificate password? 
Organization? n/a
Organization Unit [spacewalk.dzhorov.com]? 
Email Address [[email protected]]? 
City? Sofia
State? Sofia
Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? BG
** 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.

You should be able to visit your Spacewalk web UI by visiting https://. If you get wierd 404 errors like this:

404 Error - File Not Found /rhn/Login.do

Then the issue is with the c3p0 package. You need to downgrade it in order to get it installed from jpackage repository:

yum -y downgrade c3p0
service tomcat restart
service httpd restart

The working c3p0 version I currently have installed is 0.9.1.2-2.jpp5.

After this, your Spacewalk should be accessible via web and you will be asked to create your administrative login:

spacewalk-create-fist-login

And then we've successfully completed the setup:

spacewalk-initial-login-screen

Comments