Now on Stretch + gitlab 8.13.x

Gitlab 8.13.11 was available in stretch, but it was not receiving any security updates and was removed in a point release. So it is recommended to update to newer versions from stretch-backports (see below: Step 1).

# apt install gitlab

It is recommended to upgrade to stretch-backports and then to buster to receive security updates.

Step 1: Moving to Stretch Backports + gitlab 11.5.x from Stretch

Gitlab 11.4.9 is available in stretch-backports (still affected by some security issues, many security releases behind).

Gitlab 11.5.10 is available for stretch-backports via personal repo of gitlab maintainer (many security releases behind) from https://people.debian.org/~praveen/gitlab

Add to /etc/apt/sources.list

deb https://people.debian.org/~praveen/gitlab stretch-backports contrib main
deb http://deb.debian.org/debian stretch-backports contrib main

Add repo signing key as trusted,

# wget https://people.debian.org/~praveen/gitlab/praveen.key.asc
# apt-key add praveen.key.asc

Now install gitlab,

# apt -t stretch-backports install gitlab

If you got an error like yarn did not find a cache folder during installation, run this command

sudo -u gitlab mkdir -p /var/lib/gitlab/.cache/yarn/v4/

It is recommended to upgrade to buster and gitlab 11.x to receive security updates (see below: Step 2).

Note: Remove unnecessary packages after upgrade (remove ruby-bootsnap if you see strange load errors).

# apt remove rails npm ruby-bootsnap

Step 2: Moving to Buster Backports + gitlab 11.x from Stretch Backports

You should first upgrade to 11.11.8 version before you can install newer versions.

Update /etc/apt/sources.list and change stretch to buster and add anew entry for buster-fasttrack and gitlab-snapshots (it is a repo created to provide exact versions required for updating from stretch to buster),

deb http://deb.debian.org/debian buster contrib main
deb http://security.debian.org/ buster/updates contrib main
deb https://people.debian.org/~praveen/gitlab buster-backports contrib main
deb https://people.debian.org/~praveen/gitlab-snapshots buster-backports contrib main
deb https://people.debian.org/~praveen/gitlab buster-fasttrack contrib main
deb http://deb.debian.org/debian buster-backports contrib main

If you get permission errors with /usr/share/gitlab/Gemfile.lock and /var/lib/gitlab/yarn-error.log, you can safely remove those two files.

If you get permission erros with /usr/share/gitlab/.bundle/config and /var/lib/gitlab/.ssh/authorized_keys change ownership of these files to gitlab user (if you chose a different user for gitlab, provide that name instead of gitlab)

# chown gitlab:gitlab /usr/share/gitlab/.bundle/config
# chown gitlab:gitlab /var/lib/gitlab/.ssh/authorized_keys

You may need to update postgresql-contrib package separately if you get errors related to postgresql service not running (make sure the new version is running on 5432 port). Use ss -aut command to list the running services.

Now update gitlab

# apt -t buster-backports install ruby-asciidoctor=1.5.8-1 asciidoctor=1.5.8-1
# apt -t buster-backports install gitlab gitaly=1.42.5+debian-1~bpo10+1 \
ruby-gitaly=1.37.0+dfsg-1~bpo10+1 ruby-default-value-for=3.1.1-3~bpo10+1 \
ruby-asciidoctor-plantuml=0.0.8-1 ruby-gitlab-sidekiq-fetcher=0.4.0-2~bpo10+1 \
ruby-asciidoctor=1.5.8-1 asciidoctor=1.5.8-1 ruby-prof=0.17.0+dfsg-3+b1 \
ruby-responders=2.4.0-3 ruby-task-list=2.2.0-1~bpo10+1 ruby-asana=0.8.1-2~bpo10+1 \
ruby-github-linguist=6.4.0-2 ruby-prometheus-client-mmap=0.9.4-1 \
ruby-grape=1.1.0-2 ruby-grape-path-helpers=1.1.0-1 node-css-loader=1.0.1-1 \
node-timeago.js=3.0.2+dfsg-3

ruby-grape package is missing some files so we need to install grape from rubygems.org But remember to remove this after ruby-grape is updated.

# gem install -v 1.1.0 grape

If you got some errors during "Running final rake tasks and tweaks..." step, you may have to remove some obsolete configuration files (especially if you installed gitlab from stretch for the first time),

rm /usr/share/gitlab/config/initializers/0_license.rb
rm /usr/share/gitlab/config/initializers/0_thread_cache.rb
rm /usr/share/gitlab/config/initializers/active_record_query_cache.rb
rm /usr/share/gitlab/config/initializers/elastic_client_setup.rb
rm /usr/share/gitlab/config/initializers/geo.rb
rm /usr/share/gitlab/config/initializers/load_balancing.rb
rm /usr/share/gitlab/config/initializers/transaction_metrics.rb

If gitlab installation failed at restarting services, you may need a restart.

If the installation failed at "Webpacking" stage, you can ignore the failure.

Now upgrade to gitlab 12.x following the instructions given below: Step 3.

Step 3: Moving to Buster + gitlab 12.x from Buster + gitlab 11.x

This step is required before you can upgrade to gitlab 13.x, as upstream supports only upgrading one major version at a time.

Note: Repository url and gpg signing key for personal repo of gitlab maintainer has changed.

Add transition repo which has gitlab 12.x,

deb https://people.debian.org/~praveen/gitlab-snapshots-12 buster-backports contrib main
deb https://people.debian.org/~praveen/gitlab-snapshots-12 buster-fasttrack contrib main

and setting up new signing key is explained in gitlab.

Now install gitlab 12.x,

# apt -t buster-backports install gitlab=12.10.7-1+fto10+2 \
gitaly/buster-backports gitlab-common/buster-backports \
ruby-gitlab-sidekiq-fetcher=0.5.2-1~bpo10+1 ruby-jira=1.7.1-1~bpo10+1 \
ruby-css-parser=1.6.0-1

If the installation failed at "Webpacking" stage, you can ignore the failure.

Now update to gitlab 13.x. See Step 4.

Step 4: Move to Buster + gitlab 13.x from Buster + gitlab 12.x

Upgrade postgres database to version 11

# apt install postgresql-contrib

and follow this guide https://blog.codetitans.pl/post/howto-migrate-postgresql-9-6-to-11-5/

Upgrade will fail if postgresql database is not upgraded.

At this point you should update gitlab to 13.x version available, following steps given at gitlab for buster-fasttrack (manually update ruby-bundler, ruby-molinillo and ruby-font-awesome-rails) and run apt dist-upgrade after gitlab is updated.

New repo is,

deb https://people.debian.org/~praveen/gitaly buster-backports contrib main
deb https://people.debian.org/~praveen/gitaly buster-fasttrack contrib main

Now follow updates to gitlab.

If you got an error like NameError: uninitialized constant Gitlab::ThreadMemoryCache

# rm /usr/share/gitlab/config/initializers/0_thread_cache.rb