How Do You Install GitLab on a CentOS/RHEL/Fedora Server?

Problem scenario
You want to install GitLab on a Red Hat derivative of Linux. What should you do?

1. Get a CentOS/RHEL/Fedora Linux server with either 3.5 GB of RAM or at least 1.5 GB of RAM and 2 GB of virtual memory. If you need to add more memory (e.g., to an AWS EC-2 instance or a physical on-premise server), this posting can help you.

2. Run these commands from the backend of the Linux server:

yum install -y postfix 
service postfix start
chkconfig postfix on
lokkit -s http -s ssh
yum install -y curl openssh-server cronie

3. Create a file with this command: sudo vi /etc/yum.repos.d/gitlab-ce.repo
Use the content below:


4. Run these commands:

sudo yum -y makecache
sudo yum -y upgrade
sudo yum -y update
sudo yum -y install policycoreutils-python-utils

5. Run a modified version of command. Substitute x.x.x.x with the external IP address of your server or the URL you want to access via a web browser when the process is finished:

sudo EXTERNAL_URL="http://x.x.x.x" yum -y install gitlab-ce --nobest

6. Run this command: sudo gitlab-ctl reconfigure
If you see "Chef Client finished…" proceed to the next step. If you see "Chef Client failed…" then run this again: sudo gitlab-ctl reconfigure

7. Find a file, back it up, and modify it.
7.a. Run this command: sudo find / -name engine.rb | grep bcrypt
7.b. Back up the file that is found. (e.g., copy /opt/gitlab/embedded/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11/lib/bcrypt/engine.rb somewhere else)
7.c. Modify the file that is found. Replace line 57 which should look like this when you first find it:

__bc_crypt(secret.to_s, salt)

with this line:

__bc_crypt(secret.to_s, salt).gsub(/(\n|\x00).*/, '')

(This step was adapted from this posting.)

8. Reboot the server.

9. With a web browser go to the web UI over port 80. Click on "Register". You will be prompted to create a new password. Remember this password.

10. Log into the web UI.

Leave a comment

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