Pageviews

Wednesday, 1 April 2015

Spacewalk Installation on Centos


Introduction:
Spacewalk is an open source configuration/Patch management tool sponsored by Red Hat. Spacewalk is alternate of Redhat network satellite server on Centos / Fedora / Scientific Linux.

Features of Spacewalk:
Ø  Manage Inventory of Servers (hardware and software information)
Ø  Install and update software on Servers
Ø  Manage and deploy configuration files to your systems
Ø  Monitor your systems / Servers

Step: 1 Setup Spacewalk Repo:

 #  rpm -Uvh http://yum.spacewalkproject.org/1.9/RHEL/6/x86_64/spacewalk-repo-1.9-1.el6.noarch.rpm

Step: 2 Setup Additional Repositories

Spacewalk on CentOS will require additional dependencies that are needed from jpackage

#  vim /etc/yum.repos.d/jpackage-generic.repo
then Paste the below command and save the Editor
[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

Enable EPEL Repository:
Spacewalk requires a Java Virtual Machine with version 1.6.0 or greater

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Step: 3 Spacewalk Database Server Installation:

Spacewalk uses database to store its primary data, it supports PostgreSQL

# yum install spacewalk-setup-embedded-postgresql
# yum install spacewalk-postgresql

Create a file under /root called ‘answer’ with below contents:

# vi /root/answers

admin-email = root@localhost
ssl-set-org = Nextstep4it
ssl-set-org-unit = IT
ssl-set-city = Delhi
ssl-set-state = Delhi
ssl-set-country = IN
ssl-password = Ppts@123
ssl-set-email = root@localhost
ssl-config-sslvhost = Y
db-backend=postgresql
db-name=spacewalkdb
db-user=spacewalk
db-password=Ppts@123
db-host=localhost
db-port=5432
enable-tftp=Y

Now Install Spacewalk with an Answer File

#  spacewalk-setup --disconnected –answer-file=/root/answers

(After spacewalk-setup is complete, application is ready to use)

Step:5 Access the Spacewalk using below URL and set administrative account:


Spacewalk URL: ‘https://10.10.1.01

After Setting the Administrative account, we can login to spacewalk admin GUI:


After completing the account setup, you will be redirected to the main window. Here you can see the detailed overview of each and everything that are related to Spacewalk.


Setting Software Channels:

Step: 1
Set a Base channel this channel will contain all base packages for a system. The first Base Channel that we will set will be the one for CentOS 6.0 the version of CentOS used for the Spacewalk Server. Follow this steps one logged in:

1.       Click on Channels
2.       Click on Manage Software Channels
3.       Click on Manage Repositories
4.       Click on Create New Repository


Step: 2 GPG Key import

Spacewalk Server will not deploy packages from any repository for which it does not have the GPG Public key used to sign the packages. These keys are placed in the root of the version of the repository that one will use. First we need to download these keys import them so as to get the key ID and Fingerprint for when setting the channel and they should also be imported using rpm on the Spacewalk server. For the base CentOS repository we download the keys to import them with GPG to get the key information:

# mkdir repo_keys
# cd repo_keys
# curl -O http://mirror.facebook.net/centos/6/os/i386/RPM-GPG-KEY-CentOS-6

Create one channel per set of repositories so it is easier to manage the key:

gpg --list-keys --fingerprint C105B9DE
rpm --import http://mirror.facebook.net/centos/6/os/i386/RPM-GPG-KEY-CentOS-6


Creating Repositories:
We will create 2 Repositories for CentOS 6.X the first one will be the base repository and second is the Updates.
  1. Repository Labe – PPTS-CentOS6-i386-Base
  2. Repository URL - http://mirror.facebook.net/centos/6/os/i386/
  3. Then click on Create Repository
For the updates repository enter:

Let’s create a repository for VMWare Tools for vSphere 5.1:
     
  1. Repository Label - VMware-Tools-ESX-5.1-RHL6
  2. Repository URL - http://packages.vmware.com/tools/esx/5.1/rhel6/x86_64/index.html
  3. Then click on Create Repository
    Creating Channels: 
    We will create a new channel that will use both Repositories:
1.       Click on Channels
2.       Click on Manage Software Channels
3.       Click on Create New Channel

Enter the Following Mandatory Parameters:

Channel Name –
Channel Label –
Parent Channel – 
Parent Channel Architecture – 
Yum Repository Checksum Type – 
Channel Summary -

As like below screen shot provided.

Under Channel Access Control Select:

·         All users within your organization may subscribe to this channel.
·         This channel is public and may be accessed by any of the trusted organizations trusted by this organization.
Click Create channel
 


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

(Here you can link the repository to the channel based on architecture).

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


Once the package synchronization is completed, you can list the synchronized packages by going to

Channels –> Manage Software Channels –> Select your channel –> Packages –> List / Remove






Goto

Systems –> Activation Keys –> Create New Key

(Here create a activation keys for client subscription, in this page you need to select the base channel (Newly created channel). Whenever any client uses this key, the client machine will be automatically subscribed to the created channel. Create multiple keys; in case to use multiple channels).

Note: Better to leave the key blank for automatic generation.


You can get the activation key by going to Systems –> Activation Keys.

 
 

Client software Installation:

To connect the system the appropriate client software must be installed on the system

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

Now Register Linux Server with Spacewalk

#  rhnreg_ks --force --serverUrl=http://10.10.20.101 /XMLRPC --activationkey=1-6f0183f8cb1815adeebe38f4ffd445d6
# rhn-actions-control --enable-all

Above commands will register your Linux server with Spacewalk, just replace activation key according to your setup.

Now Login to Spacewalk admin panel, Click on System, then click on Register Server Name, As we can see updates are available.

 
 

Schedule to install all the updates:

Select all the packages and Click on Upgrade Package.
When clicking on ‘Upgrade Package‘, then it will ask to schedule upgrade.