How to Install GitLab on Ubuntu Linux

computer screen with program code
computer screen with program code

GitLab (Git-repository manager), an open-source version control platform similar to GitHub, is robust, scalable, and a great alternative.

GitLab has rich features like issues and time tracking, repository branching, file locking, tagging, merging, and many other features that you will find in a typical source control platform.

GitLab streamlines your collaborative workflows. With GitLab’s flexible project management tools, visualize, prioritize, coordinate, and track your progress your way.

This brief tutorial will show students and new users how to easily install GitLab on Ubuntu 16.04 / 17.10 and 18.04.

To install GitLab on Ubuntu, follow the steps below

Install Required Packages

Before installing GitLab, you must make sure Ubuntu is ready. That means installing the necessary packages for GitLab to function. To do that, run the commands below.

sudo apt update
sudo apt install curl openssh-server ca-certificates

Next, run the commands below to install Postfix MTA for notifications.

sudo apt install postfix

During the installation, you’ll be prompted to select the type of mail configuration. First, choose an Internet Site [ Mail is sent and received directly using SMTP], as shown below. Then press Enter to continue.

GitLab Ubuntu Install

Next, provide a mail server name. They can be the server Postfix is installed on.

mail.example.com

GitLab Ubuntu install

Install GitLab Packages

Now that your server is ready, run the commands below to download and install GitLab packages. The EXTERNAL_URL value should be the URL for the GitLab site. If you’re testing in a development environment, you may have to enter that in the server host file. This is the URL you’ll need to access the GitLab site.

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
EXTERNAL_URL="http://gitlab.example.com" sudo apt install gitlab-ce

After the commands above, you should see a completion message.

Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
  sudo gitlab-ctl reconfigure

Run the commands below to start the GitLab instance.

sudo gitlab-ctl reconfigure

By default, the Ubuntu firewall is disabled. It runs the commands below to allow HTTP and HTTPS traffic if enabled.

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

After that, open your browser and browse the URL for your GitLab instance. You should see the GitLab setup page, as shown below. Change the admin account immediately. And you should be redirected to the login screen.

http://gitlab.example.com

GitLab ubuntu

That’s it! This is how to get GitLab installed on Ubuntu systems. More advanced settings can come after, but this is the minimum to get GitLab started.

The default username is the root.

GitLab Ubuntu install

You may also like the post below:

Posted by
Richard

I love computers; maybe way too much. What I learned I try to share at geekrewind.com.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: