GitLab is an open source GIT repository manager based on Rails and developed by GitLab Inc. It is a web-based GIT repository manager that allows your team to work on code, perform feature requests, track bugs, and test and implement applications. GitLab provides features such as a wiki, issue tracking, code reviews, activity feeds, and merge management. It is able to host multiple projects.

GitLab is available in four editions:

Gitlab CE (Community Edition) - self-hosted, free and support from the Community forum.

In this tutorial, I will show you step-by-step how to install GitLab CE (Community Edition) on your own Ubuntu 18.04 LTS (Bionic Beaver) server. I will be using the 'omnibus' package provided by GitLab for easy installation.

Prerequisites

Ubuntu 18.04 Server

Min RAM memory 4GB - for better performance, use 8GB

Root privileges

What we will do

Update Repository and Upgrade Packages

Install Dependencies

Install GitLab Community Edition

Generate SSL Letsencrypt and DHPARAM Certificate

Configure HTTPS for GitLab

Configure Ubuntu UFW Firewall

GitLab Post-Installation

Testing

Step 1 - Update Repository and Upgrade Packages

Before installing any packages on the system, update all available repositories and then upgrade all packages on the system.

Run apt commands below.

sudo apt updatesudo apt upgrade -y

Wait for the installation packages that will be upgraded.

Step 2 - Install Gitlab Dependencies

GitLab needs some packages dependencies for the installation, including curl, postfix, and ca-certificates.

Install GitLab packages dependencies using the apt command below.

sudo apt install curl openssh-server ca-certificates postfix -y

During postfix installation, you will be prompted about the configuration, select 'Internet Site'.

And then enter the server domain name that shall be used for sending an email.

And we're ready to install GitLab on the server.

Step 3 - Install GitLab

In this step, we will install GitLab using the omnibus packages. The Omnibus will install all packages, services, and tools required for running GitLab on the server.

This command will install and configure GitLab based on the '/etc/gitlab/gitlab.rb' configuration file.

And when it's complete, you will see the result as below.

The GitLab installation is complete, and HTTPS for GitLab has been enabled.

Step 6 - Configure Ubuntu UFW Firewall

In this step, we will enable the Ubuntu UFW firewall. It's already installed on the system, we just need to start the service. We will run GitLab behind the Ubuntu UFW firewall, so we must open the HTTP and HTTPS ports.

Add ssh, http, and https services to the configuration.

sudo ufw allow sshsudo ufw allow httpsudo ufw allow https

And enable the Ubuntu UFW firewall with the command below.

sudo ufw enable

Type 'y' for yes to enabled it.

Now check all services and ports list on the list.

sudo ufw status

And you will get ssh, http, and https services on the list.

Step 7 - GitLab Post-Installation

Open the web browser and type in the gitlab URL 'git.hakase-labs.pw', and you will be redirected to the HTTPS connection.

Sign up Restrictions

Account Limit

Click on the 'Account and limit' section and set the default project limit to 20.

And click the 'Save changes' button.

Step 8 - Testing Gitlab

Finally, we will do some tests to ensure that our GitLab system is working properly.

Create New Project

Click the plus icon on the top mid to create a new project repository. Type in your project name, description, and set up the visibility settings of your project. Then click on the 'Create project' button.

The new project has been created.

Test First Commit and Push

Now we will start adding new content to the repository. Make sure Git is installed on your computer, and we need to set up the global username and email for git with the command below.

Reference

Muhammad Arul is a freelance system administrator and technical writer. He is working with Linux Environments for more than 5 years, an Open Source enthusiast and highly motivated on Linux installation and troubleshooting. Mostly working with RedHat/CentOS Linux and Ubuntu/Debian, Nginx and Apache web server, Proxmox, Zimbra Administration, and Website Optimization. Currently learning about OpenStack and Container Technology.

I really can't use nginx and gitlab at the same time... I tried lot of things but I can't activate both together.

I tried to disable nginx in gitlab.rb and tried to configure manuelly nginx for use gitlab, but it's in ruby and nginx can't run it, I see on forums we need to install passenger, I don't understand what to do actually.