Centos 安装 GitLab
安装必要依赖
1 安装 SSH
sudo yum install -y curl policycoreutils-python openssh-server
#将SSH服务设置成开机自启动,安装命令:
sudo systemctl enable sshd
#启动
sudo systemctl start sshd
2 安装防火墙
如果已经安装了防火墙并且已经在运行状态,则可跳过
#安装
yum install firewalld systemd -y
# 启动防火墙
service firewalld start
# 添加http服务到firewalld,pemmanent表示永久生效,若不加--permanent系统下次启动后就会失效。
sudo firewall-cmd --permanent --add-service=http
#重新加载 防火墙
sudo systemctl reload firewalld
3 安装Postfix以发送通知邮件
#安装
sudo yum install postfix
#设置开机自启
sudo systemctl enable postfix
#启动
sudo systemctl start postfix
4 安装GitLab
1 下载 安装 gitlab
这里使用了清华大学的镜像,下载速度飞起
# 下载 el7表示 centos7版本的 如果是centos8 请选择 el8版本
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm
#安装 这一步比较久需要耐心等待一下
rpm -i gitlab-ce-13.7.1-ce.0.el7.x86_64.rpm
#修改 gitlab配置文件指定服务器ip和自定义端口
vim /etc/gitlab/gitlab.rb # 将 external_url 改为 http://主机IP:想要的端口即可
#重置GitLab 这一步需要点时间
gitlab-ctl reconfigure
#重启 GitLab
gitlab-ctl restart