學習於官方原文檔:https://about.gitlab.com/install/#centos-7
1、安裝和配置必要的依賴項
以下命令還將在系統防火牆中打開HTTP,HTTPS和SSH訪問
#安裝ssh,開啓ssh允許遠程訪問
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
#啓用http、https
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
2、添加GitLab軟件包存儲庫並安裝軟件包
#添加GitLab包存儲庫
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
#安裝GitLab包,這裏的url是你的訪問映射的url
sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ce
3、訪問登錄搭建的gitlab
#修改本地host,將部署gitlab服務器的地址和你的指定的url映射【在公網上則不同】
#服務器地址 git鏈接地址【填寫你你自己修改的】
172.xxx.xxx.xxx gitlab.example.com
#瀏覽器訪問,第一次訪問需要修改初始密碼
https://gitlab.example.com
#超級管理員賬號密碼
#username root
#password 你第一次修改的密碼
4、其它
#gitlab 啓動
sudo gitlab-ctl start
#gitlab 停止
sudo gitlab-ctl stop
#gitlab 重啓
sudo gitlab-ctl restart
#卸載 我這裏裝的ce版本
sudo rpm -e gitlab-ce