You must have Javascript enabled to experience this site.

Install GitLab on Ubuntu 14.04 using Apache2

Posted & filed under Coding Tips.

This should have been a lot easier than it was, so this is what worked for me.

I have been running Subversion forever (well, a long time anyway) and never really had the incentive to change, but the guys at work are always telling me how wonderful Git is and I keep having to get things from GitHub anyway, so it is a about time I got serious about converting. The instructions at GitLab seemed easy enough (too simple really – that should have been a warning).


sudo apt-get install openssh-server
sudo apt-get install postfix
# Select 'Internet Site', using sendmail instead also works, exim has problems
sudo dpkg -i


I had trouble with wget and ended up downloading the package with a download manager (but this was probably due to my crappy Australian internet connection).

The next step involved several iterations and much problem solving, so I will ‘cut to the chase’. I was already using Apache2 (on port 80) and Tomcat (on port 8080) for several projects on this machine, which I did not want to change. But GitLab is pre-configured to use Nginx (on port 80) and Unicorn (on port 8080), so these settings had to be changed.

There is also an issue with GitLab 7 where the first execution can take a long time for Ruby to process and if the timeout value is too low, this will fail, only to repeat this process on the next execution. The result is that the Ruby process uses 100% CPU while every page load takes 30 seconds, which is way beyond unusable. Increasing the timeout value will result in the first execution taking a very long time to complete, but performance will be normal after that.

To make matters even more confusing I found lots of web pages suggesting changes to various configuration files, but when I found these there was usually a header to say do not change this file as it will be over written. All of the configuration settings are in /etc/gitlab/gitlab.rb which will be applied by the reconfigure process. Edit this file and find the following lines, uncomment them (or add them if not present), save the changes, then reconfigure GitLab.

sudo gedit /etc/gitlab/gitlab.rb

external_url 'http://gitlab.local:8888'
unicorn['worker_timeout'] = 600
unicorn['port'] = 8888
web_server['external_users'] = ['www-data']
nginx['enable'] = false
ci_nginx['enable'] = false

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart


Test that http://localhost:8888 works

Now configure Apache2 to forward the requests. I found a lot of incorrect vhost configurations (including an ‘official’ one). Most were simply out of date, some were just guessing. This worked.

sudo a2enmod proxy_http

sudo gedit /etc/apache2/sites-available/gitlab.conf

# gitlab
<VirtualHost *:80>
ServerName gitlab.local
DocumentRoot /var/opt/gitlab

ProxyPass /
ProxyPassReverse /

# Custom log file locations
ErrorLog /var/log/apache2/gitlab_error.log
CustomLog /var/log/apache2/gitlab_access.log combined

sudo a2ensite gitlab.conf

sudo service apache2 restart


Add gitlab.local to your DNS or hostfile, then browse to http://gitlab.local and login.

Username: root
Password: 5iveL!fe