centOs 服务器上部署企业级 gitlab

centOs 服务器上部署企业级 gitlab

参考gitlab中文官网 https://www.gitlab.cc/downloads/#centos7

1.安装依赖软件

该步骤可以选择性安装

yum -y install policycoreutils openssh-server openssh-clients postfix

2.设置postfix开机自启,并启动,postfix支持gitlab发信功能

该步骤可以省略

systemctl enable postfix && systemctl start postfix

3.下载并安装 gitlab

建议下载到自定义管理文件下

下载地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

# 进入用户目录
user$ cd

# 创建下载目录
user$ mkdir Download

# 进入下载目录
Download$ cd Download

# 下载 gitlab
user$ wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm

# 安装 gitlab
Download$ rpm -i gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm

出现如下信息表示安装成功

### Done ###############################################
#
# You have your MySQL root password in this file:
# /home/git/gitlab/config/database.yml
#
# Point your browser to:
# http://iZwz9aehttqhrnn2ax5noqZ (or: http://<host-ip>)
# Default admin username: admin@local.host
# Default admin password: 5iveL!fe
#
# Flattr me if you like this! https://flattr.com/profile/mattiasohlsson
###

4.修改gitlab配置文件(指定服务器ip和自定义端口)。

注意设置的端口不能被占用,默认是8080端口,如果8080已经使用,请自定义其它端口,并在防火墙设置开放相对应得端口

vim  /etc/gitlab/gitlab.rb

# 设置 external_url 为服务器 IP,并设置端口

external_url "http://loclhost:8083"

5.重置并重启 gitlab

注:在执行下列 shell 脚本时可能因为升级了 gcc 导致 glibc 库 版本落后,请参考文章 centOs 升级 glibc 库

gitlab-ctl reconfigure

gitlab-ctl restart

提示如下信息表示重启成功

ok: run: gitlab-git-http-server: (pid 3922) 1s
ok: run: logrotate: (pid 3929) 0s
ok: run: nginx: (pid 3936) 1s
ok: run: postgresql: (pid 3941) 0s
ok: run: redis: (pid 3950) 0s
ok: run: sidekiq: (pid 3955) 0s
ok: run: unicorn: (pid 3961) 1s
原文地址:https://www.cnblogs.com/jwen/p/8459019.html