Distribute GitLab Community Edition with Spacewalk

GitLab packages in Spacewalk

GitLab is a very popular alternative to GitHub that is available as free Community Edition for interested hobbyists and smaller companies. For installing the software, there is a script for downloading and installing the particular software packages. If you have a look at the source code of this script, you will see that this script uses conventional YUM repositories. So basically, GitLab can also be distributed comfortably using a pre-existing  Spacewalk, Red Hat Satellite or SUSE Manager system verteilen.

GitLab offered appropriate YUM repositories (binary and source code packages) for various RPM-based Linux distros. The following table lists URLs for some popular Linux distros:

Fedora 21, i386https://packages.gitlab.com/gitlab/gitlab-ce/fedora/21/i386
Fedora 21, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/fedora/21/x86_64
Fedora 22, i386https://packages.gitlab.com/gitlab/gitlab-ce/fedora/22/i386
Fedora 22, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/fedora/22/x86_64
RHEL/CentOS 6, i386https://packages.gitlab.com/gitlab/gitlab-ce/el/6/i386
RHEL/CentOS 6, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/el/6/x86_64
RHEL/CentOS 7, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/el/7/x86_64
Scientific Linux 6, i386https://packages.gitlab.com/gitlab/gitlab-ce/el/6/i386
Scientific Linux 6, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/el/6/x86_64
Scientific Linux 7, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/el/7/x86_64
Oracle Linux 6, i386https://packages.gitlab.com/gitlab/gitlab-ce/ol/6/i386
Oracle Linux 6, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/ol/6/x86_64
Oracle Linux 7, x86_64https://packages.gitlab.com/gitlab/gitlab-ce/ol/7/x86_64
DistributionURL

First of all, the YUM repository's GPG key needs to be stored on the Spacewalk system under /var/www/html/pub to enable previously registered systems without internet connection to import the key. If this is missed, registered systems will refuse to install the packages because of the missing key:

1spacewalk# curl https://packages.gitlab.com/gpg.key -o /var/www/html/pub/RPM-GPG-KEY-gitlab
2client# rpm --import http://spacewalk/pub/RPM-GPG-KEY-gitlab

If kickstart or activation keys are used, it is highly recommended to add this key also in the Spacewalk backend (below Systems, Kickstart, GPG and SSL Keys). On the Spacewalk system a new repository and software channel needs to be created. To do this, click the menu elements Channels, Manage Software Channels, Manage Repositories and Create Repository. In the following dialog, enter the following information:

Repository Labelz. B. gitlab-ce-centos7-x86_64
Repository URLPassende URL aus oberer Tabelle, z. B. https://packages.gitlab.com/gitlab/gitlab-ce/el/7/x86_64
Filters(none)

Afterwards, the appropriate software channel can be created. Inside the Spacewalk interface, select Manage Software Channels and Create Channel. Fill the dialog like this:

Channel NameReadable name, e.g. GitLab CE EL7 x86_64
Channel LabelInternal descriptor, e.g. gitlab-ce-centos7-x86_64
Parent ChannelGeneric software channel, e.g. CentOS 7
Channel SummaryGitLab Community Edition for Enterprise Linux 7 x86_64
GPG key URLhttps://packages.gitlab.com/gpg.key
GPG key ID
E15E78F4
GPG key Fingerprint
1A4C 919D B987 D435 9396  38B9 1421 9A96 E15E 78F4

Below the tab Repositories the previously created repository needs to be selected. It is recommended to verify the GPG key ID and fingerprint once again as the key might have changed since the creation of this article:

1$ gpg --with-fingerprint /var/www/html/pub/RPM-GPG-KEY-gitlab
2pub 4096R/E15E78F4 2015-04-17 GitLab B.V. (package repository signing key)
3 Key fingerprint = 1A4C 919D B987 D435 9396 38B9 1421 9A96 E15E 78F4

The first bold information represents the GPG key ID, the second information displays the appropriate fingerprint.

Afterwards the software channel can be mirrored, for example using spacewalk-repo-sync:

 1# spacewalk-repo-sync --channel gitlab-ce-centos7-x86_64
 2======================================
 3| Channel: gitlab-ce-centos7-x86_64
 4======================================
 5
 6Repo URL: https://packages.gitlab.com/gitlab/gitlab-ce/el/7/x86_64
 7Packages in repo: 18
 8Packages already synced: 0
 9Packages to sync: 18
10...

Alternatively you can also start the synchronization using the web interface. For this, the tabs Repositories and Sync are selected; afterwards, click the button Sync Now. This is also a great time for configuring the automatic synchronization. If YUM repositories are synchronized using a cronjob, this job needs to be altered. For example:

1# vi /etc/cron.daily/spacewalk_sync.cron
2...
3/usr/bin/spacewalk-repo-sync --channel gitlab-ce-centos7-x86_64 >/dev/null
4
5ESC ZZ

On the registered client systems, GitLab can be installed like this:

1# yum install -y postfix openssh-server yum-utils pygpgme curl
2# yum -q makecache -y --disablerepo='*' --enablerepo='gitlab-ce-centos7-x86_64'
3# yum install gitlab-ce
4# gitlab-ctl reconfigure

If the firewall was configured properly, GitLab can be accessed using the web browser. 🙂

Translations: