How to install and configure GitLab CE on Ubuntu 18.04 LTS

GitLab is web-based and open-source Git-repository manager. It comes in FOSS edition as well as Enterprise edition.

-Advertisement-

GitLab is web-based and open-source Git-repository manager. It is written in Ruby and comes with plenty of features including code review, monitoring, CI/CD (continuous integration and deployment), wiki, issue tracking, and many others.

Until the year 2012, GitLab and was fully free and open-source software distributed under the MIT License. In July 2013, the program was split into two versions: GitLab Community Edition (CE) and GitLab Enterprise Edition (EE).

In February 2014, GitLab took an open-core business model. As expected, GitLab EE has some advanced features not present in the CE version. However, the GE version is still actively developed and supported by the company.

Install GitLab CE on Ubuntu 18.04 LTS

At FOSS Linux, we love Open Source software, therefore, this article will describe only the installation of the GitLab Community Edition (CE) on Ubuntu.

System Requirements

-Advertisement-

To begin with, update system repositories before starting the GitLab installation.

sudo apt-get update

Install and configure the needed dependencies:

sudo apt-get install  curl openssh-server ca-certificates
-Advertisement-

Gitlab will need to be able to send emails to users. Hence, you should install and configure email service such as postfix or you can use external email services like AWS SES, MailChimp etc. In this example, we will use postfx.
Install postfix.

sudo apt-get install postfix

During postfix installation, it will ask mail server configuration type. Select ‘Internet Site’ and click “OK”.

Internet Site
Internet Site

-Advertisement-

Then it will prompt to enter ‘System mail name’. This should be your server hostname or DNS name of your server. Here we use “gitlab.fosslinux.com”.
Enter the appropriate name for your server configuration and press Ok.

Mail Name
Mail Name

After the postfix installation starts service:

sudo systemctl start postfix

Enable service on system boot:

sudo systemctl enable postfix

Installing GitLab

Add the GitLab package repository:

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

Then install GitLab Community Edition:

sudo apt-get install gitlab-ce

It may take some time for the installation to complete. Then you will get the following output.

GitLab Installation Complete
GitLab Installation Complete

Modify Firewall Rules

Allow HTTP and HTTPS:

sudo ufw allow http
sudo ufw allow https

Check firewall status and it will show open ports:

sudo ufw status

Configure GitLab URL with SSL

Before we access GitLab, we need to configure it with Domain name.
But before adding this domain name you need to configure your DNS servers with needed configurations (a record with server Public IP).
So go ahead and modify the GitLab configuration file

sudo /etc/gitlab/gitlab.rb

Find “external_url” field and add your domain name

URL
URL

Then look for “letsencrypt” and uncomment the line. Set it to “true”.
If you need, you can enable “letsencrypt[‘contact_emails’]” section too. Uncomment line and add your email address.

Letsencrypt
Letsencrypt

Save and close the file. After this kind of modification, you need to reconfigure GitLab. So run below command to do that.

sudo gitlab-ctl reconfigure

It will reconfigure GitLab and configure free SSL certificate.

Reconfigured
Reconfigured

GitLab web interface

Use your web browser and type your GitLab Url and hit enter.

https://gitlab.fosslinux.com

Replace “gitlab.fosslinux.com” with your domain name:
When you browse GitLab web interface first time, it will ask new password for the administrative account. Enter the new password and click “change your password”.

Admin Password
Admin Password

After that, it will redirect to login page. The user name will be “root” and password will be the one you have already set.

Login Page
Login Page

After you log into the account, you will see the welcome page.

GitLab Welcome Page
GitLab Welcome Page

SMTP settings

If you need to modify SMTP settings, modify “gitlab.rb” file.

sudo vim /etc/gitlab/gitlab.rb

For SMTP on localhost, you need to modify the following configurations:

gitlab_rails['smtp_enable'] = true;
gitlab_rails['smtp_address'] = 'localhost';
gitlab_rails['smtp_port'] = 25;
gitlab_rails['smtp_domain'] = 'localhost';
gitlab_rails['smtp_tls'] = false;
gitlab_rails['smtp_openssl_verify_mode'] = 'none'
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_ssl'] = false
gitlab_rails['smtp_force_ssl'] = false

There you go! You installed and configured GitLab successfully.

-Advertisement-
Darshana
Hey! I'm Darshana, a Linux / DevOps Engineer and also a contributor to FOSS Linux. I enjoy working on various kind of Linux distributions and cloud technologies. During my free time, I love to swim and hike across nature trails. Linux is my love and I'm here to share all my learnings with all of you! Hope you enjoyed reading my article.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,639FansLike
361FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

Top 20 Git Commands with Practical Examples

If you are here reading this post, there is a high probability that you have heard or interacted with Github, and you now want to learn Git. Before we continue with showing you some of the cool Git commands, let's understand the difference between Git and GitHub.

Top 10 New Features in Linux Kernel 5.7

Linus Torvalds has announced the release of Linux Kernel 5.7 after seven weeks of development. The release announcement comes as a piece of exciting news as it brings a host of new features for the hardware manufacturers as well as the developers.

How to install CMake on Ubuntu

CMake is a cross-platform free and open-source software tool designed to build, test, and package the software. CMake uses a simple platform and compiler-independent configuration files to control the software compilation process.

How to install Lightworks on Ubuntu

Even though Linux may not get a native installer of video editing software like Adobe Premiere or Final Cut Pro, that doesn't mean there are no industry standards tools available. Lightworks is non-linear editing (NLE) video mastering app for Windows, Linux, and macOS. Installing it on Ubuntu is simple due to deb package availability.

How to install DaVinci Resolve on Fedora

Davinci Resolve is a professional application used for color correction, video editing, visual effects, and motion graphics. It is one of the extensively used software by movie industries located in Hollywood.

The 10 Best Programming Languages for Hacking

One of the significant entities we have in Cyber Security is Ethical Hacking (ETH). It is the process of detecting and finding flaws or vulnerabilities in a system that a hacker would exploit.

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

10 top reasons to switch to Manjaro Linux

Manjaro is Linux distro based on Arch-Linux which follows a rolling release model. Is this distro good for you? Let's find out the main reasons for using Manjaro.

6 ways to find out your Linux file system type

Any Operating system in the market whether its Windows, Linux, Unix, macOS, and any other, must be able to access and manage files and data on storage devices.

Best Laptops for Linux and Apps Development [2020]

Apart from your programming skills, there are a few other things that can also influence the way you code, and one of them is your computer system for sure. Even though it isn't like you can't code on a regular PC or laptop, speaking from personal experience, you can make the most out of your programming skillset by going for a computer with high specs and one that's been specially designed for such tasks.

6 best task managers for Linux

One of the essential tools in any Linux distribution is a Task Manager. It is a system monitor application that gives you a report of all programs running on your computer and the status of your RAM and CPU usage.