Ubuntu系統下GitLab更新流程如下:
備份數據
使用命令 sudo gitlab-rake gitlab:backup:create
備份數據,重要配置需手動備份(如 /etc/gitlab/gitlab.rb
、/etc/gitlab/gitlab-secrets.json
)。
更新系統
執行 sudo apt update && sudo apt upgrade -y
確保系統包最新。
添加/更新GitLab倉庫
通過命令 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
添加官方倉庫(企業版替換為 gitlab-ee
)。
執行升級
sudo apt install gitlab-ce=<版本號>
(需按官方升級路徑逐步升級,如從13.x到16.x需依次經過中間版本)。sudo apt update && sudo apt upgrade gitlab-ce
。重新配置與重啟服務
運行 sudo gitlab-ctl reconfigure
重新加載配置,然后重啟服務:sudo gitlab-ctl restart
。
驗證升級
sudo gitlab-rake gitlab:check
驗證系統狀態,確保無錯誤。注意: