1. Install dependencies
Execute under root user
$: sudo yum install curl openssh-server openssh-clients postfix cronie -y
$: sudo service postfix start
$: sudo chkconfig postfix on
$: sudo lokkit -s http -s ssh
2. Add the Gitlab repository and install it on the server
Version description: This article uses the domestic mirror download and installation method, which is faster than the download speed of foreign websites;
CentOS (kernel 6.x) https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6, select the required version to install.
CentOS (kernel 7.x) https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7, select the required version to install.
$: cd /usr/local/src
$: wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.16.4-ce.0.el6.x86_64.rpm
$: rpm -ivh gitlab-ce-8.16.4-ce.0.el6.x86_64.rpm
3.gitlab-ce settings
New /etc/yum.repos.d/gitlab-ce.repo
$: vim /etc/yum.repos.d/gitlab-ce.repo
// 添加如下内容
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
$: sudo yum makecache
$: sudo yum install gitlab-ce
4. Create the gitlab.rb configuration file
$: sudo mkdir -p /etc/gitlab
$: sudo touch /etc/gitlab/gitlab.rb
$: sudo chmod 600 /etc/gitlab/gitlab.rb
5. Add the IP address for web access
$: vim /etc/gitlab/gitlab.rb
// 添加一下内容
external_url 'http://192.168.1.XXX' # 部署Gitlab的主机IP
6. Modify the /var/opt/gitlab/gitlab-rails/etc/gitlab.yml file
$: vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
// 修改如下蓝色标出的参数为部署的主机IP
## GitLab settings gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 192.168.1.XXX
port: 80
https: false
## Email settings
# Uncomment and set to false if you need to disable email sending from GitLab (default: true)
email_enabled:
# Email address used in the "From" field in mails sent by GitLab
email_from: [email protected]
email_display_name:
email_reply_to:
email_subject_suffix:
7. Start Gitlab
$: sudo gitlab-ctl reconfigure
Note: Each time the configuration file is modified, it needs to take effect again, execute sudo gitlab-ctl reconfigure
Relevant commands (for reference by installers):
$: sudo gitlab-ctl start # gitlab启动
$: sudo gitlab-ctl restart # gitlab重启
$: sudo gitlab-ctl stop # gitlab停止
$: sudo gitlab-ctl status # gitlab状态
Related error: $: gitlab-ctl: command not found
Solution: $: ln -s /opt/gitlab/bin/gitlab-ctl /usr/bin/gitlab-ctl
8. Open the browser and log in to Gitlab
The browser address is Gitlab's host address 192.168.1.XXX;
The first time you open it, it will redirect you to modify the administrator password. The administrator account: root, and the new password cannot be less than 8 digits;
After setting, use the administrator account and password to enter.