Linux package repository mirroring
GitLab and GitLab Runner Linux packages are available at https://packages.gitlab.com. This document explains how to maintain a local mirror of these repositories.
Mirroring APT repositories
A local mirror of an apt repository can be created using the apt-mirror tool.
Install
apt-mirrorsudo apt install apt-mirrorCreate a directory for the mirror
sudo mkdir /srv/gitlab-repo-mirrorAdd the following lines to the
apt-mirrorconfiguration file present at/etc/apt/mirror.listset base_path /srv/gitlab-repo-mirrorThe mirrored content is written under
/srv/gitlab-repo-mirror/mirror/packages.gitlab.com.Check the upstream example config file for other available settings.
At the end of the configuration file, specify the repositories to mirror in the
aptsources file URL format.The repository structure differs between GitLab and GitLab Runner.
GitLab
GitLab uses the same version strings for packages across OS distributions (with different content). That means these packages are considered Duplicate Packages as per Debian Repository Format.
To work around this, each OS distribution (like Debian Trixie or Ubuntu Focal) gets a dedicated repository that hosts only that distribution. This results in URLs having an extra distribution component.
GitLab Runner
GitLab Runner is a statically linked Go binary and uses the same package for different OS distributions. It uses a single apt repository per OS and hosts all distributions of that OS within that repository.
deb https://packages.gitlab.com/gitlab/gitlab-ee/debian/trixie trixie main deb-src https://packages.gitlab.com/gitlab/gitlab-ee/debian/trixie trixie maindeb https://packages.gitlab.com/runner/gitlab-runner/debian trixie main deb-src https://packages.gitlab.com/runner/gitlab-runner/debian trixie mainStart the mirror process
sudo apt-mirror
Mirroring RPM repositories
A local mirror of an rpm repository can be created using reposync (to
download packages) and createrepo (to generate metadata).
reposync expects the repository you want to mirror to be installed on the
system. Follow the installation docs
for the repository you want to mirror.
To find the repository ID, list available repositories with:
yum repolistInstall
createrepoandreposyncsudo yum install createrepo yum-utilsCreate a directory for the mirror
sudo mkdir /srv/gitlab-repo-mirrorRun
reposync. Pass the repository ID and output directory as arguments.reposync --repoid=gitlab_gitlab-ee --download-path=/srv/gitlab-repo-mirrorGenerate metadata for the repository using
createrepocreaterepo -o /srv/gitlab-repo-mirror /srv/gitlab-repo-mirror