Managing Channels and Repositories in Spacewalk – CentOS 7 / RHEL 7 & CentOS 6 / RHEL 6

0

In our previous article, we have gone through the installation of SpaceWalk. Here, in this tutorial, we will see how to configure Spacewalk to distribute updates for CentOS or RHEL clients.

Article Series:

Install Spacewalk

How to Install SpaceWalk on CentOS 7 / RHEL 7

How to Install SpaceWalk on CentOS 6 / RHEL 6

Manage Spacewalk

Managing Channels and Repositories in Spacewalk

Register clients with SpaceWalk Server

This is a simple step by step process, and we do minimal settings what to be done for distributing updates.

Spacewalk Channels

Channel is nothing but a collection of software (RPM) packages. A channel may contain packages from a specific distribution or contains packages for an application or family of applications. Users may also define channels.

Any client can subscribe to a particular channel to download, update, install packages. The channels are linked to upstream server (a normal YUM/DEB repository). A channel may have linked to multiple repositories, can be cloned, sync or customized.

There are two types of channels:

  1. Base channels
  2. Child channels

A base channel consists of packages based on a specific architecture and Red Hat Enterprise Linux release. A child channel is a channel associated with a base channel that contains extra packages. A system must be subscribed to only one base channel but it can be subscribed to multiple child channels of its base channel.

A subscribed system can only install or update packages available through its Satellite channels.

Create a Base Channel

Access the Spacewalk web console using the username and password that you defined in the previous tutorial.

https://spacewalk-server-ip

Goto Channels >> Manage Software Channels >> Create Channel.

Managing Channels and Repositories in Spacewalk - Create Base Channel
Managing Channels and Repositories in Spacewalk – Create Base Channel

This is where you create a channel for your machine. My base channel looks like this.

Channel Name: itzgeek_centos7

Channel Label: itzgeek_centos7

Parent Channel: None (Because this is a Base Channel)

Architecture: x86_64

Channel Summary: ITzGeek CentOS 7 Base Channel

Leave the remaining as it is. Likewise, you can create a channel for different versions of CentOS / RHEL machines and architectures.

You need to be very careful while choosing an architecture for the channel as the machine with the same architecture can only able to subscribe to this channel.
Managing Channels and Repositories in Spacewalk - Base Channel Information
Managing Channels and Repositories in Spacewalk – Base Channel Information
Managing Channels and Repositories in Spacewalk - Base Channel Information
Managing Channels and Repositories in Spacewalk – Base Channel Information

Create a repository for Base Channel

Goto Channels >> Manage Software Channels >> Manage Repositories >> Create repository.

Managing Channels and Repositories in Spacewalk - Create Repository
Managing Channels and Repositories in Spacewalk – Create Repository

Here you should mention the upstream server from where Spacewalk server will download packages for clients.

Repository Details:

Repository Name: CentOS 7 x86_64

Repository URL: http://mirror.rackspace.com/CentOS/7/os/x86_64/

Repository Type: yum

For a demo, I used http://mirror.rackspace.com/CentOS/7/os/x86_64/ as Repository URL. This repository URL is one of the CentOS mirrors. You can find more mirrors here.

Managing Channels and Repositories in Spacewalk - Repository Information
Managing Channels and Repositories in Spacewalk – Repository Information

Attaching a repository to Base channel

Goto Channels >> Manage Software Channels >> Select the created channel (itzgeek_centos7) >> Repository >> Select the previously created repository (CentOS 7 x86_64) >> Update Repositories.

Managing Channels and Repositories in Spacewalk - Attach repository to Base Channel
Managing Channels and Repositories in Spacewalk – Attach repository to Base Channel

Now its time to sync packages from the upstream server.

Go to Channels >> Manage Software Channels >> Select the created channel >> Repository >> Sync >> Sync Now.

You can also sync the repository any time later by using the schedule option just below the Sync Now.
Managing Channels and Repositories in Spacewalk - Synchronize Channel
Managing Channels and Repositories in Spacewalk – Synchronize Channel

OR

Run below command to sync with the upstream server.

# /usr/bin/spacewalk-repo-sync --channel  itzgeek_centos7 --type yum

Note: The packages will be downloaded from the upstream server will be kept in /var/satellite/ folder of your Spacewalk server. Make sure you have enough space in /var/satellite/ folder.

You can go through sync logs to troubleshoot any issues arise during the synchronization.

# cat /var/log/rhn/reposync/<reponame>.log

Log Output:

2018/01/06 00:28:00 -04:00 Command: ['/usr/bin/spacewalk-repo-sync', '--channel', 'itzgeek_centos7', '--type', 'yum']
2018/01/06 00:28:00 -04:00 Sync of channel started.
2018/01/06 00:28:00 -04:00 Repo URL: http://mirror.rackspace.com/CentOS/7/os/x86_64/
2018/01/06 00:28:13 -04:00 Packages in repo:              9591
2018/01/06 00:28:25 -04:00 Packages already synced:          0
2018/01/06 00:28:25 -04:00 Packages to sync:              9591
2018/01/06 00:28:26 -04:00 New packages to download:      9591
2018/01/06 00:28:29 -04:00 1/9591 : 389-ds-base-1.3.6.1-16.el7.x86_64.rpm
2018/01/06 00:28:29 -04:00 2/9591 : ElectricFence-2.2.2-39.el7.i686.rpm

