Install and Configure GitLab CE on Debian 10 / 11
This guide will walk you through the steps to Install GitLab CE on Debian 10/11. GitLab Community Edition (CE) is an open-source application for hosting Git repositories in your own infrastructure. With GitLab you can do project planning and source code management to CI/CD and monitoring. GitLab has evolved to become a complete DevOps platform, delivered as a single application.
The next sections will cover the steps to be followed to have a running GitLab CE on Debian 10/11 Linux machine.
In my setup I’ll use a server with the following specs:
- 4GB of Ram
- 4 vCPU
- 50GB Disk Space
- Domain name: gitlab.irg-net.com
So let’s start installation of GitLab CE on Debian 10/11 system.
Step 1: For newly installed Debian server, update all packages and upgrade any system packages to the latest release.
sudo apt update
sudo apt -y upgrade
sudo reboot
Step 2: Once the server has been updated and rebooted, install important software packages for GitLab. All the packages are installed from default package repositories.
sudo apt -y install curl vim openssh-server ca-certificates
(Optional) GitLab should be able to send emails to you on Git activities. Configure Postfix SMTP Server using the guide below:
Step 3: With the dependency packages installed, let’s add GitLab repository to our Debian 10 server.
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
If this is successful, a positive message should be displayed.
Running apt-get update... done.
Installing debian-archive-keyring which is needed for installing
apt-transport-https on many Debian systems.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/gitlab_gitlab-ce.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.
The repository is setup! You can now install packages.
Step 4: Next, install the GitLab package while changing https://gitlab.example.com to the URL at which you want to access your GitLab instance.
export GITLAB_URL="http://gitlab.irg-net.com"
sudo EXTERNAL_URL="${GITLAB_URL}" apt install gitlab-ce
If your server has a public IP and access to the internet, you can use https and Let’s Encrypt SSL certificate.
export GITLAB_URL="https://gitlab.irg-net.com"
sudo EXTERNAL_URL="${GITLAB_URL}" apt install gitlab-ce
The installation will automatically configure and start GitLab at the URL provided. Whenever you change GitLab configurations on /etc/gitlab/gitlab.rb, reconfigure the application by running the following command.
sudo gitlab-ctl reconfigure
Once the installation of GitLab CE on Debian 10/11 is done, open the URL https://gitlab.irg-net.com on your browser to finish the installation of GitLab CE.
On your first visit, you’ll be redirected to a password reset screen. Provide the password for the initial administrator account and click on the Change your password button when you are finished.
You will be redirected back to the login screen. Use the default account’s username root and password set to login.
The next screen should be a Welcome to GitLab page.
Learn more from the GitLab documentation. And thats it, if you have any questions please leave a comment below. 🙂