1. 程式人生 > >安裝gitlab並漢化

安裝gitlab並漢化

依賴 cal main image fail ble git PV pack

簡介:

  GitLab是一個利用Ruby on Rails開發的開源應用程序,實現一個自托管的Git項目倉庫,可通過Web界面進行訪問公開的或者私人項目。

  它擁有與GitHub類似的功能,能夠瀏覽源代碼,管理缺陷和註釋。可以管理團隊對倉庫的訪問,它非常易於瀏覽提交過的版本並提供一個文件歷史庫。

  團隊成員可以利用內置的簡單聊天程序(Wall)進行交流。它還提供一個代碼片段收集功能可以輕松實現代碼復用,便於日後有需要的時候進行查找。

引言:剛從阿裏買的4g的服務器,嘗試裝gitlab

1. 請在代理環境下安裝所需環境依賴組件

  sudo yum install curl policycoreutils openssh-server openssh-clients

  sudo systemctl enable sshd

  sudo systemctl start sshd

  sudo yum install postfix

  sudo systemctl enable postfix

  sudo systemctl start postfix(若出現 Job for postfix.service failed. See ‘systemctl status postfix.service‘ and ‘journalctl -xn‘ for deta

  問題出現在網絡設置,ipv6網段,
  vim /etc/hosts     //註釋掉下面一行
  #::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

  sudo firewall-cmd --permanent --add-service=http(若出現FirewallD is not running

通過systemctl start firewalld開啟防火墻,沒有任何提示即開啟成功。

  sudo systemctl reload firewalld

2. 安裝gitlab安裝包

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

  #註意:如下載失敗提示ca證書問題,請使用curl -k ...... 下載即可

  sudo yum install gitlab-ce

3. 以上步驟完成後,及gitlab安裝就完成了,接下來我們進行相關配置

  vim /etc/gitlab/gitlab.rb

  (1). 配置訪問ip及端口或使用域名

    技術分享圖片

  (2). 配置email郵件發送(此處已163郵箱做示例),其他郵箱可參照:https://docs.gitlab.com/omnibus/settings/smtp.html

    # 配置發送郵箱

    gitlab_rails[‘smtp_enable‘] = true

    gitlab_rails[‘smtp_address‘] = "smtp.163.com"

    gitlab_rails[‘smtp_port‘] = 25

    gitlab_rails[‘smtp_user_name‘] = "smtp [email protected]"

    gitlab_rails[‘smtp_password‘] = "password"

    gitlab_rails[‘smtp_domain‘] = "163.com"

    gitlab_rails[‘smtp_authentication‘] = "login"

    gitlab_rails[‘smtp_enable_starttls_auto‘] = true

    # 修改gitlab配置的發信人

    gitlab_rails[‘gitlab_email_from‘] = "smtp [email protected]"

    user["git_user_email"] = "smtp [email protected]"

  (3). 重啟服務以便應用以上配置

    sudo gitlab-ctl reconfigure

4. 打開網址: http://127.0.0.1 (註:如安裝了Apache占用80端口,請更改Apache的默認端口)

  # 首次需要配置root賬戶密碼

  技術分享圖片

  # 配置完畢後,跳轉至登錄界面,使用賬戶:root 以及剛剛設置的密碼即可正常登錄!

  # 如需配置用戶註冊後需要驗證郵箱才可登錄,使用root賬號登錄後配置

  技術分享圖片

至此gitlab服務器端已經配置完成了!

5.漢化

5.1下載最新的漢化包

git clone https://gitlab.com/xhang/gitlab.git

如果是要下載老版本的漢化包,需要加上老版本的分支,比如今天已經是10.0.4,我依舊想下載10.0.2,可以運行下面的語句

git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh

5.2 查看該漢化補丁的版本

cat gitlab/VERSION

5.3 停止gitlab服務

gitlab-ctl stop

5.4 切換到gitlab漢化包所在的目錄(即步驟二獲取的漢化版gitlab)

cd /root/gitlab

5.6 比較漢化標簽和原標簽,導出 patch 用的 diff 文件到/root下

git diff v10.0.2 v10.0.2-zh > ../10.0.2-zh.diff

5.6回到/root目錄

cd

5.7 將10.0.2-zh.diff作為補丁更新到gitlab中

yum install patch -y
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.2-zh.diff

5.8 啟動gitlab

gitlab-ctl start

5.9 重新配置gitlab

gitlab-ctl reconfigure

至此gitlab已經是漢化版的了!!!!

安裝gitlab並漢化