How to Install GitLab CE on Debian 13
1. Introduction to GitLab
GitLab is a web-based DevOps platform that provides a complete set of tools for managing software development projects. It includes Git repository management, issue tracking, project management, collaboration features, and built-in CI/CD capabilities.
By hosting GitLab on your own server, you can maintain full control over your source code, projects, users, and development infrastructure. GitLab CE provides the core features needed to host Git repositories and manage software development projects.
In this guide, we will explain how to install GitLab CE on a Debian 13 server using the official GitLab package repository.
This guide focuses on a basic installation. GitLab will be configured to use the server’s IP address directly over HTTP, so you do not need a domain name or SSL certificate.
2. Prerequisites
Before starting the installation, make sure you have a Debian 13 server with root access and a stable Internet connection.
You will also need the public IP address of your server. In this guide, YOUR_SERVER_IP Represents your server’s IP address.
Replace it with your actual IP address when running the commands.
2.1. Update the System
Start by updating the package lists:
apt update
Then upgrade the installed packages:
apt upgrade -y
Updating the system before installing GitLab helps ensure that the server has the latest available package versions and security updates.
2.2. Install Required Dependencies
Install the basic packages required for the GitLab installation:
apt install -y curl ca-certificates tzdata perl
These packages provide the tools and dependencies required to add the GitLab repository and install the GitLab package.
2.3. Add the GitLab CE Repository
GitLab provides an official package repository for Debian systems. Add the GitLab CE repository using the following command:
curl --location "https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh" | bash
The installation script detects the operating system and configures the appropriate GitLab package repository.
After the repository has been added, update the package lists:
apt update
2.4. Verify the GitLab Package
Before installing GitLab, you can verify that the GitLab CE package is available from the repository:
apt-cache policy gitlab-ce
The command should display the available GitLab CE version.
If the package is listed, the repository has been added successfully and you can continue with the installation.
2.5. Install GitLab CE
Install GitLab CE and configure it to use the server’s IP address:
EXTERNAL_URL="http://YOUR_SERVER_IP" apt install -y gitlab-ce
Replace YOUR_SERVER_IP with the public IP address of your server.
For example:
EXTERNAL_URL="http://203.0.113.10" apt install -y gitlab-ce
During the installation, the GitLab package automatically installs and configures the components required to run GitLab.
The installation process may take several minutes depending on the server’s resources and network speed.
2.6. Apply the GitLab Configuration
After installation, you can apply the current GitLab configuration with:
gitlab-ctl reconfigure
This command applies the configuration stored in /etc/gitlab/gitlab.rb and ensures that the required GitLab services are configured correctly.
The initial installation normally performs the required configuration automatically, but running gitlab-ctl reconfigure is useful for verifying and applying the current configuration.
2.7. Check the GitLab Services
After the configuration has completed, check the status of the GitLab services:
gitlab-ctl status
A correctly installed GitLab instance should show its services with a run status.
You can also run the GitLab health check:
gitlab-rake gitlab:check
This command checks the GitLab installation and can help identify configuration or service problems.
2.8. Retrieve the Initial Root Password
GitLab automatically generates an initial password for the root administrator account during installation.
Retrieve the password with:
cat /etc/gitlab/initial_root_password
The output contains the initial password required to log in to GitLab.
The initial password file is only available for a limited period after installation. Therefore, retrieve the password as soon as the installation is complete.
After logging in for the first time, change the root password to a strong and unique password.
2.9. Access GitLab
Once the installation is complete, open a web browser and access GitLab using the server’s IP address:
http://YOUR_SERVER_IP
For example:
http://203.0.113.10
At the GitLab login page, enter:
Username: root Password: Your_Initial_Root_Password
Replace Your_Initial_Root_Password with the password retrieved from /etc/gitlab/initial_root_password.
After logging in, you can start creating projects and repositories.
2.10. Verify the GitLab Installation
After accessing the GitLab web interface, verify that the installation is working correctly.
You can check the GitLab services again:
gitlab-ctl status
You can also check the GitLab version:
gitlab-rake gitlab:env:info
If the GitLab web interface is accessible and the services are running normally, the basic installation is complete.
2.11. Useful GitLab Commands
The following commands are useful for basic GitLab administration.
Check the GitLab service status:
gitlab-ctl status
Restart GitLab:
gitlab-ctl restart
Start GitLab:
gitlab-ctl start
Stop GitLab:
gitlab-ctl stop
Reconfigure GitLab:
gitlab-ctl reconfigure
View GitLab logs:
gitlab-ctl tail
These commands can be useful when managing or troubleshooting the GitLab installation.
3. Conclusion
In this guide, we installed GitLab CE on a Debian 13 server using the official GitLab package repository.
We first updated the system and installed the required dependencies. We then added the official GitLab CE repository, verified the available package, and installed GitLab using the server’s IP address.
After the installation, we applied the GitLab configuration, checked the GitLab services, retrieved the initial root password, and accessed the GitLab web interface.
GitLab is now ready for basic use on your Debian 13 server. This simple setup does not require a domain name or SSL certificate and is suitable for getting a basic GitLab instance running quickly.