简单易行!CentOS 7上安装GitLab社区版的教程

 一、环境准备
操作系统:CentOS 7(最小化安装,从www.centos.org下载的CentOS-7-x86_64-Minimal-1708.iso镜像)
CPU:2核
内存:6G
1.1 更换阿里云Yum源(个人习惯)
步骤:
1)安装wget
yum install -y wget

2)备份默认的Yum源

mv /etc/yum.repos.d /etc/yum.repos.d.backup

3)设置新的Yum源目录

mkdir /etc/yum.repos.d

4)下载阿里云Yum配置文件到该目录

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

5)重建缓存

yum clean all
yum makecache

6)升级所有包(改变软件设置和系统设置,包括系统版本和内核,需要一些时间,请耐心等待)

yum update -y

1.2 安装Vim(个人习惯,非必要)

yum install -y vim
二、获取GitLab汉化包(如果要部署非汉化版,可以跳过此部分)
说明:GitLab中文社区版项目v7-v8.8由Larry Li发起(https://gitlab.com/larryli/gitlab),从v8.9开始,@xhang接手该汉化项目(https://gitlab.com/xhang/gitlab)。
2.1 安装Git
yum install -y git

2.2 克隆获取汉化版本库
下载最新的汉化包

git clone https://gitlab.com/xhang/gitlab.git

如果要下载旧版本的汉化包,请在上述命令后加上旧版本的分支。例如,如果今天是10.0.4版本,但你仍想下载10.0.2版本,可以运行以下命令:

git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh

2.3 查看汉化补丁的版本
 

cat gitlab/VERSION
 三、部署社区版GitLab
3.1 安装GitLab的依赖项:
yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python

3.2 启动Postfix,并设置为开机启动:

systemctl start postfix
systemctl enable postfix

3.3 设置防火墙:

firewall-cmd --add-service=http --permanent
firewall-cmd --reload

3.4 获取GitLab的RPM包:
途径1:通过清华开源镜像站下载对应版本的RPM包
途径2:从官方下载RPM包后上传至/root目录下(官方下载链接:https://packages.gitlab.com/gitlab/gitlab-ce/)
3.5 安装RPM包:

rpm -i gitlab-ce-10.0.2-ce.0.el7.x86_64.rpm

根据提示,继续执行指令配置GitLab:

gitlab-ctl reconfigure

3.6 修改配置文件gitlab.rb:

vim /etc/gitlab/gitlab.rb

将external_url变量的地址修改为GitLab所在CentOS的IP地址。由于修改了配置文件,需要重新加载配置内容:

gitlab-ctl reconfigure
gitlab-ctl restart

3.7 查看GitLab版本:

head -1 /opt/gitlab/version-manifest.txt
四、覆盖汉化包
4.1 停止GitLab服务:
gitlab-ctl stop

4.2 切换到GitLab汉化包所在的目录(即步骤二获取的汉化版GitLab):

cd /root/gitlab

4.3 比较汉化标签和原标签,导出patch用的diff文件到/root下:

git diff v版本 v版本-zh > ../版本-zh.diff

4.4 回到/root目录:

cd

4.5 安装patch软件包:

yum install patch -y

4.6 回到/opt/gitlab/embedded/service/gitlab-rails目录:

cd /opt/gitlab/embedded/service/gitlab-rails

4.7 应用补丁文件:

patch -p1 < /root/版本-zh.diff
五、GitLab启停相关操作:
 
启动服务:gitlab-ctl start
查看状态:gitlab-ctl status
停止服务:gitlab-ctl stop
重启服务:gitlab-ctl restart
使配置生效:gitlab-ctl reconfigure

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

正义的卓别林

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值