Managing Channels and Repositories in Spacewalk – CentOS 7 / RHEL 7 & CentOS 6 / RHEL 6
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:
- Base channels
- 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.
Goto Channels >> Manage Software Channels >> Create 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.


Create a repository for Base Channel
Goto Channels >> Manage Software Channels >> Manage Repositories >> 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: https://mirror.rackspace.com/CentOS/7/os/x86_64/
Repository Type: yum
For a demo, I used https://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.

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.

Now its time to sync packages from the upstream server.
Go to Channels >> Manage Software Channels >> Select the created channel >> Repository >> Sync >> Sync Now.

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: https://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 https://mirror.rackspace.com/CentOS/7/os/x86_64/ has comps file comps.xml. 2018/01/06 02:35:29 -04:00 Repo https://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.

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.


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: https://nginx.org/packages/centos/7/x86_64
Repository Type: yum

Likewise, you can create your own repository.
Assigning a repository to Child channel
Goto Channels >> Manage Software Channels >> Select the child channel.

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

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

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.


You can get a list of activation keys by going to Systems >> 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.