阿里云服务器centos7.4 gitlab搭建方法以及我所遇到的502问题

阿里云服务器centos7.4 gitlab搭建方法以及我所遇到的502问题

搭建步骤

环境:阿里云主机(CPU: 1核 内存:2 GB (I/O优化) 1Mbps),系统:centos7.4。

  1. 下载gitlib安装包,下载地址:https://packages.gitlab.com/gitlab/gitlab-ce
    https://packages.gitlab.com/gitlab/gitlab-ce
    也可以使用curl下载(几百兆下下来太慢,放弃) :
    curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

  2. 下载完成后使用ftp工具上传到服务器;
    我使用的是filezilla(下载地址:https://filezilla-project.org/),直接上传到了云主机opt目录

  3. 安装gitlab;
    命令:
    sudo yum install -y curl policycoreutils-python openssh-server
    sudo systemctl enable sshd
    sudo systemctl start sshd
    sudo firewall-cmd --permanent --add-service=http
    sudo systemctl reload firewalld
    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix
    sudo rpm -ivh /opt/gitlab-ce-11.3.12-ce.0.el7.x86_64.rpm
    结果图:
    在这里插入图片描述
    安装完成后,重启

  4. 初始化配置;
    命令:
    gitlab-ctl reconfigure
    结果图:
    在这里插入图片描述

  5. 开启gitlab;
    命令:
    gitlab-ctl start
    结果图:
    在这里插入图片描述

  6. 修改端口;
    cd var/opt/gitlab/nginx/conf
    vim gitlab-http.conf
    在这里插入图片描述
    我把80端口修改成8084 因为80端口已经占用
    同时阿里云控制台网络安全组开放8084端口
    完毕后浏览器访问ip:port应该可以进入gitlab登陆页面

遇到的问题

访问出现502错误,有两种可能性
1:建议查看8080端口是否被占用!
如果是被占用:
在etc/gitlab/gitlab.rb文件下加入unicorn[‘port’] =8088 ,我的8088这个端口号没被占用
保存退出!
2:原因是gitlab占用内存太多,导致服务器崩溃(我才2g的内存)
解决方案:
使用swap分区(https://yq.aliyun.com/articles/52098)
本图来源:https://yq.aliyun.com/articles/52098
gitlab常见错误解决办法
1 fail: gitlab-workhorse: runsv not running

systemctl start gitlab-runsvdir.service

systemctl status gitlab-runsvdir.service

gitlab-ctl start

2 Whoops, GitLab is taking too much time to respond.

内存小了,内存至少要2G才行。

3 刚刚安装的gitlab的管理员账户是admin@example.com

第一次设置的密码就是这个账户的密码。

4 服务器ip修改后,project页面的ip做相应修改的方法

cd /opt/gitlab/embedded/service/gitlab-rails/config

gitlab.yml

gitlab-ctl restart

        </div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值