Centos7环境搭建私有gitlab仓库并汉化

gitlab rpm包下载地址:https://packages.gitlab.com/gitlab/gitlab-ce?page=1

gitlab 汉化包下载地址:https://gitlab.com/xhang/gitlab.git ##需git clone下载

本次使用的gitlab版本是gitlab11.1.6

 

gitlab对内存比较敏感,如果内存过小会导致404,503错误,官方建议最小内存为4G,本次环境为6G4核心

1.首先安装gitlab所需要的一些依赖包

[root@localhost ~]# yum install -y curl policycoreutils openssh-server openssh-clients postfix

 

1.安装好依赖后安装gitlab rpm包

[root@localhost ~]# ll
total 849408
-rw-------. 1 root root      1246 Feb 24 23:58 anaconda-ks.cfg
-rw-r--r--. 1 root root 441432013 Feb 25 00:08 gitlab-ce-11.1.6-ce.0.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh gitlab-ce-11.1.6-ce.0.el7.x86_64.rpm

2.rpm包安装快慢视服务器质量为准,出现以下提示说明安装成功

Centos7环境搭建私有gitlab仓库并汉化

 

 

3.安装完成后启动postfix,关闭防火墙

[root@localhost ~]# systemctl start postfix && systemctl enable postfix
[root@localhost ~]# iptables -F && systemctl stop firewalld && systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# 

4.进行gitlab初始化,这个时间可能会比较长,会启动很多服务

[root@localhost ~]# gitlab-ctl reconfigure

5.出现以下提示说明配置成功,echo $?也无报错

Centos7环境搭建私有gitlab仓库并汉化

 

 

[root@localhost ~]# echo $?
0

6.gitlab-ctl status查看gitlab状态,全部run

[root@localhost ~]# gitlab-ctl status
run: alertmanager: (pid 11676) 107s; run: log: (pid 11714) 106s
run: gitaly: (pid 11521) 108s; run: log: (pid 11556) 108s
run: gitlab-monitor: (pid 11563) 108s; run: log: (pid 11570) 107s
run: gitlab-workhorse: (pid 11500) 109s; run: log: (pid 11588) 107s
run: logrotate: (pid 10862) 155s; run: log: (pid 11587) 107s
run: nginx: (pid 10753) 161s; run: log: (pid 11586) 107s
run: node-exporter: (pid 11113) 143s; run: log: (pid 11691) 107s
run: postgres-exporter: (pid 11699) 107s; run: log: (pid 11716) 105s
run: postgresql: (pid 10254) 196s; run: log: (pid 11491) 109s
run: prometheus: (pid 11578) 107s; run: log: (pid 11713) 106s
run: redis: (pid 10124) 202s; run: log: (pid 11567) 108s
run: redis-exporter: (pid 11217) 131s; run: log: (pid 11571) 107s
run: sidekiq: (pid 10611) 169s; run: log: (pid 11569) 108s
run: unicorn: (pid 10540) 175s; run: log: (pid 11568) 108s

7.到此为止gitlab的安装就完成了,接下来浏览器访问服务器ip地址,第一次登陆会提示修改密码

Centos7环境搭建私有gitlab仓库并汉化

 

 

输入新密码,密码至少8位数

接下来进行登录,默认用户名root,密码为刚修改过的新密码

Centos7环境搭建私有gitlab仓库并汉化

 

 

登陆成功!

Centos7环境搭建私有gitlab仓库并汉化

 

 

 8.接下来进行汉化操作

git clone汉化地址下载汉化包,这个下载时间会更长          ##汉化包版本需跟gitlab版本对应,否则可能会不起作用

[root@localhost ~]# git clone https://gitlab.com/xhang/gitlab.git

9.下载失败重试几次之后终于无报错下载完成

[root@localhost ~]# git clone https://gitlab.com/xhang/gitlab.git
Cloning into 'gitlab'...
remote: Enumerating objects: 40998, done.
remote: Counting objects: 100% (40998/40998), done.
remote: Compressing objects: 100% (15116/15116), done.
remote: Total 1059432 (delta 27453), reused 35303 (delta 25250), pack-reused 1018434
Receiving objects: 100% (1059432/1059432), 458.83 MiB | 658.00 KiB/s, done.
Resolving deltas: 100% (824561/824561), done.

10.进入汉化包目录下

[root@localhost ~]# cd gitlab
[root@localhost gitlab]#

11.对比源标签与汉化标签的区别,将不同输出至../11.1.6-zh.diff文件

[root@localhost gitlab]# git diff v11.1.6 v11.1.6-zh > ../11.1.6-zh.diff

12.使用patch命令进行文件替换

[root@localhost gitlab]# patch -d /opt/gitlab/embedded/service/gitlab-rails/ -p1</root/11.1.6-zh.diff 

13.随后一路回车替换完成

patching file config/locales/devise.zh_CN.yml
patching file config/locales/doorkeeper.zh_CN.yml
patching file config/locales/sherlock.zh_CN.yml
patching file config/locales/zh_CN.yml
patching file lib/gitlab/access.rb
patching file lib/gitlab/import_sources.rb
patching file lib/gitlab/project_template.rb
patching file lib/gitlab/slash_commands/presenters/issue_base.rb
patching file public/404.html
patching file public/422.html
patching file public/500.html
patching file public/502.html
patching file public/503.html
patching file public/deploy.html

14.gitlab重启

[root@localhost gitlab]# gitlab-ctl restart
ok: run: alertmanager: (pid 32792) 1s
ok: run: gitaly: (pid 32808) 0s
ok: run: gitlab-monitor: (pid 32834) 0s
ok: run: gitlab-workhorse: (pid 32839) 1s
ok: run: logrotate: (pid 32922) 0s
ok: run: nginx: (pid 32928) 1s
ok: run: node-exporter: (pid 32936) 0s
ok: run: postgres-exporter: (pid 32943) 0s
ok: run: postgresql: (pid 32950) 1s
ok: run: prometheus: (pid 32958) 0s
ok: run: redis: (pid 32973) 1s
ok: run: redis-exporter: (pid 32983) 0s
ok: run: sidekiq: (pid 32990) 1s
ok: run: unicorn: (pid 32997) 0s

15.刷新登录,汉化成功

Centos7环境搭建私有gitlab仓库并汉化

 

上一篇:Eclipse's Patching Codes Automatically


下一篇:Java操作Mongodb(转载)