How to Install and Configure GitLab on Debian 9

Recently Microsoft bought GitHub. Those of you Microsoft haters may say GitHub is not trustable anymore. Well, I won’t say anything about that. But GitHub is one of the best Git frontends that ever existed. Even though there are other alternatives to GitHub, but who knows which company will buy them in future. Also switching from one service to other is costly and time consuming for big companies. What if you could self-host something like GitHub and use it on your own server? That way you would never have to worry about your privacy. GitLab is just that. It is a Git frontend just like GitHub that you can self-host on your own server. GitLab is available on many Linux distributions. GitLab has free plans as well as paid plans to help you grow your business.

To learn more about GitLab, visit the official website of GitLab at  In this article, I will show you how to install and configure GitLab on Debian 9. Let’s get started.

System Requirements:

GitLab recommends at least a system of 2 core processor, 8 GB of RAM, and 4 GB of swap space. But it will run on single core processor and 4 GB RAM, even though it will be very slow.

To learn more about the system requirements of GitLab, you can visit the official website of GitLab at

In this article, I will use a VMware virtual machine with 2 core processor and 4 GB of RAM. I don’t have a powerful machine to run GitLab with the recommended settings. But it should work just fine for the demonstration.

Installing GitLab Dependencies:

GitLab depends on some of the other packages that you must install before installing GitLab.

First, update the package repository cache with the following command:

$ sudo apt update

Now install the GitLab dependencies with the following command:

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

Now press y and then press <Enter>.

The dependencies should be installed.

Installing Postfix Mail Server:

Now you have to install the Postfix mail server on Debian 9. I wrote a detailed guide on how to install Postfix which you can read at How to Install and Configure Postfix on Ubuntu 18.04 LTS ( I won’t go through the details of every step here. I recommend you read dedicated Postfix article of mine.

The guide focused on how to install Postfix on Ubuntu 18.04 LTS. But the procedure is the same for Debian 9 Stretch.

Run the following command to install Postfix on Debian 9:

$ sudo apt install postfix]

Now press y and then press to continue.

Now select Internet Site and then navigate to <OK> and then press <Enter> to continue.

Now type in your Fully Qualified Domain Name (FQDN) here and select <OK> and then press <Enter>.

Postfix should be installed.

Adding GitLab Package Repository:

The free version of GitLab is called GitLab Community Edition or GitLab CE and the paid version of GitLab is called GitLab Enterprise Edition or GitLab EE. You have to add the package repository of either GitLab CE or GitLab EE depending on the version you want to install.

Now run the following command to add the package repository of GitLab and add the GPG key of GitLab on Debian 9 Stretch:

For GitLab CE:

$ curl | sudo bash

For GitLab EE:

$ curl
| sudo bash

Installing GitLab:

Now you can install GitLab CE or GitLab EE depending on the GitLab repository you added. I will go for GitLab CE.

Run the following command to install GitLab on Debian 9:

For GitLab CE:

$ sudo apt install gitlab-ce

For GitLab EE:

$ sudo apt install gitlab-ee

The installation process should begin. As you can see, the package is being downloaded and it is quite big in size. It should take a while to complete.

GitLab should be installed.

Now open gitlab.rb file with the following command:

$ sudo nano /etc/gitlab/gitlab.rb

Now change the marked URL to your IP address or Fully Qualified Domain Name (FQDN).

I changed it to my IP address as this is a test setup. In real world, you should use a FQDN here.

Once you’re done, save the file and run the following command for the changes to take effect:

$ sudo gitlab-ctl reconfigure

GitLab should be reconfigured.

Now visit the FQDN or IP address from a web browser and you should be the following page. Type in the password you want to set for the root user and click on Change your password.

The root password for GitLab should be set.

Now you can login as root with the root password that you set. From here you can manage your GitLab account.

You can also create additional users as required.

Happy GitLabing. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Git Merge –no-ff Option

Understanding Git Merge no-ff Option The easy merge capability of git is one of its strengths. During a merge, git uses...

Git Add All Modified Files

When you are dealing with Git add, you have multiple options to add all modified files. Let’s look at a few scenarios...

How to Create Branches on Git

Git is one of the best version control system out there. It is very popular among almost every type of software developers...
Bài Viết

Bài Viết Mới Cập Nhật


Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail

Mua shadowsocks và hướng dẫn sữ dụng trên window

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo