51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

CentOS7.5安装Gitlab11.0及汉化

Gitlab11.0增加了两个强大的工具Auto DevOps和License Management,具体细节查看Gitlab11.0官方公告:https://about.gitlab.com/2018/06/22/gitlab-11-0-released/

本文以Centos7.5为例安装Gitlab新版本11.0并汉化

1、添加gitlab源(我这里使用了清华大学的源)
vi /etc/yum.repos.d/gitlab-ce.repo

|---|------------------------------------| | 1 | vi /etc/yum.repos.d/gitlab-ce.repo |


[gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever gpgcheck=0 enabled=1

|-----------|---------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 | [gitlab-ce] name=gitlab-ce baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever gpgcheck=0 enabled=1 |

2、安装gitlab
yum -y install openssh-server cronie git wget patch gitlab-ce-11.0.1

|---|----------------------------------------------------------------------| | 1 | yum -y install openssh-server cronie git wget patch gitlab-ce-11.0.1 |

3、初始化gitlab
gitlab-ctl reconfigure

|---|------------------------| | 1 | gitlab-ctl reconfigure |

4、查看服务
gitlab-ctl status

|---|-------------------| | 1 | gitlab-ctl status |

5、重启、停止或启动服务
gitlab-ctl restart/stop/start

|---|-------------------------------| | 1 | gitlab-ctl restart/stop/start |

安装完成,可以通过浏览器访问IP测试(如访问不了,请检查iptables、selinux),http://IP

首次访问需要设置密码,默认帐号为root

gitlab汉化

Gitlab中文社区版地址:https://gitlab.com/xhang/gitlab

1、克隆版本库
cd /usr/local/src/ git clone https://gitlab.com/xhang/gitlab.git

|-----|------------------------------------------------------------------| | 1 2 | cd /usr/local/src/ git clone https://gitlab.com/xhang/gitlab.git |

2、获取当前Gitlab版本
gitlab_version=$(cat /opt/gitlab/embedded/service/gitlab-rails/VERSION)

|---|-------------------------------------------------------------------------| | 1 | gitlab_version=$(cat /opt/gitlab/embedded/service/gitlab-rails/VERSION) |

3、比较汉化标签和原标签,导出patch用的diff文件
cd /usr/local/src/gitlab git diff v${gitlab_version} v${gitlab_version}-zh > ../${gitlab_version}-zh.diff

|-----|------------------------------------------------------------------------------------------------------------| | 1 2 | cd /usr/local/src/gitlab git diff v${gitlab_version} v${gitlab_version}-zh > ../${gitlab_version}-zh.diff |

4、先停止gitlab
gitlab-ctl stop

|---|-----------------| | 1 | gitlab-ctl stop |

5、导入汉化补丁
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../11.0.1-zh.diff

|---|-----------------------------------------------------------------------------| | 1 | patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < ../11.0.1-zh.diff |

PS:如果出现类似以下内容,则按住回车,一直跳过就行了
can't find file to patch at input line 5 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js |index eb0f06e..73e4833 100644 |--- a/app/assets/javascripts/awards_handler.js |+++ b/app/assets/javascripts/awards_handler.js -------------------------- File to patch:

|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 8 9 10 | can't find file to patch at input line 5 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js |index eb0f06e..73e4833 100644 |--- a/app/assets/javascripts/awards_handler.js |+++ b/app/assets/javascripts/awards_handler.js -------------------------- File to patch: |

6、然后启动gitlab
gitlab-ctl start

|---|------------------| | 1 | gitlab-ctl start |

此时访问http://IP就是中文页面了(启动后马上打开页面可能会显示502,稍等几秒刷新就好了)


赞(0)
未经允许不得转载:工具盒子 » CentOS7.5安装Gitlab11.0及汉化