How to install GitLab on Linux

In this tutorial, How to install Gitlab on Linux such as centos server and ubuntu server. To use Gitlab CE or Community Edition is open source. It’s a Git repository, a Gitlab server like a GitHub server. The commands as below running root account.

The steps for installing the Gitlab server are as below:

  • SSH client connects to Gitlab server
  • To install the package dependencies and install Gitlab CE
  • The firewall has to open a port for the GitLab server

The hardware requirements for the Gitlab server:

  • 2 cores4GB
  • of RAM

Gitlab on Centos server

Update System Packages and Install Dependencies for the Centos server.

Open a terminal

Install them by running the following command:

# yum update -y
# yum install curl openssh-server postfix -y

Note: During Postfix installation, select Internet Site when prompted.

To install GitLab CE on the Centos server

# cd /opt/
# curl -O
# sh
# yum -y install gitlab-ce
# gitlab-ctl reconfigure

Gitlab on the Ubuntu server

Update and install package dependencies for the Ubuntu server

# apt-get update -y
# apt-get install curl openssh-server postfix -y

install GitLab on Linux update

Note: During Postfix installation, select Internet Site when prompted.

To install GitLab CE server on the Ubuntu server

# cd /opt/
# curl -O
# bash
# apt-get install gitlab-ce
# gitlab-ctl reconfigure

How to change password root default for Gitlab server. The problem is when you first login “Invalid login or password” on the Gitlab server. This problem is solved!

# gitlab-rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=123456789

The finish, To install GitLab CE Server, the first login
From the browser you access to links:  “http://gitlab_domain_or_IP” and then login with a “root” user and with the initial password “5iveL!fe. (in this tutorial, the changed password for root is 123456789)

To restart the service for the Gitlab server

# gitlab-ctl restart

The output below:

 ok: run: gitaly: (pid 18182) 1s
 ok: run: gitlab-monitor: (pid 18190) 0s
 ok: run: gitlab-workhorse: (pid 18193) 1s
 ok: run: logrotate: (pid 18201) 0s
 ok: run: nginx: (pid 18210) 0s
 ok: run: node-exporter: (pid 18212) 0s
 ok: run: postgres-exporter: (pid 18232) 0s
 ok: run: postgresql: (pid 18241) 0s
 ok: run: prometheus: (pid 18251) 0s
 ok: run: redis: (pid 18256) 1s
 ok: run: redis-exporter: (pid 18261) 0s
 ok: run: sidekiq: (pid 18273) 0s
 ok: run: unicorn: (pid 18278) 1s

To check the status of Nginx

# gitlab-ctl status nginx

The output below:

 run: nginx: (pid 18210) 55s; run: log: (pid 12818) 2487s


Through this article, you have installed GitLab server on Linux with distros centos or ubuntu server.

You have successfully installed GitLab on Linux. You can now create users, and repositories, and start using GitLab for your version control needs.

I hope this will be helpful for you! Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

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