.     .     .
.     .     .

2018/01/06 02:15:18 -04:00 9588/9591 : zziplib-utils-0.13.62-5.el7.x86_64.rpm
2018/01/06 02:15:19 -04:00 9589/9591 : zsh-html-5.0.2-28.el7.x86_64.rpm
2018/01/06 02:15:23 -04:00 9590/9591 : zsh-5.0.2-28.el7.x86_64.rpm
2018/01/06 02:16:23 -04:00 9591/9591 : xulrunner-31.6.0-2.el7.centos.i686.rpm
2018/01/06 02:16:24 -04:00 Importing packages started.
2018/01/06 02:35:20 -04:00 Importing packages finished.
2018/01/06 02:35:20 -04:00 Linking packages to channel.
2018/01/06 02:35:29 -04:00 Repo http://mirror.rackspace.com/CentOS/7/os/x86_64/ has comps file comps.xml.
2018/01/06 02:35:29 -04:00 Repo http://mirror.rackspace.com/CentOS/7/os/x86_64/ has 0 errata.
2018/01/06 02:35:29 -04:00 Sync of channel completed in 2:07:28.

Once the package synchronization is complete, you can view packages by going to Channels >> Manage Software Channels >> Select your channel >> Packages >> List / Remove.

Managing Channels and Repositories in Spacewalk - List Packages in Channel
Managing Channels and Repositories in Spacewalk – List Packages in Channel

Create a Child Channel

Goto Channels >> Manage Software Channels >> Create New Channel. Enter the Child channel name, label, Parent channel, Architecture, and Channel description, etc.

Here you must select the Parent channel from the drop-down list. Finally, click Create Channel button.

Channel Details:

Channel Name: nginx_centos7

Channel Label: nginx_centos7

Parent Channel: itzgeek_centos7 (Because this is a child channel)

Architecture: x86_64

Channel Summary: Nginx CentOS 7 – Child Channel

Leave the remaining as it is.

Managing Channels and Repositories in Spacewalk - Creating Child Channel
Managing Channels and Repositories in Spacewalk – Creating Child Channel
Managing Channels and Repositories in Spacewalk - Creating Child Channel
Managing Channels and Repositories in Spacewalk – Creating Child Channel

Create a Repository for Child Channel

Goto Channels >> Manage Software Channels >> Manage Repositories >> Create repository. Let us create a Nginx repository, Enter the repository name and actual URL.

Repository Details:

Repository Name: Nginx CentOS 7

Repository URL: http://nginx.org/packages/centos/7/x86_64

Repository Type: yum

Managing Channels and Repositories in Spacewalk - Create Repository for Child Channel
Managing Channels and Repositories in Spacewalk – Create Repository for Child Channel

Likewise, you can create your own repository.

Assigning a repository to Child channel

Goto Channels >> Manage Software Channels >> Select the child channel.

Managing Channels and Repositories in Spacewalk - Channels List
Managing Channels and Repositories in Spacewalk – Channels List

Goto Repository (TAB) >> Select the created repository (Nginx) >> Update repository.

Managing Channels and Repositories in Spacewalk - Attach Repository to Child Channel
Managing Channels and Repositories in Spacewalk – Attach Repository to Child ChannelManaging Channels and Repositories in Spacewalk – Attach Repository to Child Channel

In the same page, goto Sync (TAB) >> Sync Now or Select a schedule.

Managing Channels and Repositories in Spacewalk - Synchronize Child Channel
Managing Channels and Repositories in Spacewalk – Synchronize Child Channel

OR

Run the below command.

/usr/bin/spacewalk-repo-sync --channel nginx_centos7 --type yum

You can go through sync logs to troubleshoot any issues arise during the synchronization.

# cat /var/log/rhn/reposync/<reponame>.log

Create an Activation Key

Here you can create activation keys for client subscription. In this page, you need to select the base channel ( itzgeek_centos7).

Whenever any client uses this key, the client machine will be automatically subscribed to the created channel. You can create multiple keys in case you would like to assign multiple channels to a client machine.

Goto Systems >> Activation Keys >> Create New Key.

Managing Channels and Repositories in Spacewalk - Create an Activation Key
Managing Channels and Repositories in Spacewalk – Create an Activation Key
Better to leave the key blank for automatic generation.
Managing Channels and Repositories in Spacewalk - Activation Key
Managing Channels and Repositories in Spacewalk – Activation Key

You can get a list of activation keys by going to Systems >> Activation Keys.

Managing Channels and Repositories in Spacewalk - All Activation Keys
Managing Channels and Repositories in Spacewalk – All Activation Keys

At this stage, your Spacewalk server is almost ready to serve packages to clients.

That’s all. In our next tutorial, we will configure a client to use Spacewalk server for getting packages and updates.

You might also like