以下是在Debian上部署GitLab的流程:
更新系統:
sudo apt update && sudo apt upgrade
安裝依賴:
sudo apt install curl openssh-server ca-certificates postfix
```(安裝Postfix時選擇“Internet Site”配置郵件)
添加GitLab倉庫:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安裝GitLab CE:
sudo apt install gitlab-ce
```(安裝時需設置域名或IP)
配置GitLab:
編輯配置文件 /etc/gitlab/gitlab.rb
,設置 external_url
為服務器域名或IP,啟用SSL(可選):
sudo nano /etc/gitlab/gitlab.rb
sudo gitlab-ctl reconfigure
啟動服務:
sudo gitlab-ctl start
sudo systemctl enable gitlab
開放防火墻(若啟用UFW):
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload
訪問GitLab:
瀏覽器輸入 http://your-server-ip
或域名,首次登錄使用默認管理員賬戶(root)及初始密碼(可在 /etc/gitlab/initial_root_password
查看)。
可選配置:
gitlab.rb
中啟用 letsencrypt
相關參數并重啟服務。gitlab.rb
中設置SMTP參數以啟用郵件通知。參考來源:[1,2,3,4,5,6,7,8,9,10,11]