Install GitLab

You need a server with a minimum of 2 core CPU, 4 GB RAM, minimum 10 GB DISK & Ubuntu OS (16.04/18.04/20.04)

Install and configure the necessary dependencies

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl

Install mail server postfix to send notification emails. You can skip this step if you already have the SMTP server

sudo apt-get install -y postfix

Add the GitLab package

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

Install GitLab using the below command, Change your-domain.com with your actual domain name

sudo EXTERNAL_URL="https://your-domain.com" apt-get install gitlab-ee

Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in /etc/gitlab/initial_root_password. Use this password with a username root to log in.

cat /etc/gitlab/initial_root_password

Change SMTP configuration using the below command

nano /etc/gitlab/gitlab.rb

Change the SMTP option in the file seen like the below

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.server"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "smtp user"
gitlab_rails['smtp_password'] = "smtp password"
gitlab_rails['smtp_domain'] = "example.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'

# If your SMTP server does not like the default 'From: gitlab@localhost' you
# can change the 'From' with this setting.
gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'

# If your SMTP server is using a self signed certificate or a certificate which 
# is signed by a CA which is not trusted by default, you can specify a custom ca file.
# Please note that the certificates from /etc/gitlab/trusted-certs/ are
# not used for the verification of the SMTP server certificate.
gitlab_rails['smtp_ca_file'] = '/path/to/your/cacert.pem'

Save the file by pressing Ctrl + o then press Enter key then press Ctrl + x

Reconfigure and restart GitLab using the below command

gitlab-ctl reconfigure
gitlab-ctl restart

Leave a Reply