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.
Related Content
- 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
Prerequisites
- 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.
ForĀ 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Ā http://
Ā (withoutĀ s
).
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:
external_url 'http://gitlab.citizix.com'
Save & and run the reconfiguration script
sudo gitlab-ctl reconfigure
Wait for the configuration script to finish. You should see something similar to this:
Recipe: monitoring::alertmanager
* runit_service[alertmanager] action restart (up to date)
Recipe: monitoring::postgres-exporter
* runit_service[postgres-exporter] action restart (up to date)
Recipe: monitoring::grafana
* runit_service[grafana] action restart (up to date)
Running handlers:
Running handlers complete
Chef Infra Client finished, 189/1108 resources updated in 02 minutes 28 seconds
gitlab Reconfigured!
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.
Conclusion
Congratulations, you now have your local GitLab up and running.Ā You can now use your Gitlab CE Server to manage repositories and projects.
Have fun!