Gitlab的安裝漢化及問題解決


Gitlab的安裝漢化及問題解決(2017/12/14目前版本為10.2.4)

一、前言

  Gitlab需要安裝的包太TM多了,源碼安裝能愁死個人,一直出錯,后來發現幾行命令就裝的真是遇到的新大陸一樣... ... 

   裝完之后感覺太簡單,加了漢化補丁,因為要用於線上環境順手關了注冊登錄,保存發現關錯了...作死今天上午才弄好,詳情見下文

二、安裝

  可以rpm安裝下載地址:清華開源網站鏡像站

  或者看下圖...還用寫么... ...centos6版

 

  截圖不好復制,我來插入一下

  

#sudo是獲取root權限的,用root用戶搭就不用了 yum install -y curl policycoreutils-python openssh-server cronie lokkit -s http -s ssh


yum install postfix service postfix start chkconfig postfix on curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | bash
 EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ee

  官網還有ubuntu,docker等的安裝方式,地址為:

https://about.gitlab.com/installation/#centos-6
官網地址

 

  寫完上面那些就安裝完成了,再來更新下配置

#先修改個域名,改成自己的域名解析的地址,沒有先不改也可以,我開始沒改也沒錯。 #有說改成自己本機ip的,然后出錯的話在external_url和ip直接加等號(沒試,用的域名) vim /etc/gitlab/gitlab.rb external_url 'http://gitlab.****.com' #更新配置 gitlab-ctl reconfigure #查看狀態 gitlab-ctl status #重啟 gitlab-ctl restart ok: run: gitaly: (pid 24115) 0s ok: run: gitlab-monitor: (pid 24131) 1s ok: run: gitlab-workhorse: (pid 24147) 0s ok: run: logrotate: (pid 24165) 1s ok: run: nginx: (pid 24171) 0s ok: run: node-exporter: (pid 24180) 1s ok: run: postgres-exporter: (pid 24192) 0s ok: run: postgresql: (pid 24211) 0s ok: run: prometheus: (pid 24227) 1s ok: run: redis: (pid 24279) 0s ok: run: redis-exporter: (pid 24283) 1s ok: run: sidekiq: (pid 24298) 0s ok: run: unicorn: (pid 24303) 1s #關閉 gitlab-ctl stop #啟動 gitlab-ctl start #監控 gitlab-ctl tail unicorn 監控unicorn日志 gitlab-ctl tail
 
        

起來之后訪問自己的網站地址或者ip,首先讓輸入的是密碼,這個是administrator管理員用戶的密碼,下面是我搭好的的首頁,漢化了,去掉了自動注冊,在下面說

三、漢化

  Gitlab漢化需要看一下版本號

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

  10.2.4-ee

 

 

1 #11.2.3漢化
2 cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
3 git clone https://gitlab.com/xhang/gitlab.git
4 cd gitlab/
5 git diff v11.2.3 v11.2.3-zh > ../v11.2.3-zh.diff
6 gitlab-ctl stop
7 patch -d /opt/gitlab/embedded/service/gitlab-rails/ -p1 < ../v11.2.3-zh.diff
8 reboot
9 gitlab-ctl status
Gitlab v11.2.3漢化
#這里也是多方總結 git clone https://gitlab.com/xhang/gitlab.git
cd gitlab/ git fetch gitlab-ctl stop git diff origin/10-2-stable origin/10-2-stable-zh > /tmp/10.2.diff cd /opt/gitlab/embedded/service/gitlab-rails git apply /tmp/10.2.diff
patch -d/opt/gitlab/embedded/service/gitlab-rails -p1 < 10.2.diff #這步好像可以不用,我直接打上了 gitlab-ctl reconfigure #啟動 gitlab-ctl start

 

502 哇,Gitlab 響應花費了太多時間。。。11.2.3版本的這個時候,多等等或者重啟之后,再多等等

四、Gitlab關閉自主注冊

  這步要擦亮眼睛擦亮擦亮,關錯了就懵逼了,比如說我,關了sign-in,關了登錄功能,這功能都可以關閉也是沒誰了,給個提醒啊,想改回去時候發現不能登錄。。。

  繼續上圖:

 

慢慢往下找,看到這個了嗎,這個勾沒了就沒有登錄了,不能登錄,聽說重裝都不能登錄哦

這個上面一點,sign-up這個才是要關掉的,第一次關沒注意,下面說下怎么解決的

勾選之后到最后有個save保存生效

 

如果不幸勾選錯誤No authentication methods configured.如圖所示:

 

 舊版解決方法:

gitlab-psql gitlabhq_production could not change directory to "/root": Permission denied psql (9.6.5) Type "help" for help. update application_settings SET signin_enabled=true; UPDATE 1 gitlabhq_production=# \q gitlab-ctl restart

 

如果出現下面錯誤用新版的
ERROR: column "signin_enabled" of relation "application_settings" does not exist
LINE 1: update application_settings SET signin_enabled=true;

因為這個版本還有 signup_enabled可以在數據庫關掉自主注冊,但是沒有 signin_enabled這個了,有這個東西sign_in_text_html,可以在首頁左中空白位置寫內容

新版解決方法:

gitlab-psql gitlabhq_production could not change directory to "/root": Permission denied psql (9.6.5) Type "help" for help. gitlabhq_production=# update application_settings set password_authentication_enabled = true; UPDATE 1 gitlabhq_production=# \q gitlab-ctl restart
折疊方法

gitlab-psql gitlabhq_production
could not change directory to "/root": Permission denied
psql (9.6.5)
Type "help" for help.

gitlabhq_production=# update application_settings set password_authentication_enabled = true;
UPDATE 1
gitlabhq_production=# \q
gitlab-ctl restart

五、總結

  安裝gitlab除了自己眼瘸了一下沒有遇到其他的錯誤,看有的錯誤是因為安裝過程中端口被占用

  yum install -y lsof 

  lsof -i:80

  lsof -i:8080

gitlab-ctl tail unicorn這個監控命令也很好用

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM