Beside the {{aur|gitlab}} package from the [[AUR]] you have to install one of these database backends:

+

Simply install the {{aur|gitlab}} package from the [[AUR]].

−

* [[PostgreSQL]]

−

* [[MariaDB]]

{{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]], [https://wiki.archlinux.org/index.php/Category:Mail_Server etc].}}

{{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]], [https://wiki.archlinux.org/index.php/Category:Mail_Server etc].}}

{{Note|If you want to use rvm be sure to check out [[Gitlab#Running GitLab with rvm]] before starting with the installation}}

{{Note|If you want to use rvm be sure to check out [[Gitlab#Running GitLab with rvm]] before starting with the installation}}

Line 21:

Line 19:

Currently GitLab supports [[MySQL]] and [[PostgreSQL]]. [[MariaDB]] has not been officially tested but it works just fine.

Currently GitLab supports [[MySQL]] and [[PostgreSQL]]. [[MariaDB]] has not been officially tested but it works just fine.

−

=== MariaDB ===

+

==== MariaDB ====

[[pacman|Install]] {{Pkg|mariadb}} and {{Pkg|libmariadbclient}} from the [[official repositories]] and start the [[daemon]]. Create the database and do not forget to replace {{ic|your_password_here}} with a real one.

[[pacman|Install]] {{Pkg|mariadb}} and {{Pkg|libmariadbclient}} from the [[official repositories]] and start the [[daemon]]. Create the database and do not forget to replace {{ic|your_password_here}} with a real one.

−

# su - git

+

{{bc|mysql -u root -p}}

−

$ mysql -u root -p

mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production`;

mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production`;

Line 35:

Line 32:

Try connecting to the new database with the new user:

Try connecting to the new database with the new user:

−

$ mysql -u gitlab -p -D gitlabhq_production

+

{{bc|mysql -u gitlab -p -D gitlabhq_production}}

−

=== PostgreSQL ===

+

==== PostgreSQL ====

−

[[pacman|Install]] {{Pkg|postgresql}} and {{Pkg|libpqxx}} from the [[official repositories]]. Follow [[PostgreSQL#Installing_PostgreSQL]] to set it up and start the [[daemon]].

+

[[pacman|Install]] {{Pkg|postgresql}} and {{Pkg|libpqxx}} from the [[official repositories]]. Follow [[PostgreSQL#Installing_PostgreSQL]] to set it up and start the [[daemon]]. Login to PostgreSQL and remember to change {{ic|your_password_here}} to a real one:

−

Login to PostgreSQL and remember to change {{ic|your_password_here}} to a real one:

+

{{bc|psql -d template1}}

−

−

# sudo -u postgres psql -d template1

template1=# CREATE USER git WITH PASSWORD 'your_password_here';

template1=# CREATE USER git WITH PASSWORD 'your_password_here';

Line 51:

Line 46:

Try connecting to the new database with the new user:

Try connecting to the new database with the new user:

−

# sudo -u git -H psql -d gitlabhq_production

+

{{bc|psql -d gitlabhq_production}}

===Basic configuration===

===Basic configuration===

+

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

−

First we need to rename the example file.

+

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

Configure Git global settings for git user, useful when editing via web. Edit {{ic|user.email}} according to what is set in {{ic|gitlab.yml}}:

−

−

$ git config --global user.name "GitLab"

−

$ git config --global user.email "gitlab@localhost"

−

−

Configure GitLab database settings:

−

−

* MariaDB:

−

$ cp config/database.yml.mysql config/database.yml

−

−

* PostgreSQL:

−

$ cp config/database.yml.postgresql config/database.yml

−

−

Make sure to update {{ic|username}}/{{ic|password}} in {{ic|config/database.yml}}.

−

−

−

===Install gems===

−

−

{{Tip| If you do not want to download any gem documentation, add {{ic|gem: --no-rdoc --no-ri}} to {{ic|/home/git/.gemrc}}. Be sure to add it as the {{ic|git}} user in order to acquire the appropriate permissions.}}

−

{{Note|See bug #[https://bugs.archlinux.org/task/33327 33327] for about system-wide gems. As a temporary solution the following packages will be installed as {{ic|git}} user, make sure {{ic|/home/git/.gemrc}} contains {{ic|gem: ... --user-install}}. And then add the {{ic|bin}} path to the {{ic|PATH}} variable like so {{ic|1=export PATH="$PATH:~/.gem/ruby/2.0.0/bin"}}.}}

{{Note|When executing the below and you recieve `Could not verify the SSL certificate for https://rubygems.org/` see bug #[https://github.com/gitlabhq/gitlabhq/issues/4095 GitHub-4095] most likely because you're behind a proxy that tries to inject a local certificate for SSL domains in order to verify its content}}

−

−

If you used MariaDB:

−

−

$ bundle install --deployment --without development test postgres

−

−

If you used PostgreSQL:

−

−

$ bundle install --deployment --without development test mysql

−

−

{{Note|1= Using {{ic|--without group_name}} in bundle command line will ignore required packages for the mentioned groups.}}

===Initialize Database===

===Initialize Database===

Line 176:

Line 100:

{{Note| {{ic|gitlab:check}} will complain about missing initscripts. Don't worry, we will use ArchLinux' [[systemd]] to manage server start (which GitLab does not recognize).}}

{{Note| {{ic|gitlab:check}} will complain about missing initscripts. Don't worry, we will use ArchLinux' [[systemd]] to manage server start (which GitLab does not recognize).}}

+

+

== Start and test GitLab ==

+

After starting the database backend, simply run:

+

$ systemctl start redis

+

$ systemctl start gitlab

+

To automatically launch GitLab at startup, run:

+

$ systemctl enable redis

+

$ systemctl enable gitlab

==Web server configuration==

==Web server configuration==

−

−

−

===Unicorn only===

−

−

{{Note|As of GitLab 5.1 Unicorn is no longer the default server as it got replaced by Puma. You can therefore ignore this section.}}

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: