GitLab 社群版安裝與漢化方法
1、GitLab 安裝
1.1 安裝並配置必要的依賴關係
在 CentOS 系統上,下面的命令將會開啟系統防火牆 HTTP 和 SSH 的訪問。
-
yum install -y curl policycoreutils-python openssh-server
-
systemctl enable sshd
-
systemctl start sshd
-
firewall-cmd --permanent --add-service=http
-
systemctl reload firewalld
使用 Postfix 傳送郵件
-
yum install postfix
-
systemctl enable postfix
-
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 倉庫
-
git clone https://gitlab.com/xhang/gitlab.git # 克隆漢化版本庫
-
git fetch # 如果已經克隆過,則進行更新
2.3 比較漢化標籤和原標籤,匯出 patch 用的 diff 檔案
-
cd gitlab
-
git diff v10.1.1 v10.1.1-zh > ../v10.1.1-zh.diff
2.4 上傳v10.1.1-zh.diff 檔案到伺服器
-
gitlab-ctl stop
-
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