How to Install GitLab on Debian 10

Install GitLab on Debian 10 and transport your system into a Git repository host. Doing that will help you seamlessly set up the DevOps platform. You can also conclude project planning alongside source code management, employ issue tracking, and more.

GitLab is an open-source DevOps platform representing a code repository and a collaborative software development platform, especially for the projects corresponding to DevOps and DevSecOps. Like GitHub, GitLab is developed on the Git basis. It bears functionality identical for the core source code management. 

GitLab is well known for offering a rigid location for storing all sorts of online codes. It also bags the capability of tracking the CI/CD. In this article, you’ll learn how to install GitLab on Debian 10 and configure it most efficiently.

Pre-requisites:

Here is what you’ll need to install GitLab on Debian 10

  • A system with at least 8 GB of RAM
  • Sudo privileges
  • Debian 10 server with SSH access
  • Valid domain name pointing towards the server IP address
  • Minimum hard disk space of 30 GB

Installing GitLab on Debian 10

Now that you’re aware of the elements required to proceed with the installation GitLab utility on Debian 10, it is time to walk you through the step-by-step guide.

Updating the System

Before you install GitLab on Debian 10, the first thing you’ll need to do is update the package list on your system. Login to your Debian server via SSH, launch the Terminal and invoke the following command. Make sure you access the Debian server with sudo privileges.

$ sudo apt update

Installing the GitLab Dependencies

After getting the system packages updated, install all the dependencies corresponding to GitLab. Keep in mind, the packages are installed from default repositories. It is crucial to get all software packages for GitLab installed on your system.

Run the following command:

$ sudo apt install ca-certificates curl openssh-server postfix
installing gitlab dependencies

Once done, select the Internet Site option as the default one for mail configuration.

gitlab mail configuration

Finally, supply the mail name of the system as displayed on the screen, followed by hitting the Enter button on the keyboard. The system will then automatically conclude the installation process of the dependencies.

You’re now ready to install GitLab on Debian 10 system.

Installing the Gitlab CE

As of now, you’re done getting all the prerequisites installed. For that matter of fact, it is time you proceed towards installing the GitLab CE.

Downloading Repositories

Start by downloading the repository script right from GitLab and saving the same to the /tmp directory. 

Launch the Terminal by using the Ctrl+Alt+T key combination

Run the following command:

$ cd /tmp
$ wget [Link]
install gitlab on debian 10

As soon as the script is downloaded, launch the Terminal and execute the following command:

$ sudo bash script.deb.sh

Getting GitLab CE Ready

Running the command above will help prepare the GitLab repository and eventually initiate the process of GitLab installation. Once you are done setting up all the repositories, it is time you install the GitLab CE by invoking the command:

$ sudo apt install gitlab-ce

The system will then ask for authentication through a prompt. Simply type in Y followed by hitting the Enter key. 

configuring gitlab

Soon after, you’ll come across a notification stating that GitLab is left unconfigured during the installation. The output will also let you know that the hostname is yet to attain a valid configuration.

Configuring GitLab

Post-installation, you’ll need to configure the GitLab. It is usually done by launching and editing the github.rb file utilizing a promising editor. In this case, we’ll employ the Vim editor. To open the file, run the following command:

$ sudo vim /etc/gitlab/gitlab.rb
vim editor

After that, you’ll need to locate the external_url parameter and get the field corresponding to the domain updated. Here is how you can do it:

external_url 'http://domain.com'

For instance:

external_url 'http://distroid.net'
how to configure GitLab on debian 10

Updating Email

Now find the field named letsencrypt['contact_emails'] and update it with an active email address. A user is notified about the concerned Encrypt SSL certificate approaching expiry via the email address they provide.

letsencrypt['contact_emails'] = ['admin@name']

Finally, save the file and invoke the following command to reconfigure GitLab installation.

$ sudo gitlab-ctl reconfigure

Wait for a few minutes for the reconfiguration to conclude. The GitLab Reconfigured! notification will let you know that you’re good to proceed.

Accessing the GitLab

Done configuring already? Well then, up next is accessing the GitLab on the front-end. Kick-off the process by browsing your domain from any web browser. In other words, launch a web browser and search for your domain.

http://gitlab.domain.com

You’ll soon find yourself inside a login page. Just use the root user credentials and get yourself logged in.

accessing GitLab

Right after, the system will ask you to alter your password. Now input the desired characters and click on the option that says change your password. And this is how you access GitLab after installing it on Debian 10.

Securing the GitLab 

You’re almost done setting up GitLab on your Debian 10 system. However, the only thing left is ensuring safety in the GitLab environment. Here is when Let’s Encrypt comes into play.

With Let’s Encrypt, you’re looking at an open-source security certificate. Invoking the Let’s Encrypt authority allows a user to secure their website. The good thing is that the GitLab configuration is compatible with Let’s Encrypt.

Configuring the Gitlab Instance for Using Let’s Encrypt SSL 

Launch the gitlab.rb file using an editor; Vim, for instance.

 $ sudo vim /etc/gitlab/gitlab.rb

Look for the letsencrypt parameters and edit them as shown.

letsencrypt['enable'] = true
letsencrypt['auto_renew'] = true

Here, letsencrypt['enable'] = true allows the Let’s Encrypt to be configured, while letsencrypt[‘auto_renew’] = true helps enabling the auto renewal of the certificate.

Defining the Time for Auto-Renewal

While enabling the auto-renewal process, you can define the desired hour and day on which you want your system to conclude auto-renewal. 

letsencrypt['auto_renew_hour'] = desired value
letsencrypt['auto_renew_day_of_month'] = "*/desired value"

Using HTTPS Protocol Instead of HTTP

Edit the external_url parameter.

external_url 'https://domain.com'

Save the changes

Exit from the config file. 

Launch the Terminal and run the following command:

$ sudo gitlab-ctl reconfigure

Don’t forget to verify if the entire process went the way it should be. For that, use the following command:

$ sudo gitlab-rake gitlab:check

This is how you install GitLab on Debian 10. From getting the GitLab dependencies ready to configuring, accessing, and securing Gitlab, in this article, we’ve discussed everything that associates with the working of GitLab on Debian 10. We ensured a user-friendly tone throughout so that you have no trouble following along.

If this guide helped you, please share it.

Leave a Reply
Related Posts