为了便于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了
界面应该相似这样: