官网教程:https://about.gitlab.com/install/#centos-8
1、安装和配置必要的依赖项
在 CentOS 8(和 RedHat 8)上,下面的命令还将打开系统防火墙中的 HTTP、 HTTPS 和 SSH 访问
sudo dnf install -y curl policycoreutils openssh-serversudo systemctl enable sshdsudo systemctl start sshd# Check if opening the firewall is needed with: sudo systemctl status firewalldsudo firewall-cmd --permanent --add-service=httpsudo firewall-cmd --permanent --add-service=httpssudo systemctl reload firewalld
下一步,安装后缀发送通知电子邮件。如果你想使用其他解决方案发送电子邮件,请跳过这一步,在 GitLab 安装之后配置一个外部 SMTP 服务器。
sudo dnf install postfixsudo systemctl enable postfixsudo systemctl start postfix
在后缀安装过程中,可能会出现一个配置屏幕。选择「Internet Site」 ,然后按回车键。使用您的服务器的外部 DNS 的“邮件名称”和按回车。如果出现其他屏幕,继续按回车键接受默认设置。
2、添加 GitLab 包存储库并安装包
有社区版(gitlab-ce)和企业版(gitlab-ee),建议正常使用企业版,学习用可以选择社区版本免费的
# 社区版:curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash# 企业版:curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
接下来,安装 GitLab 包。确保你已经正确设置了你的 DNS,并且将 https://GitLab.example.com /值改为你想要访问 GitLab 实例的 URL。安装将自动配置并在该 URL 启动 GitLab。
对于 https://URLs GitLab,它会自动请求一个带有 Let’s Encrypt 的证书,这需要入站 HTTP 访问和一个有效的主机名。您也可以使用您自己的证书或者直接使用 http://。
sudo EXTERNAL_URL="https://youself ipaddress" dnf install -y gitlab-ee
3、浏览主机名和登录名
在你的第一次访问,你会被重定向到一个密码重置屏幕。提供初始管理员帐户的密码,您将被重定向回登录屏幕。使用默认帐户的用户名 root 登录。
4、自定义设置
详见:https://docs.gitlab.com/omnibus/README.html#installation-and-configuration-using-omnibus-package
5、启动、停止、重启命令
启动gitlab服务sudo gitlab-ctl start
gitlab服务停止sudo gitlab-ctl stop
重启gitlab服务sudo gitlab-ctl restart
