How to install GitLab on Debian 10 system?

How to Install GitLab on Debian 10

GitLab is a free and open-source front-end Git repository with wiki and issue tracking. It allows you to host Git repositories on your own server and set up a DevOps platform.

In this guide, we will install GitLab CE (Community Edition) on a Debian 10 (Buster ) system.

Prerequisites

  • An instance of Debian 10 server with SSH access.
  • Minimum of 8 GB RAM
  • 20GB of hard disk space
  • A valid domain name pointed to the IP address of the server.
  • User with sudo rights

(1) Update the system

Access your Debian server using SSH to update the package list on the system

$ sudo apt update

(2) Install GitLab dependencies

After the update is complete, install the required dependencies as shown below

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

Install-Postfix-Debian10-Gitlab

For Postfix mail server, make sure the mail configuration option is Internet Site

Choose-Internet-Site-Postfix-Configuration-Gitlab

Next, provide the system mail name as shown and press ENTER

Mail-Name-Postfix-Gitlab-Debian10

After that, the system will automatically complete the installation of all packages and their dependencies

(3) Install Gitlab CE

First download the repository script from GitLab to the /tmp directory as shown

$ cd /tmp
$ wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh

After the download is complete, you need to execute the script as follows

$ sudo bash script.deb.sh

This will set up the GitLab repository, ready for installing GitLab

Run-Gitlab-Bash-Script-Debian10

After completing the setup of the repository, execute the command to install GitLab CE as follows

$ sudo apt install gitlab-ce

Install-Gitlab-CE-apt-command

When prompted, press Y and press ENTER to continue the installation

During the installation, you will be notified that GitLab has not been configured and that a valid hostname has not been configured

Gitlab-CE-Installation-Message

We will go further and make the necessary configuration

(4) Configure Gitlab

To tune our GitLab installation, you need to edit the github.rb file. Here we will use the vim editor to open the file.

To optimize your GitLab installation, you need to edit the github.rb file, we will use the vim editor to open the file

$ sudo vim /etc/gitlab/gitlab.rb

Search and locate the external_url parameter. Update the field to correspond to your domain as follows:

Search for and locate the external_url parameter, update the field to correspond to your domain name as shown below

external_url ‘http://domain.com’

In this example, using our test domain name as follows

external_url 'http://crazytechgeek.info'

External-URL-Gitlab-CE-Debian10

Next, find the letsencrypt['contact_emails'] parameter and fill in your own email address, which will be used to receive the Let s Encrypt SSL certificate expiration reminder.

letsencrypt['contact_emails'] = ['[email protected]']

Email-Contact-Gitlab-CE-Debain10

Finally, save the file and reconfigure the GitLab installation as follows

$ sudo gitlab-ctl reconfigure

Gitlab-CE-Reconfiguration-Command-Debain10

The reconfiguration takes about 5 minutes, and when the configuration is complete, you should see the output of GitLab Reconfigured!

Successfull-Gitlab-Reconfiguration-Message-Debain10

(5) Visit Gitlab

Access your domain name from a web browser as follows

http://domain.com

On your first visit, you will be presented with the login page below. Log in with root user credentials.

Access-Gitlab-Portal-Debain10

You will be asked to change your password

Change-Root-Password-Gitlab-Debain10

Once done, click on the Change Password option and press ENTER. It then leads you to the GitLab Dashboard as shown

Gitlab-CE-Dashboard-Debain10

(6) Use Let's Encrypt SSL security certificate

Let’s Encrypt is a free security certificate by Lets Encrypt
authority that allows you to secure your website. GitLab configuration
supports Let’s Encrypt and, in this step, we will configure our Gitlab
instance to use Let’s Encrypt SSL for secure connections.

Let's Encrypt is a free security certificate licensed by Let's Encrypt to encrypt your website. GitLab is configured to support Let s Encrypt, in this step we will configure our GitLab instance to use Let s Encrypt SSL for secure connections.

Edit the gitlab.rb file

$ sudo vim /etc/gitlab/gitlab.rb

Edit the following parameters:

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

The first line allows configuration of Let s Encrypt, and the second line sets automatic renewal of certificates

Apart from that, you can also define the monthly auto-renew time and date as follows

letsencrypt['auto_renew_hour'] = 5
letsencrypt['auto_renew_day_of_month'] = "*/6"

Set URL to HTTPS protocol instead of HTTP protocol

external_url 'https://crazytechgeek.info'

Save the changes and exit the configuration file, run the following command again

$ sudo gitlab-ctl reconfigure

To verify that everything is going as planned, call the command

$ sudo gitlab-rake gitlab:check

Gitlab-rake-command-Debian10

Reload the browser, you can see that the Let's Encrypt SSL certificate has taken effect.

SSL-Certificates-Gitlab-Portal-Debian10

my open source project

Kugua Cloud Classroom - Online Education Solution

Guess you like

Origin blog.csdn.net/xiaochong0302/article/details/128640869