搭建自己的Gitlab

搭建一个 gitlab 私服只需如下4步:

  1. 准备linux环境
  2. 安装gitlab
  3. 配置gitlab
  4. 启动gitlab

一、准备linux环境

可以是虚拟机,或者自己购买的云服务器。运行内存不能太小,1G肯定是不行的,以下演示的是基于centos7环境

二、安装gitlab

依赖

sudo yum install -y curl policycoreutils-python openssh-server

打开防火墙和SSH

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

下载包并安装

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://192.168.56.107" yum install -y gitlab-ee

直接访问即可:

http://192.168.56.107

修改相关配置

cd /etc/gitlab/
vim gitlab.rb 

重置并启动GitLab

sudo gitlab-ctl reconfigure
gitlab-ctl restart

总结

由于虚拟机配置不足,以上没有实现