Note: Throughout the article, sudo is heavily used, assuming that the user that is running the commands is root or someone with equal privileges. There is no need to edit the sudoers file whatsoever. It is only used to change to the appropriate user. For more info read man sudo.

Installation

Note: In order to receive mail notifications, make sure to install a mail server. By default, Archlinux does not ship with one. The recommended mail server is postfix, but you can use others such as SSMTP, msmtp, sendmail, etc.

Basic configuration

Open /etc/gitlab/gitlab.yml with your favorite editor and edit where needed. The options are pretty straightforward. Make sure to change localhost to the fully-qualified domain name of your host serving GitLab where necessary.

To configure GitLab database settings, make sure to update username/password in /etc/gitlab/database.yml. If you planning to use PostgreSQL backend, you should it's template file before configuring it:

Initialize Database

Note: Make sure the redis daemon is enabled and started, otherwise the following command will fail. To check the status and see if it's running execute systemctl status redis, if it's dead start it as per usual via systemctl start redis

Initialize database and activate advanced features:

$ bundle exec rake gitlab:setup RAILS_ENV=production

Note: If you recieve a error No such file or directory - /home/git/repositories/root then most likely you've changed the default configuration for GitLab and you'll need to modify all static paths in config/gitlab.yml and run the above command again to initialize the database!

Check status

With the following commands we check if the steps we followed so far are configured properly.

Edit /etc/nginx/sites-enabled/gitlab and change YOUR_SERVER_IP and YOUR_SERVER_FQDN to the IP address and fully-qualified domain name of the host serving Gitlab. As you can see nginx needs to access /home/gitlab/gitlab/tmp/sockets/gitlab.socket socket file. You have to be able to run sudo -u http ls /home/gitlab/gitlab/tmp/sockets/gitlab.socket successfully. Otherwise setup access to the directory:

# chgrp http /home/gitlab
# chmod u=rwx,g=rx,o= /home/gitlab

Restart gitlab.service, resque.service and nginx.

Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. First we rename the example file and then we start unicorn:

Now edit config/unicorn.rb and add a listening port by uncommenting the following line:

listen "127.0.0.1:8080"

Tip: You can set a custom port if you want. Just remember to also include it in Apache's virtual host. See below.

Create a virtual host for Gitlab

Create a configuration file for Gitlab’s virtual host and insert the lines below adjusted accordingly. For the ssl section see LAMP#SSL. If you do not need it, remove it. Notice that the SSL virtual host needs a specific IP instead of generic. Also if you set a custom port for Unicorn, do not forget to set it at the BalanceMember line.

Running GitLab with rvm

Note: Version 1.9.3 is currently recommended to avoid some compatibility issues.

For the complete installation you will want to be the final user (e.g. git) so make sure to switch to this user and activate your rvm:

su - git
source "$HOME/.rvm/scripts/rvm"

Then continue with the installation instructions from above. However, the systemd scripts will not work this way, because the environment for the rvm is not activated. The recommendation here is to create to separate shell scripts for puma and sidekiq to activate the environment and then start the service: