User Tools

Site Tools


  • gitlab-ce
  • Jonathan Haack
  • Haack's Networking

Installing gitlab-ce on a Debian system.

The pre-requisites:

  • Using Debian or similar
  • Self Hosted Web Server using Apache 2.4
  • Available Domain with DNS set up
  • Self-Signed Certificate is established as backup
  • Letsencrypt, using certbot, is established and working

If you are missing some of these pre-requisites, please visit the Apache Survival tutorial I created which covers these topics.

The first thing you need to do is download and run the script that gitlab provides. This script will allow you to access the repositories and download gitlab-ce.

cd /tmp
curl -LO
sudo bash /tmp/

Now that that is done, let's begin by installing Gitlab Community Edition and editing the Ruby configuration file to work with the LAMP stack:

sudo apt install gitlab-ce
sudo nano /etc/gitlab/gitlab.rb

In this file, you need to edit 6 lines. The Gitlab Tutorial requests an additional line - which I included but commented out - be adjusted and also forgets to specify that gitlab_workhorse should be enabled. These are the options I used with my LAMP stack to get it up and running:

external_url ' 
gitlab_workhorse['enable'] = true
gitlab_workhorse['listen_network'] = "tcp"
gitlab_workhorse['listen_addr'] = ""
web_server['external_users'] = ['www-data']
nginx['enable'] = false
#gitlab_rails['trusted_proxies'] = [ '', '', '2001:0db8::/32' ]

Optionally, if you want your ssh on an alternate port, then configure one more option in the gitlab.rb file. Of course, you will also need to adjust your sshd_config and you firewall (if applicable) to permit traffic on this port.

gitlab_rails['gitlab_shell_ssh_port'] = 222

Ok, now that the configuration file is set up, let's make sure that your Apache Web Server has appropriate configuration files. There is a Gitlab Recipes repository dedicated to getting Gitlab-CE up on non-nginx web servers. Always check the git repo above for the latest recipes, the ones I am using are currently here (2020):

https.conf http.conf

These both work in production, so feel free to use and share. Make sure you have appropriate apache mods enabled:

sudo a2enmod proxy_http
sudo a2enmod proxy
sudo a2enmod rewrite

You should now be able to cofnigure gitlab-ce with its built in configuration tool::

sudo gitlab-ctl reconfigure  

After you complete these steps, restart both the Apache Web Server and the Gitlab services as follows:

sudo systemctl restart apache2.service
sudo systemctl restart gitlab-runsvdir.service

I do not use the default Let's Encrypt tool in gitlab.rb because it fails. I work around this issue by building a basic .html website first, encrypting that, and then changing the configs to reverse proxies specified above. See the Apache Survival link above for more information.

oemb1905 2020/01/01 23:54

computing/gitlab-ce.txt · Last modified: 2020/01/02 00:14 by oemb1905