Spacewalk is an open source Linux systems management solution. Spacewalk is the upstream community project from which the Red Hat Satellite product is derived.
Spacewalk manages software content updates for Red Hat derived distributions such as Fedora, CentOS, and Scientific Linux, within your firewall. You can stage software content through different environments, managing the deployment of updates to systems and allowing you to view at which update level any given system is at across your deployment. A central web interface allows viewing of systems, their associated software update status, and initiating update actions.
Additional Management Capabilities
Spacewalk provides provisioning and monitoring capabilities, allowing you to manage your systems throughout their lifecycle. Via Provisioning, Spacewalk enables you to kickstart provision systems and manage and deploy configuration files. The monitoring feature allows you to view the status off your systems alongside their software update status. Spacewalk also has virtualization capabilities to enable you to provision, control, manage, and monitor virtual KVM and Xen guests.
The supported database options are Postgres and Oracl, so in this case we are using Postgres. Follow the steps shown below to install Spacewalk Server on Centos 6
Download the spacewalk repo
Install the spacewalk repo
[root@server]# rpm –ivh spacewalk-repo-1.9-1.el6.noarch.rpm
Install the yum priorities plugin
[root@server ]# yum install yum-plugin-priorities
Install the rest of the required repo’s
[root@server]# rpm -Uvh http://mirrors.dotsrc.org/jpackage/5.0/generic/free/RPMS/jpackage-release-5-4.jpp5.noarch.rpm
[root@server]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@server]# rpm -Uvh http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@server~]# rpm –ivh http://spacewalk.redhat.com/yum/1.7-client/RHEL/6/x86_64/spacewalk-client-repo-1.7-5.el6.noarch.rpm
Next you need to make a change to the jpackage repo
[root@server]# vim /etc/yum.repos.d/jpackage.repo
Look for the following section at the bottom
name=JPackage (free) for distro $releasever
You need to change the mirrorlist line so it looks like the following. The difference is the $releasever has been changed to 5.0
name=JPackage (free) for distro $releasever
Next Step is to Cleanup YUM
[root@server]# yum clean all
Next install Postgres, set it to run on boot and run the initial configuration
[root@server~]# yum install postgresql postgresql-contrib postgresql-devel postgresql-server
[root@server~]# chkconfig postgresql on
[root@server~]# service postgresql initdb
[root@server~]# service postgresql start
Create the database and user for Spacewalk
[root@server~]# su – postgres -c ‘PGPASSWORD=spacepw; createdb spacedb ; createlang plpgsql spacedb ; yes $PGPASSWORD | createuser -P -sDR spaceuser’
Now you need to configure the user to use an md5 password
[root@server~]# vim /var/lib/pgsql/data/pg_hba.conf
At the bottom of the config file you will see to following lines
# “local” is for Unix domain socket connections only
local all all ident
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
Before those lines add the following:
local spacedb spaceuser md5
host spacedb spaceuser 127.0.0.1/8 md5
host spacedb spaceuser ::1/128 md5
local spacedb postgres ident
Reload Postgres for the changes to take effect
[root@server~]# service postgresql reload
Now install Spacewalk. It will take some time on a minimal install it had to install over 400 dependencies.
[root@server~]# yum install spacewalk-postgresql
[root@server~]# yum install spacewalk-setup-embedded-postgresql
Once it is installed run the Spacewalk setup
[root@server~]# spacewalk-setup –disconnected
You will first be prompted for the database information. Leave the location blank, the database is spacedb, the username is spaceuser and the password is spacepw
** Database: Setting up database connection for PostgreSQL backend.
Hostname (leave empty for local)?
The rest you can use the defaults. The final step will be generating a SSL certificate, just enter your details as required
Access the web interface by going to https://IPADDRESS you will be prompted to create a user. Once done you are ready to start connecting client machines.
The goal is to deploy a new machine with an os, this means the obvious next step is to populate spacewalk with a Red Hat derived Linux distribution of your choice.
First step is to mount the CentOS 6.1 iso’s somewhere on your spacewalk server. Make sure to get a full distro iso, this means that required directories like, for example, images/pxeboot do exist. The packages which belong to a distribution are administered in Spacewalk as software channels, so we first have to create a software channel before we can add/upload packages to it.
Create a new software channel by opening the spacewalk console and navigate to:
“Channels” -> “Manage Software Channels” -> “Create New Channel”
Enter a reasonable channel name (this is for display only, e.g: “CentOS 6.1 – 64 Bit”), a channel label (remember this name for later use,e.g: “centos6.1-x86_64″) and select the correct architecture (x86_64).
Next step is to populate spacewalk with the CentOS packages, this proces is started by issuing the following command:
rhnpush -v –channel=centos6.1-x86_64 –server=http://localhost –dir=/path/to/Packages
where “/path/to/Packages” is the absolute path of the Packages directory of the mounted iso.
CentOS 6.1 consists of two dvd’s, execute above step for both dvd’s.
The rhnpush process uploads all packages and registers them in spacewalk. On average, rhnpush processes packages at a rate of around 2000 packages per 30 minutes (ofcourse depending on the configuration of your host and vm). CentOS 6.1 contains almost 6200 packages so, it will take around one and a half hour to upload all packages from dvd1 and dvd2 to spacewalk.
The deployed linux system should to be able to connect to the spacewalk server and use it’s package and configuration management facilities it is recommended to include the spacewalk client packages in a spacewalk channel as well. Now we will upload the packages directly from the online repository into a child channel of the just created CentOS channel.
In the spacewalk console navigate to:
“Channels” -> “Manage Software Channels” -> “Create New Channel”
Enter a reasonable channel name ( e.g. : “Spacewalk Client 1.5 – el6 – 64 Bit”), a channel label (e.g. “swclnt1.5-el6-x86_64″), the correct architecture (x86_64) and the correct parent channel (e.g. : “CentOS 6.1 – 64 Bit”).
Populating spacewalk with the spacewalk client packages directly from the online repository is started by issuing the following command:
spacewalk-repo-sync -c swclnt1.5-el6-x86_64 –url http://spacewalk.redhat.com/yum/1.5-client/RHEL/6/x86_64
The spacewalk client has a dependency on the python-hwdata-1.2-1.el6.noarch.rpm package from the epel repository. Download the python-hwdata-1.2-1.el6.noarch.rpm package from the epel repositor http://download.fedora.redhat.com/pub/epel/6/x86_64/
and upload it to the spacewalk client child channel using the command (assuming you downloaded the rpm to a folder named epel):
rhnpush -v –channel=swclnt1.5-el6-x86_64 –server=http://localhost -dir=epel
Create a distribution
For automating the installation of a Linux system a method called kickstart can be used. First, we have to setup a directory structure on the spacewalk server based on content of the CentOS dvd1 iso. From your CentOS 6.1 dvd1, copy the following directories:
Next, open the spacewalk console and navigate to the following location:
systems -> kickstart -> distributions -> new distribution
Enter the following parameters for the new distribution:
- Distribution label: centos6.1-x86_64
- tree path: /var/distro-trees/centos6.1-x86_64
- Base Channel: CentOS 6.1 – 64 Bit
- Installer Generation: Red Hat Enterprise Linux 6
Next step is to create a kickstart profile for the channel and distribution. Open the spacewalk console and navigate to the following location:
systems -> kickstart -> create new kickstart profile
Enter the following parameters for the new kickstart profile:
- Label: centos61-minimal
- Base channel: CentOS 6.1 – 64 Bit
- Kickstartable tree: centos6.1-x86_64
- Virtualization type: none
To make sure the spacewalk client repository is used during kickstart, navigate to the following location:
systems -> kickstart -> profiles -> centos61-minimal -> operating system
Make sure the child channel swclnt1.5-el6-x86_64 is checked.
Also, have a look at the other tabs to have an idea of the configuration options which are available. Possible interesting area’s are:
- Software: Adding extra packages or package groups in addition to the base installation. Add the package just by adding it on a new line, package groups can be added by an @-sign followed by the group name. A package can be excluded by an hyphen (-) followed by the package name
- Kickstart details -> Details -> Kernel options: Adding and removing kernel options. You can add a kernel option, just by adding it’s key/value pair to the input field. Removal is done by just mentioning the kernel option preceded by an ! and giving it ~ as a value. For example, the value “!text=~ resolution=800×600″ in the kernel option box forces the use of the graphical installer (remove the text kernel option) and sets screen resolution to 800×600.
- Kickstart details -> Advanced options: Allows detailed configuration of the kickstarted system. For example, to add an user,during installation, named weblogic with password weblogic01, tick the “user” checkbox and add the value “–name=weblogic –password=weblogic01 –plaintext” to the input field.
- Kickstart details -> Variables: the usage of variables can be done by adding a key/value pair and refer to it in another tab. For example , to define the hostname during kickstart, add a key/value pair (hostname=appsrvr1) in the variables tab and refer to it in the Advanced options by adding “–hostname $hostname” to the network text box.
Next step is to create an iso image to boot a new vm from.
Important note: In the next couple of steps we are going to deploy a new linux virtual machine. If the virtualization network setup supports a dns where the spacewalk server can be found by its hostname skip the next step.
In other words, your newly created vm must be able to find the spacewalk server using it’s hostname during boot/initial setup. If this is not the case or if you are unsure, please perform the following step to change the spacewalk hostname to its ip-address, if you are sure dns is in place you can skip this step:
In /etc/rhn/rhn.conf change the value of the parameter cobbler.host to the ip address of the spacewalk server.
In /etc/cobbler/settings change the value of the parameters server and redhat_management_server to the ip-address of the spacewalk server.
On the spacewalk server, run the command (this only needs to be done once):
Next, start building the iso using the command:
The result of the buildiso command is a file named generated.iso in the directory from where you issued the command.
On your host, create a new virtual machine and provide it with the generated.iso file to boot from. Upon boot you will see a menu as shown below allowing you to specify the centos61-minimal setup to be installed.
Installation will take some time. After installation is finished we will configure this client to talk with spacewalk server.
Configuring spacewalk client
The following instructions are for configuring a Centos 6 box to talk to a Spacewalk server
Install the Spacewalk Client repo
[root@client~]# rpm -Uvh http://spacewalk.redhat.com/yum/1.7/RHEL/6/i386/spacewalk-client-repo-1.7-5.el6.noarch.rpm
Clean all the yum repos
[root@client~]# yum clean all
Install the required packages
[root@client~]# yum install rhn-client-tools rhn-check rhn-setup rhnsd m2crypto yum-rhn-plugin
Now you need to generate a activation key. The steps to do this are:
- Log into the Spacewalk web interface
- From the top navigation select Systems
- In the left navigation select Activation Keys
- In the top right hand corner click New Key
- Enter a name for this activation key and click Create Activation Key
- The activation key will then populate
On the client run the configuration tool. Replace the IP and activation key with those from your setup. Once done your computer will be visible in the list of systems in spacewalk.
[root@client~]# rhnreg_ks –serverUrl=http://x.x.x.x/XMLRPC –activationkey=1-414ace93e6c3e94c85aec54a653e761d
Note: x.x.x.x is your spacewalk server IP address