在CentOS上安裝GitLab的步驟如下:
確保你的CentOS系統是最新的,打開終端并執行以下命令:
sudo yum update -y
GitLab需要一些基礎軟件包,包括curl、git和一些開發工具,使用以下命令安裝它們:
sudo yum install -y curl policycoreutils-python-utils openssh-server perl
GitLab提供了一個方便的腳本來設置一切,添加GitLab的官方倉庫:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
你可以安裝GitLab了,運行以下命令:
sudo yum install -y gitlab-ce
安裝完成后,你需要配置GitLab,編輯 /etc/gitlab/gitlab.rb
文件以進行自定義配置,更改外部URL或郵件設置,保存文件后,應用配置更改:
sudo gitlab-ctl reconfigure
然后啟動GitLab:
sudo gitlab-ctl start
為了保護GitLab服務器,建議配置防火墻規則,允許HTTP和SSH流量:
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
你的GitLab服務器應該已經成功安裝并運行,你可以開始創建項目和邀請用戶加入。
policycoreutils-python
或 policycoreutils-python-utils
,具體取決于你的Linux版本和GitLab版本。以上步驟是在CentOS 7上安裝GitLab的基本流程,具體版本可能會有所不同,建議參考GitLab的官方文檔獲取詳細信息。