1. 程式人生 > >GitLab 社群版安裝與漢化方法

GitLab 社群版安裝與漢化方法

1、GitLab 安裝

1.1 安裝並配置必要的依賴關係

在 CentOS 系統上,下面的命令將會開啟系統防火牆 HTTP 和 SSH 的訪問。

  1. yum install -y curl policycoreutils-python openssh-server

  2. systemctl enable sshd

  3. systemctl start sshd

  4. firewall-cmd --permanent --add-service=http

  5. systemctl reload firewalld

使用 Postfix 傳送郵件

  1. yum install postfix

  2. systemctl enable postfix

  3. systemctl start postfix

1.2 新增 GitLab 映象源並安裝

新增映象源,或手動下載安裝包

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash

安裝

yum install -y gitlab-ce

如果為下載的rpm包,使用如下命令安裝

rpm -i gitlab-ce-XXX.rpm

1.3 修改地址

vim /etc/gitlab/gitlab.rb

external_url

改為對應的地址和埠

1.4 配置並啟動 GitLab

gitlab-ctl reconfigure

1.5 通過瀏覽器訪問上一步配置的域名

系統預設的管理員賬號為 root, 第一次訪問 GitLab,系統會重定向 url 到重置密碼的頁面,需要輸入初始化管理員賬號的密碼。 設定完成後,系統會重定向到登入介面,你就可以使用剛才輸入的密碼登入系統了。

2、GitLab 漢化

2.1 確認當前版本

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

假設當前版本為 v10.1.1,並確認漢化版本庫是否包含該版本的漢化標籤(-zh結尾),也就是是否包含v10.1.1-zh。

2.2 在本地 clone 倉庫

  1. git clone https://gitlab.com/xhang/gitlab.git # 克隆漢化版本庫

  2. git fetch # 如果已經克隆過,則進行更新

2.3 比較漢化標籤和原標籤,匯出 patch 用的 diff 檔案

  1. cd gitlab

  2. git diff v10.1.1 v10.1.1-zh > ../v10.1.1-zh.diff

2.4 上傳v10.1.1-zh.diff 檔案到伺服器

  1. gitlab-ctl stop

  2. patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < v10.1.1-zh.diff

2.5 確定沒有 .rej 檔案,重啟 GitLab 即可

gitlab-ctl start

2.6 執行重新配置命令

gitlab-ctl reconfigure