您的位置:首页 > 运维架构 > Linux

阿里云CentOS 6.4搭建Gitlab 6.4(源码安装)

2014-01-17 00:00 531 查看
为了便于Gitlab的后期升级,必须采用源码安装。同步更新在私人博客

官方只对ubuntu系统提供了源码安装说明,CentOS系统的安装采用了以下教程:

CentOS安装Gitlab

安装过程比较繁琐,但是按照教程一步步来是完全没问题的。我安装的时候只在最后部分出了一点问题,场景如下:

在教程第6点的最后部分(在第7点安装web服务器的前面),有一个

Double-check Application Status

输入检测指令:

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,端口等)。

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了

界面应该类似这样:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  gitlab 阿里云 centos