Objective
Install Gitlab on Debian 9 Stretch
Distributions
Debian 9 Stretch
Requirements
A working installation of Debian Stretch with root access.
Difficulty
Easy
Conventions
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ – requires given linux commands to be executed as a regular non-privileged user
Introduction
Gitlab is an awesome free software alternative to Github. It allows teams and individual developers to host and manage their own projects on servers that they control.
Debian Stretch provides a stable foundation for Gitlab and can make for an excellent code repository server. Plus, Gitlab’s Omnibus Package makes installation super simple.
Install The Dependencies
There are a couple of dependencies that you need to install on Debian before you can set up Gitlab. The only thing that might seem out of the ordinary is Postfix. Gitlab uses it to send emails about the repository. During the install, Postfix will ask you which type of configuration to use, select “Internet Site.”
# apt install curl openssh-server ca-certificates postfix
Add The Repository and Install
Gitlab provides a convenient script that adds the Gitlab repository to Debian and installs Gitlab. Grab the script with curl
and run it as root.
#curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
When the script finishes, you can install Gitlab with apt
.
# apt install gitlab-ce
Reconfigure And Start
gitlab-ctl
is the command line utility that you’ll use to manage Gitlab. In this case, you need to use it to generate your configuration.
# gitlab-ctl reconfigure
The script will run and set up your configuration for Gitlab. It will also start up Gitlab when it’s done.
In the future, when you want to start and stop Gitlab, you can use the following linux commands.
# gitlab-ctl start # gitlab-ctl stop
First Run And Setup

Since Gitlab is running, browse to your server’s IP or domain name in your browser. Gitlab will greet you with a screen asking you to create a password for your administrative user. For now, that user is called “root,” but you can change it when you log in.

After you enter your new password, Gitlab will ask you to log in. Enter your login credentials and you’ll gain access to the admin panel of Gitlab. There are a ton of options there. It’s best if you take a look around and explore. It should look somewhat familiar to you if you’re used to Github.
Closing Thoughts
Gitlab is a powerful piece of software, and it comes completely “batteries included.” There are probably more features than you’ll ever need, but if you are looking to host a larger project or are working with a team, Gitlab will easily meet your needs.
As an added bonus, if you are a free software supporter or you’re concerned with privacy, Gitlab is the perfect option.