欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

快速部署 Gitlab 并实现中文界面汉化指南

最编程 2024-02-16 12:45:42
...

使用清华大学开源软件镜像,https://mirrors.tuna.tsinghua.edu.cn/help/gitlab-ce/ 加快安装速度。

安装

Debian/Ubuntu 用户

首先信任 GitLab 的 GPG 公钥:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null

再选择你的 Debian/Ubuntu 版本,文本框中内容写进 /etc/apt/sources.list.d/gitlab-ce.list

你的Debian/Ubuntu版本:

  • Debian7(Wheezy)
    deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian wheezy main

  • Debian 8 (Jessie)
    deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/debian jessie main

  • Ubuntu 14.04 LTS
    deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu trusty main

  • Ubuntu 16.04 LTS
    deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main

  • 安装 gitlab-ce:
sudo apt-get install gitlab-ce```



######CentOS/RHEL
新建 ``/etc/yum.repos.d/gitlab-ce.repo``,内容为

你的CentOS/RHEL版本:   
- CentOS 6
`[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key`

- CentOS 7
`[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key`

- RHEL 6
`[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key`

- RHEL 7
`[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key`

再执行
`sudo yum makecache
sudo yum install gitlab-ce`


# 初始化,初始化完自动启动 GitLab
`sudo gitlab-ctl reconfigure`


# 汉化
1. 拉取汉化资源

克隆 GitLab.com 仓库

8.8版本及以下
git clone https://gitlab.com/larryli/gitlab.git
8.8版本以上
git clone https://gitlab.com/xhang/gitlab.git


2. 运行运行汉化
用命令行 cd 到上一步的目录
用 `git branch -a` 查看分支 
![QQ20170123-124236@2x.png](http://upload-images.jianshu.io/upload_images/1658993-2092564003c35298.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
**我的版本  8.15.5  所以用的是 8-15-stable 和 8-15-stable-zh 这两个分支 ** 
**` sudo git diff origin/8-15-stable origin/8-15-stable-zh > ~/8.15.diff` **
  - git diff 是对比 两个分支的不同 
  - 8-15-stable  是英文分支
  - 8-15-stable-zh 是汉化分支
  - ~/8.15.diff  导出我们需要的汉化文件 

3. 把导出的 8.15.diff 上传到服务器
4. 停止 gitlab
``sudo gitlab-ctl stop``
5.  应用汉化补丁
```cd /opt/gitlab/embedded/service/gitlab-rails
git apply /tmp/8.5.diff  ```
6. 启动gitlab
```sudo gitlab-ctl start```

现在可以 打开你的 Gitlab 看一下汉化后的效果了.