阿里云 CentOS 7.5安装 GitLab

1.服务器配置

由于运行gitlab需要1.5G内存,因此最低配置:CPU:2核(至少),内存:4G

2.防火墙配置

# 查看状态
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# systemctl status firewalld
# 停止
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# systemctl disable firewalld
# 禁用
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# systemctl stop firewalld

3.安装GitLab依赖包

[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# yum install -y curl policycoreutils-python openssh-server postfix
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# systemctl enable postfix
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# systemctl start postfix

启动postfix时会遇到以下错误:

/usr/sbin/postconf: fatal: parameter inet_interfaces: no local interface found for ::1

解决方法:

[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# vi /etc/postfix/main.cf
# 将以下 localhost 改为 all
# inet_interfaces = localhost
inet_interfaces = all
inet_protocols = all

[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# systemctl start postfix

4.下载rpm包到本地

# 使用清华大学的镜像,可以进入 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7 查看最新版本
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.8.1-ce.0.el7.x86_64.rpm

5.安装 GitLab RPM包

[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# rpm -i gitlab-ce-12.8.1-ce.0.el7.x86_64.rpm

6.配置自定义GitLab端口(非常重要!!!)

由于阿里云每个自定义端口都需要在安全组配置,否则将会出现不能访问的问题!
在这里插入图片描述

7.修改端口

# 先备份 gitlab.rb
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.bak
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# vi /etc/gitlab/gitlab.rb
...
nginx['listen_port'] = 83
unicorn['port'] = 8083
nginx['redirect_http_to_https_port'] = 83
...

# 先备份 gitlab-http.conf
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# cp /var/opt/gitlab/nginx/conf/gitlab-http.conf /var/opt/gitlab/nginx/conf/gitlab-http.conf.bak
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# vi [root@iZ8vb2zp3hb2pskrfnjcrbZ ~]#
...
server {
  listen *:83;
}

# 先备份
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# cp /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /var/opt/gitlab/gitlab-rails/etc/unicorn.rb.bak
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# vi /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
# 修改端口
listen “127.0.0.1:8083”, :tcp_nopush => true

# 保存配置
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# gitlab-ctl reconfigure
# 重启
[root@iZ8vb2zp3hb2pskrfnjcrbZ ~]# gitlab-ctl restart

8.重启验证

重启后,在浏览器输入 http://域名:83 或者 http://IP地址:83

9.GitLab相关事项

  1. 第一次登录时提示输入root密码,默认是root用户名;

  2. Configure GitLab -> Settings 去掉注册功能:

    去掉勾选 Sign-up enabled

  3. root用户名称修改成一个比较复杂的名称

  4. 添加外部用户时,勾选 External 设置成外部人员。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值