GitLab allows you to host an on-premise Git repository that can be accessed from either your local LAN or (if you have an available public IP address) from outside your company. GitLab is an open-source repository manager based on Rails developed by GitLab Inc. It is a web-based git repository manager that allows your team to collaborate on coding, testing, and deploying applications. GitLab provides several features, including wikis, issue tracking, code reviews, and activity feeds.
In this guide, we will install the GitLab CE on the Debian 11. We will install the GitLab CE using the ‘omnibus’ package provided by GitLab.
- How to install and Set up Gitlab CE Server on Ubuntu 20.04
- How to install and set up Gitlab CE Server on Rocky Linux/Centos 8
- Updated Debian 11 server
- Access to the internet
- Ensure that your server is at lease 4GB of RAM with more than 20GB of disk space and 2 CPUs
Table of Content
- Ensure that the server packages are up to date
- Installing and configuring the necessary dependencies
- Add the GitLab package repository and install the package
- Fix for the GitLab “Unable to locate package gitlab-ce” on Debian 11
- Configuring Gitlab CE
- Accessing Gitlab CE
1. Ensure that the server packages are up to date
Before proceeding let us update our Centos 8 server using this command:
sudo apt update
sudo apt update -y
Install common packages that will be essential
sudo apt install -y vim
2. Install and configure the necessary dependencies
Before proceeding let’s ensure that the pakages needed are installed. Use this command:
sudo apt-get install -y curl openssh-server ca-certificates perl
Next, install Postfix to send notification emails. If you want to use another solution to send emails please skip this step and configure an external SMTP server after GitLab has been installed.
sudo apt install -y postfix
During Postfix installation a configuration screen may appear. Select ‘Internet Site’ and press enter. Use your server’s external DNS for ‘mail name’ and press enter. If additional screens appear, continue to press enter to accept the defaults.
3. Add the GitLab package repository and install the package
Add the GitLab package repository.
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Next, install the GitLab package. Make sure you have correctly set up your DNS, and change
https://gitlab.citizix.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.
https:// URLs, GitLab will automatically request a certificate with Let’s Encrypt, which requires inbound HTTP access and a valid hostname. You can also use your own certificate or just use
If you would like to specify a custom password for the initial administrator user (
root), check the documentation. If a password is not specified, a random password will be automatically generated.
sudo apt update sudo EXTERNAL_URL="https://gitlab.citizix.com" apt install gitlab-ce
4. Fix for the GitLab “Unable to locate package gitlab-ce” on Debian 11
If the above fail with
Unable to locate package gitlab-ce, a workaroud is using the debian 10 repos.
Edit the repo file
sudo vim /etc/apt/sources.list.d/gitlab_gitlab-ce.list
Update the content as follows
deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ buster main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ buster main
Now you can update and install gitlab ce
<meta charset="utf-8">sudo apt update
sudo EXTERNAL_URL="https://gitlab.citizix.com" apt install gitlab-ce
5. Configuring Gitlab CE
Now that gitlab is successfully installed, let’s configure it. The main configuration file can be found in the file
/etc/gitlab/gitlab.rb. Open the file (
vim /etc/gitlab/gitlab.rb) and confirm that the external url is set as defined during installation:
Save & and run the reconfiguration script
sudo gitlab-ctl reconfigure
Wait for the configuration script to finish. You should see something similar to this:
* runit_service[alertmanager] action restart (up to date)
* runit_service[postgres-exporter] action restart (up to date)
* runit_service[grafana] action restart (up to date)
Running handlers complete
Chef Infra Client finished, 189/1108 resources updated in 02 minutes 28 seconds
6. Accessing Gitlab CE
Once the configuration is complete, Gitlab CE is available in the URL provided (In my case http://gitlab.citizix.com. Ensure that the DNS entry for the URL is pointing to the server then access that url in the browser. You should be redirected to the login page as shown below:
Unless you provided a custom password during installation, a password will be randomly generated and stored for 24 hours in
/etc/gitlab/initial_root_password. Use this password with username
root to login.
sudo cat /etc/gitlab/initial_root_password
Once logged in you can use the gitlab server to create and manange projects and repositories.
Congratulations, you now have your local GitLab up and running. You can now use your Gitlab CE Server to manage repositories and projects.