CentOS7搭建Gitlab

前期准备

  1. 服务器:CentOS7
  2. 安装文件:gitlab-ce-12.6.3-ce.0.el7.x86_64.rpm

安装gitlab

打开Centos终端,首先安装Gitlab必须的ssh,在系统防火墙中打开HTTP、HTTPS和SSH访问。

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 firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

然后安装发送邮件功能的postfix

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

添加Gitlab的包仓库(ee改成ce)

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

安装gitlabEXTERNAL_URL指的是你的gitlab访问地址,这里改为http://+你的服务器ip)

sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ce

访问

重置并启动GitLab,执行以下命令

gitlab-ctl reconfigure
gitlab-ctl restart

提示 "ok: run:"表示启动成功。

然后浏览器上输入你的访问地址(第一次会让你输入新密码,用户名默认root)

遇到的问题

在浏览器中访问出现502错误
原因:内存不足
解决办法:检查系统的虚拟内存是否随机启动了,如果系统无虚拟内存,就增加虚拟内存,再重新启动系统。

 

8080端口冲突
原因:由于unicorn默认使用的是 8080 端口。
解决办法:打开 /etc/gitlab/gitlab.rb ,打开 # unicorn['port'] = 8080 的注释,将 8080 修改为 9999 ,保存后运行 sudo gitlab-ctl reconfigure 即可。

版权声明:
作者:小和
链接:https://www.xhfun.cn/centos_gitlab.html
来源:小和Fun
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
< <上一篇
下一篇>>
文章目录
关闭
目 录