備份數據
sudo gitlab-rake gitlab:backup:create
。更新系統依賴
sudo apt update && sudo apt upgrade -y
。添加/更新 GitLab 官方倉庫
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
。執行升級
sudo apt install gitlab-ce
(默認升級到最新版)。
sudo apt install gitlab-ce=<版本號>
。.deb
包。sudo dpkg -i gitlab-ce-*.deb
,修復依賴:sudo apt install -f
。重啟服務與驗證
sudo gitlab-ctl restart
。sudo gitlab-rake gitlab:env:info
或訪問 Web 界面。external_url
等配置是否需調整。sudo gitlab-rake gitlab:storage:migrate_to_hashed
。提示:生產環境建議先在測試環境驗證升級流程,確保數據安全。