gitlab安装介绍:https://about.gitlab.com/downloads/#centos7
原文地址:http://blog.csdn.net/yulei_qq/article/details/53134654
最近使用GitLab 搭建了Git的私有仓库,但是发现私有仓库的地址居然是localhost,不是本机的IP地址,最后百度了一下,找了很久才找到,特此记录一下.
首先说明一下,我Linux虚拟机的IP地址是192.168.142.134.
1、在GitLab上新建一个项目test_gitlab,刚开始仓库地址是http://localhost/yulei/test_gitlab.git .
把localhost 换成本机的IP地址,修改方式如下:
修改gitlab.yml文件:
- [root@localhost config]# cd /opt/gitlab/embedded/service/gitlab-rails/config
2、修改gitlab.yml文件
- [root@localhost config]# vim gitlab.yml
- [root@localhost config]# vim gitlab.yml
3、重启GitLab
- gitlab-ctl restart
在浏览器中访问GitLab出现
502
错误原因:内存不足。
解决办法:检查系统的虚拟内存是否随机启动了,如果系统无虚拟内存,则增加虚拟内存,再重新启动系统。
80
端口冲突原因:Nginx默认使用了
80
端口。解决办法:为了使Nginx与Apache能够共存,并且为了简化GitLab的URL地址,Nginx端口保持不变,修改Apache的端口为4040。这样就可以直接用使用ip访问Gitlab。而禅道则可以使用
4040
端口进行访问,像这样:xxx.xx.xxx.xx:4040/zentao
。具体修改的地方在/etc/httpd/conf/httpd.conf
这个文件中,找到Listen 80
这一句并将之注释掉,在底下添加一句Listen 4040
,保存后执行service httpd restart
重启apache服务即可。#Listen 80 Listen 4040
8080
端口冲突原因:由于unicorn默认使用的是
8080
端口。解决办法:打开
/etc/gitlab/gitlab.rb
,打开# unicorn['port'] = 8080
的注释,将8080
修改为9090
,保存后运行sudo gitlab-ctl reconfigure
即可。STMP设置
配置无效,暂时不知道原因。
GitLab头像无法正常显示
原因:gravatar被墙
解决办法:
编辑/etc/gitlab/gitlab.rb
,将#gitlab_rails['gravatar_plain_url'] = 'http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon'
修改为:
gitlab_rails['gravatar_plain_url'] = 'http://gravatar.duoshuo.com/avatar/%{hash}?s=%{size}&d=identicon'
然后在命令行执行:
sudo gitlab-ctl reconfigure
sudo gitlab-rake cache:clear RAILS_ENV=production
重启gitlab命令
读了脚本以后,可以这样操作:
1. gitLab重启服务
root@AY14061309211937343aZ:/opt/gitlab-7.8.1-0# ./ctlscript.sh restart
2. gitLab的启动,停止等服务,只需替换参数即可
下面这两个分别是启动,去停止的命令
root@AY14061309211937343aZ:/opt/gitlab-7.8.1-0# ./ctlscript.sh start
root@AY14061309211937343aZ:/opt/gitlab-7.8.1-0# ./ctlscript.sh stop