Managing Spacewalk Channels and Repositories
In this article we are going to cover -
- Create a spacewalk channel.
- Create a repository.
- Download the package on Spacewalk server.
- Generate the activation key.
Spacewalk Installation and Configuration
Please check my previous article for Spacewalk installation and configuration using the below link.
Brief Overview of Spacewalk Channel
A channel is a logical collection of packages (RPM). A channel may contain packages from a specific distribution, also a channel may contain packages for a specific application or group of applications. Any client can subscribe to a particular channel to download, update and install packages. A channel can be linked to multiple repositories, can be cloned, sync or customized. The channels are linked to a normal YUM repository. Only subscribed system can only install or update packages available through its Satellite channels.
There are two types of channels:
- Base channels - It contains the packages based on a specific architecture and a specific distribution.
- Child channels - It is a channel associated with a base channel that contains extra packages.
A base channel can have any number of child channels. The Spacewalk client should subscribe to only one Base channel, and can subscribe to any number of Child channels of its base channel. Every base channel has a registration key. So that the clients can use this key to register themselves with the corresponding base channel automatically.
Create a Base channel
Open up web browser and navigate to https://spacewalk-server-ip/. Log in to the Spacewalk server’s web console by entering username and password which we defined in the previous article during Spacewalk installation.
Now, let us create the Base channel using the flow:
Go to Channels (Main menu) --> Manage Software Channels (Left menu) --> Create Channel.
Now fill all the mandatory details to create the Base channel like in below snapshot.
Our Base channel linuxtechiebulb_centos7 is created successfully.
Create a repository for Base Channel
Go to Channels --> Manage Software Channels --> Manage Repositories --> Create Repository
Enter the repository name and repository URL, then click on Create Repository. Here we are using the http://mirror.centos.org/centos/7/os/x86_64/ as Repository URL. This repository URL is one of the CentOS mirrors. We can find more mirrors here.
Attaching a repository to Base channel
Go to Channels --> Manage Software Channels --> Select the created channel (linuxtechiebulb_centos7) --> Repository --> Select the created repository (CentOS 7 x86_64) --> Update Repositories.
Now we can sync the packages from the upstream server.
Go to Channels --> Manage Software Channels --> Select the created channel --> Repository --> Sync --> Sync Now.
We can also sync the Repository using the below command with the upstream server.
# /usr/bin/spacewalk-repo-sync --channel itzgeek_centos7 --type yum
21:48:31 | Channel: linuxtechiebulb_centos7
21:48:31 Sync of channel started.
21:48:31 Repo URL: http://mirror.centos.org/centos/7/os/x86_64/
21:50:16 Packages in repo: 9591
21:50:30 Packages already synced: 0
21:50:30 Packages to sync: 9591
21:50:30 New packages to download: 9591
21:50:31 1/9591 : 389-ds-base-188.8.131.52-16.el7.x86_64.rpm
21:50:31 2/9591 : ElectricFence-2.2.2-39.el7.x86_64.rpm
21:50:31 3/9591 : ElectricFence-2.2.2-39.el7.i686.rpm
22:59:53 9587/9591 : zziplib-devel-0.13.62-5.el7.x86_64.rpm
22:59:53 9588/9591 : zziplib-utils-0.13.62-5.el7.x86_64.rpm
23:00:02 9589/9591 : zsh-5.0.2-28.el7.x86_64.rpm
23:00:17 9590/9591 : xulrunner-31.6.0-2.el7.centos.x86_64.rpm
23:00:27 9591/9591 : xulrunner-31.6.0-2.el7.centos.i686.rpm
Importing packages: |##################################################| 100.0%
23:30:16 Linking packages to channel.
23:30:28 Repo http://mirror.centos.org/centos/7/os/x86_64/ has comps file comps.xml.
23:30:28 Repo http://mirror.centos.org/centos/7/os/x86_64/ has 0 errata.
23:30:28 Sync of channel completed in 1:41:57.
23:30:28 Total time: 1:41:57
Note: The packages will be downloaded from the upstream server will be kept in /var/satellite/ folder of your Spacewalk server. Make sure we have enough space in /var/satellite/ folder.
For any issues during the synchronization we can go through sync logs using below.
# cat /var/log/rhn/reposync/linuxtechiebulb_centos7.log
2018/03/12 20:01:47 +05:30 Command: ['/usr/bin/spacewalk-repo-sync', '--channel', 'linuxtechiebulb_centos7', '--type', 'yum']
2018/03/12 20:01:47 +05:30 Sync of channel started.
2018/03/12 20:01:47 +05:30 Repo URL: http://mirror.centos.org/centos/7/os/x86_64/
2018/03/12 20:01:53 +05:30 Packages in repo: 9591
2018/03/12 20:02:08 +05:30 Packages already synced: 0
2018/03/12 20:02:08 +05:30 Packages to sync: 9591
2018/03/12 20:02:09 +05:30 New packages to download: 9591
2018/03/12 20:02:20 +05:30 1/9591 : 389-ds-base-184.108.40.206-16.el7.x86_64.rpm
2018/03/12 20:02:20 +05:30 2/9591 : ElectricFence-2.2.2-39.el7.x86_64.rpm
2018/03/12 20:02:20 +05:30 3/9591 : ElectricFence-2.2.2-39.el7.i686.rpm
2018/03/12 20:02:21 +05:30 4/9591 : 389-ds-base-devel-220.127.116.11-16.el7.x86_64.rpm
2018/03/12 22:59:53 +05:30 9588/9591 : zziplib-utils-0.13.62-5.el7.x86_64.rpm
2018/03/12 23:00:02 +05:30 9589/9591 : zsh-5.0.2-28.el7.x86_64.rpm
2018/03/12 23:00:17 +05:30 9590/9591 : xulrunner-31.6.0-2.el7.centos.x86_64.rpm
2018/03/12 23:00:27 +05:30 9591/9591 : xulrunner-31.6.0-2.el7.centos.i686.rpm
2018/03/12 23:00:27 +05:30 Importing packages started.
2018/03/12 23:30:15 +05:30 Importing packages finished.
2018/03/12 23:30:15 +05:30 Linking packages to channel.
2018/03/12 23:30:28 +05:30 Repo http://mirror.centos.org/centos/7/os/x86_64/ has comps file comps.xml.
2018/03/12 23:30:28 +05:30 Repo http://mirror.centos.org/centos/7/os/x86_64/ has 0 errata.
2018/03/12 23:30:28 +05:30 Sync of channel completed in 1:41:57.
Once the package synchronization is complete, we can see the packages by going to Channels --> Manage Software Channels --> Select your channel --> Packages --> List / Remove.
Now we can see 9591 packages are synced. The no of packages is very high in centos repositories so, it takes hour time to sync.
Create a Child Channel
Go to Channels --> Manage Software Channels --> Create New Channel.
The Child channel creation is same as creating the Base channel but the only difference is we must select the Parent channel from the drop-down list.
Create a Repository for Child Channel
Go to Channels --> Manage Software Channels --> Manage Repositories --> Create repository. Let us create a MariaDB repository by entering the repository name and actual URL.
Assigning a repository to Child channel
Go to Channels --> Manage Software Channels --> Select the child channel.
Go to Repository --> Select the created repository (Mariadb CentOS7) --> Update repositories.
In the same page, click on Sync --> Sync Now.
Now we can see, 15 packages are synced.
Create an Activation Key
Activation keys are very important part of spacewalk. We have created the base channel name linuxtechiebulb_centos7. We need to create the activation keys for client subscription. Once the key got activated then we can use the same key into the client machine so that client machine will be automatically subscribed to the created channel. We can create multiple keys in case we would like to assign multiple channels to a client machine.
Go to Systems --> Activation Keys --> Create New Key.
Now our activation key is ready. We can get a list of activation keys by Systems --> Activation Keys.
Now our Spacewalk server is ready to serve packages to the clients.
That’s all for now. In my upcoming article, we’ll cover:
- How to install Spacewalk clients?
- How to subscribe channels for the clients?
- How to install packages from the Spacewalk server’s Channel?
Next Article: Register clients with SpaceWalk Server