GitLab Server Installation

[This is part 1/8 on GitLab Continuous Integration series]

I will try to summarize the steps taken to get my GitLab CE running in a Linux Raspbian system using an insecure (HTTP) set up. Although I feel that that my post is too late to join the party of CI/CD as most of the articles are dated a few years back. I hope that it presents the information extracted from reading the documentation and solutions provided in the forums and save peoples time as there are so many installation environments and lots of changes of GitLab through it’s 13 versions. What makes this notes different is that it make no use of SSL or TLS secure methods that are well documented on the GitLab site.


GitLab Community Edition (CE) is an Open Source Web system for Source Control and Continuous Integration. It offers, source code (version) control management, multiple approvals in code review, multi-project pipeline graphs, timed and manual incremental roll out deployments (CI/CD), application performance monitoring and alerts, dynamic application security testing and also a Docker registry.

Version 13.7 of GitLab is used in this posts made during February 2021. The chosen setup is I stated is an ‘insecure’ one as it uses only HTTP, with just a username & password to authenticate into the server, no need to configure the SSL keys that are overkill as I am on a home network and closed environment running in a Raspberry Pi 4 with 4GB and an SSD with Raspbian OS 20 but it also was tested on an Ubuntu 20.10.

A post for a secure setup that uses HTTPS and certificates/secrets is planned.


I. Installation

Assign a Server Name
The default hostname in the provided configuration file is gitlab.example.com.
As using a hard-coded IP is not recommended we will edit each computer’s ‘/etc/hosts’ file to add your Server IP and fully qualified domain name (FQDN) like this:

$ sudo vi /etc/hosts

# Add a line like this using your server IP
192.168.1.221   gitlab.example.com

Set Up
To install the default ‘Omnibus stack’ we first add a GPG key and run a setup script:

$ cd Downloads
$ sudo apt update

$ curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Note:For a Raspberry Pi 4 use this commands that use a repository for arm64:
$ curl https://packages.gitlab.com/gpg.key | sudo apt-key add -
$ sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/script.deb.sh | sudo bash

Install the software
Install the software using:

$ sudo apt install gitlab-ce
Note:You can change the defaults.
If port 80 is already in use you can set an alternate port, change the name of your server, or the protocol, just use an environment variable like this:
$ sudo EXTERNAL_URL="http://mygitlab.com:8080" apt install gitlab-ce

Run the configuration Program
The next step is going to take a while. Be patience:

   $ sudo gitlab-ctl reconfigure

II. Verify the Server is running

List the process and status of the web server, database, monitoring services etc.

$ sudo gitlab-ctl status

Or get the HTTP answer:

$ curl http://gitlab.example.com
<html><body>You are being <a href="http://gitlab.example.com/users/sign_in">redirected</a>.</body></html>

III. Log In

Using a browser get to:

http://gitlab.example.com

On your first visit, you’ll be redirected to a password reset screen to provide the password for the administrator account, in this examples we will use: root / password

Later after you assign administrator privileges to other accounts you can safely get rid of the root user.


IV. Suspend & Restart Services

In case that the ‘blundle’ processes (web and sidekick notification services) consume too much of your machine CPU and do not need to provide them every second I suggest you turn them off (stop/start) or even disable them on start up. These are the command you will need.

Note: These are no too demanding at home, the Raspberry Pi usually needs 10% or 12%, but sometimes -at start up- it does house hold tasks and demands 90%,and that is bothersome when you need other apps.

# Stop all GitLab components
$ sudo gitlab-ctl stop

# Start all GitLab components
$ sudo gitlab-ctl start

# To avoid start up on boot
sudo systemctl disable gitlab-runsvdir.service

# To re-enable start up on boot
sudo systemctl enable gitlab-runsvdir.service

Reference