由于汉化版本都低于英文版本,为了不产生不必要的麻烦就要先下载汉化包,查看汉化包的版本号,根据汉化包的版本号来安装制定版本的GitLab。若你安装的版本是最新的比汉化包高太多,那么你汉化时需要忽略数百到上千次的文件。并且还要执行sudo touch /etc/gitlab/skip-auto-migrations然后才能刷新配置。
1、下载最新的汉化包
git clone https://gitlab.com/xhang/gitlab.git
2、备份系统
gitlab-rake gitlab:backup:create Dumping database ... Dumping PostgreSQL database gitlabhq_production ... [DONE] done Dumping repositories ... done Dumping uploads ... done Dumping builds ... done Dumping artifacts ... done Dumping pages ... done Dumping lfs objects ... done Dumping container registry images ... [DISABLED] Creating backup archive: 1543827787_2018_12_03_11.4.8_gitlab_backup.tar ... done Uploading backup archive to remote storage ... skipped Deleting tmp directories ... done done done done done done done done Deleting old backups ... skipping [root@localhost ~]# cd /var/opt/gitlab/backups [root@localhost backups]# ls 1543822805_2018_12_03_11.4.7_gitlab_backup.tar 1543827787_2018_12_03_11.4.8_gitlab_backup.tar [root@localhost backups]# rm -rf 1543822805_2018_12_03_11.4.7_gitlab_backup.tar [root@localhost backups]# ls 1543827787_2018_12_03_11.4.8_gitlab_backup.tar [root@localhost backups]#
去备份目录产看备份的文件
[root@localhost gitlab]# cd /var/opt/gitlab/backups [root@localhost backups]# ls 1543822805_2018_12_03_11.4.7_gitlab_backup.tar db
3、停止GitLab
sudo gitlab-ctl stop
4、切换到汉化包的路径,生成差异文件
[root@localhost ~]# ls gitlab [root@localhost ~]# cd gitlab [root@localhost gitlab]# cat /opt/gitlab/embedded/service/gitlab-rails/VERSION 11.5.0 [root@localhost gitlab]# git diff v11.5.0 v11.4.7-zh >../v11.4.7-zh.diff [root@localhost gitlab]# cd .. [root@localhost ~]# ls gitlab v11.4.7-zh.diff
5、安装yum
root@localhost gitlab]# yum install -y patch 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.aliyun.com * updates: mirrors.163.com 正在解决依赖关系 已安装: patch.x86_64 0:2.7.1-10.el7_5 完毕!
6、执行汉化命令进行汉化
[root@localhost gitlab]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../v11.4.7-zh.diff bash: patch: 未找到命令...
若出现下面汉化时的报错,说明你没有安装yum。
root@localhost gitlab]# patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../v11.4.7-zh.diff patching file .eslintrc.yml patching file .gitattributes can't find file to patch at input line 113 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff --git a/.gitignore b/.gitignore |index aecaae9..82b3d08 100644 |--- a/.gitignore |+++ b/.gitignore -------------------------- File to patch:
这是因为补丁中有一些较新的文件,但是我们安装的gitlab并没有这个文件存在。解决方法就是无数的回车和跳过。
7、忽略配置文件的冲突,并刷新配置
sudo touch /etc/gitlab/skip-auto-migrations sudo gitlab-ctl reconfigure
8、启动服务。
若用命令sudo gitlab-ctl status
查看服务状态是停止就执行启动命令。
sudo gitlab-ctl start
若用命令sudo gitlab-ctl status
查看服务状态是运行状态就执行重启命令sudo gitlab-ctl restart
;也可以先停止sudo gitlab-ctl stop
,再启动sudo gitlab-ctl start
。
9、打开GitLab服务器主页
http://192.168.1.156:8888/users/sign_in