爲了便於Gitlab的後期升級,必須採用源碼安裝。同步更新在私人博客git
官方只對ubuntu系統提供了源碼安裝說明,CentOS系統的安裝採用瞭如下教程:github
安裝過程比較繁瑣,可是按照教程一步步來是徹底沒問題的。我安裝的時候只在最後部分出了一點問題,場景以下:shell
在教程第6點的最後部分(在第7點安裝web服務器的前面),有一個ubuntu
Double-check Application Statuscentos
輸入檢測指令:ruby
bundle exec rake gitlab:check RAILS_ENV=production
可是檢測結果顯示Gitlab-Shell沒有鏈接到Gitlab。服務器
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Network is unreachable - connect(2) (Errno::ENETUNREACH)
from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
from /home/git/gitlab-shell/lib/gitlab_net.rb:29:in `check'
from /home/git/gitlab-shell/bin/check:11:in `<main>'
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.網絡
分析錯誤,有提到Network is unreachable 。那說明網絡不通,Gitlab-Shell經過http調用gitlab的API,那多是配置的API接口不對(ip,端口等)。tcp
gitlab的配置依賴於三個文件
/home/git/gitlab/config/unicorn.rb:配置ruby提供的服務端口,ip
/home/git/gitlab/config/gitlab.yml:配置gitlab服務的端口,ip
/home/git/gitlab-shell/config.yml:配置gitlab-shell要調用的API接口
這三個文件的配置要保持一致,只須要更改ip和端口就能夠了,其餘不用動。
個人配置以下:
unicorn.rb:第40行改爲
listen "115.28.21.20:8000", :tcp_nopush => true
gitlab.yml:第18行和第19行改爲
host: 115.28.21.20
port: 8000
config.yml:第5行改爲
gitlab_url: "http://localhost:8000/"
完成!
再檢測一次,輸入檢測指令:
bundle exec rake gitlab:check RAILS_ENV=production
gitlab-shell應該會正確鏈接到gitlab,檢測結果爲yes。
另外第7條是web服務器的安裝,是經過web服務器進行轉發,能夠不用安裝。安裝到第6條結束便可。
此時經過外網地址115.28.21.20:8000就能夠訪問你的gitlab了
界面應該相似這樣: