CentOS6安装gitlab
来源:互联网 发布:马克斯cms采集规则 编辑:程序博客网 时间:2024/06/15 13:49
1、安装和配置必须的依赖
sudo yum install curl openssh-server openssh-clients postfix croniesudo service postfix startsudo chkconfig postfix onsudo lokkit -s http -s ssh
如果运行上面的命令,发现没有安装 lokkit ,那么需要你手动 yum install lokkit
lokkit 可以帮助我们设定 iptables 打开 http 和 ssh
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bashsudo yum install gitlab-ce
这个依赖包有点大,建议用下载工具下载,然后用本地安装sudo yum localinstall3、配置和启动gitlab
sudo gitlab-ctl reconfigure
到这里gitlab就可以正常运行了,如果要自定访问ip或者域名的话,可以修改配置文件vi /etc/gitlab/gitlab.rb
打开后有一行 external_url 的設定改成要對外開放 web 的 url ,例如我可以指定 git.yijiebuyi.com
只想內部使用也可以改成 http://192.168.0.11 这样的内部IP地址.
停止gitlab
gitlab-ctl stop
启动gitlabgitlab-ctl start
GitLab 默认存放目录到 /var/opt/gitlab如果要移动,备份此目录,比较保险的做法是,先停止 GitLab,然后备份目录,最后在重启GitLab
通过gitlab官方源安装好gitlab之后,程序包中会自带一个nginx服务器,gitlab本身消耗系统资源严重,理论上最好单独部署在一台服务器上,但是为了节约成本,也会跟其他服务共用服务器,如果之前机器上就有nginx服务则会冲突,可以修改配置,使用已经存在的nginx。
修改gitlab使用现有nginx服务
修改gitlab.rb配置文件
123456789
# vim /etc/gitlab/gitlab.rb 在配置文件中搜索 /# nginx# nginx['enable'] = true# nginx['client_max_body_size'] = '250m'# nginx['redirect_http_to_https'] = false修改上面配置为falsenginx['enable'] = false
将gitlab生成的nginx配置复制到nginx虚拟主机配置文件夹下
1234567
拷贝配置:# cp /var/opt/gitlab/nginx/conf/gitlab-http.conf /etc/nginx/conf.d/检测配置:# nginx -tnginx: [emerg] unknown log format "gitlab_access" in /etc/nginx/conf.d/gitlab-http.conf:56nginx: configuration file /etc/nginx/nginx.conf test failed
将配置中第13行结尾的gitlab_access去掉,即可完成验证。重启nginx使配置生效。
页面502问题
替换完成后如果出现502问题,查看日志
权限问题
123
# tail -f /var/log/gitlab/nginx/error.log 2015/11/03 15:45:10 [error] 8931#0: *15 connect() to unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socketfailed (13: Permission denied) while connecting to upstream, client: xxx.xxx.xxx.xx, server: git.xxxx.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket:/", host: "git.xxxx.com"
通过nginx日志可以看出,nginx没有访问gitlab的socket权限,修改方式有多种,我的机器上nginx的执行用户是nginx,而socket文件夹为
123456789101112131415
drwxr-x--- 2 git gitlab-www 4096 11月 3 15:57 sockets文件赋权限# chmod -R o+x /var/opt/gitlab/gitlab-rails/sockets or# chmod 755 /var/opt/gitlab/gitlab-rails/sockets将nginx用户加入gitlab-www组# usermod -a -G gitlab-www nginx修改配置# vim /etc/gitlab/gitlab.rb web_server['external_users'] = ['nginx']# web_server['username'] = 'gitlab-www'# web_server['group'] = 'gitlab-www'
gitlab程序未启动的问题
1
2015/11/03 15:41:02 [error] 8931#0: *8 connect() to unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket failed (111: Connection refused) while connecting to upstream, client: 111.161.77.240, server: git.yuzhewo.com, request: "GET / HTTP/1.1", upstream: "http://unix:/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket:/", host: "git.yuzhewo.com"
报错信息为(111: Connection refused)
1
cat /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket 内容为空
怀疑gitlab服务未启动,查询启动日志,发现如下错误
1
[2015-11-03T16:12:06+00:00] ERROR: Cannot allocate memory - fork(2)
原因可能是系统内存不足,无法分配足够内存,导致启动失败,这种情况只能升级服务器配置来解决。
参考链接:
https://about.gitlab.com/downloads/#centos6
http://yijiebuyi.com/blog/49aa7d3793aeafeb77da67a4159ec1aa.html
http://www.yuzhewo.com/2015/11/03/%E4%BF%AE%E6%94%B9gitlab%E4%BD%BF%E7%94%A8%E7%8E%B0%E6%9C%89nginx%E6%9C%8D%E5%8A%A1%E5%8F%8A502%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3/
- Centos6.5 安装 gitlab
- centos6安装GitLab
- centos6.5 安装gitlab
- CentOS6安装gitlab
- CentOS6安装gitlab
- CentOS6 GitLab安装
- centos6/7安装gitlab
- centos6 安装GitLab
- CentOS6.4 安装gitlab
- centOS6.5安装gitLab服务器
- CentOS6.5安装GitLab全过程
- Git整合学习之Gitlab安装(Centos6)
- Centos6.8下gitLab的安装
- CentOS6.3下GitLab+Nginx(SSL)+MySQL+Ruby安装部署
- 在centos6.5中安装 GitLab 全过程和问题记录
- Centos6.8从源码安装Gitlab详细教程
- 阿里云centOS6.8下安装gitlab CE
- centos6安装GitLab全程详解和常见问题解决
- 服务器安全-阿里自研补丁列表整理
- 把Android源码中的密码对转换为keystore的方法
- 解决adb devices 中no permissions问题
- iptables总结脚本
- Android 利用WebViewJavascriptBridge 实现js和java的交互
- CentOS6安装gitlab
- 下载文件,ie,chrome,firfox下处理文件名显示乱码
- Oracle 数据库 字符集修改
- View的源码分析(绘制流程以及刷新机制)
- Hexo在Github中搭建博客系统(4)建菜单写文章
- java 创建数组的三种方式及区别
- 不同的点
- leetcode之Counting Bits
- 双缓冲和单缓存的区别