在Debian系統上配置GitLab,你需要遵循以下步驟:
首先,確保你的Debian系統是最新的:
sudo apt update
sudo apt upgrade -y
GitLab需要一些基本的依賴包:
sudo apt install -y curl openssh-server ca-certificates tzdata perl
添加GitLab的官方APT倉庫:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安裝GitLab社區版:
sudo EXTERNAL_URL="http://your-gitlab-domain.com" apt install gitlab-ce
將http://your-gitlab-domain.com替換為你希望GitLab訪問的域名。
安裝完成后,GitLab會自動啟動并進行配置。你可以通過瀏覽器訪問http://your-gitlab-domain.com來配置GitLab。
如果你使用的是UFW(Uncomplicated Firewall),確保開放HTTP和SSH端口:
sudo ufw allow http
sudo ufw allow ssh
為了安全起見,建議為GitLab配置SSL證書。你可以使用Let’s Encrypt來獲取免費的SSL證書:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your-gitlab-domain.com
按照提示完成SSL證書的安裝和配置。
訪問https://your-gitlab-domain.com,你應該能夠看到GitLab的登錄頁面。使用默認的用戶名和密碼登錄:
root首次登錄后,建議立即重置root用戶的密碼:
sudo passwd root
根據你的需求,你可能需要進一步配置GitLab,例如設置用戶、項目、CI/CD管道等。你可以參考GitLab官方文檔進行詳細配置。
通過以上步驟,你應該能夠在Debian系統上成功安裝和配置GitLab。