This guide will walk you through the steps to Install GitLab CE on Debian 11|Debian 10. 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 11|Debian 10 Linux machine. Debian 11 is currently available for general use and we’ve chosen it to host our GitLab service.
In my setup I’ll use a server with the following specs:
- 8GB of Ram
- 4 vcpus
- 40GB Disk space
- Domain name: git.computingpost.com
See output shared below.
$ free -h total used free shared buff/cache available Mem: 7.8Gi 74Mi 7.6Gi 9.0Mi 101Mi 7.5Gi Swap: 4.0Gi 0B 4.0Gi $ grep -c ^processor /proc/cpuinfo 4 $ df -hT / Filesystem Type Size Used Avail Use% Mounted on /dev/vda1 ext4 40G 963M 37G 3% /
So let’s start installation of GitLab CE on Debian 11|Debian 10 system.
Step 1: Update Debian server
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: Install GitLab Dependencies on Debian 11|Debian 10
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
Step 3: Configure Postfix Send-Only SMTP Server
GitLab should be able to send emails to you on Git activities. Configure Postfix SMTP Server using the guide below:
Other email solutions can be used as discussed in detail on configure an external SMTP server.
Step 4: Add the GitLab CE Repository
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 5: Install GitLab CE on Debian 11|Debian 10
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://git.computingpost.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://git.example.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
Step 6: Access GitLab CE Web Interface
Once the installation of GitLab CE on Debian 11|Debian 10 is done, open the URL
http://gitlab.example.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.