GitLab provides an open-source, self-hosted Git repository management platform built on Ruby on Rails. Accessible through a web interface, it supports both public and private projects while offering source code review, issue tracking, access control, and code snippet management.
System Requirements
Allocate at least 4 GB of RAM for the GitLab instance.
Repository Configuration
Create /etc/yum.repos.d/gitlab-ce.repo with the following content:
[gitlab-ce]
name=GitLab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
Dependancy Installation
Install the required system packages:
yum install -y curl policycoreutils-python openssh-server
Start and enable Postfix:
systemctl start postfix
systemctl enable postfix
If the system runs firewalld, open the HTTP service:
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
Package Installlation
Download the target RPM from the Tsinghua mirror:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm
Install the package:
rpm -ivh gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm
Execute the initial configuration:
gitlab-ctl reconfigure
Network Configuration
Open /etc/gitlab/gitlab.rb in an editor:
vim /etc/gitlab/gitlab.rb
Update external_url to reflect the host's IP address or fully qualified domain name. Then reload the configuration:
gitlab-ctl reconfigure
gitlab-ctl restart
Confirm the installed version:
head -1 /opt/gitlab/version-manifest.txt
Localization Patch
The community localization project is maintained at https://gitlab.com/xhang/gitlab.
Install Git:
yum install -y git
Clone the localized repository. For the latest translations:
git clone https://gitlab.com/xhang/gitlab.git
To match a specific release such as v10.0.2, clone the associated branch:
git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh
Validate the patch version:
cat gitlab/VERSION
Applying the Patch
Stop GitLab services:
gitlab-ctl stop
Switch to the localization source directory:
cd /root/gitlab
Produce the differential file between the official and localized tags:
git diff v10.0.2 v10.0.2-zh > /root/10.0.2-zh.diff
Return to /root and install the patching tool:
cd /root
yum install -y patch
Apply the diff to the embedded Rails service:
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.2-zh.diff
Bring GitLab back online and reconfigure:
gitlab-ctl start
gitlab-ctl reconfigure
Administrator Access Setup
The built-in administrator username is root. Note that while the account may display as Administrator inside the application, the login username remains root.
Web Enterface:
Open the server's IP address in a browser and define the initial password on the landing page.
Rails Console:
Launch the production console:
gitlab-rails console production
Update the root credentials directly:
root_user = User.where(admin: true).first
root_user.password = 'your_password'
root_user.password_confirmation = 'your_password'
root_user.save!
exit