在线安装:
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
或者
sudo apt-get install gitlab-ce=13.2.2-ce.0
手动离线安装:
wget —content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/jessie/gitlab-ce_13.2.2-ce.0_amd64.deb/download.deb
dpkg -i gitlab-ce_13.2.2-ce.0_amd64.deb
版本升级
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
dpkg -i gitlab-ce_13.2.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.8-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.9-ce.0_amd64.deb
dpkg -i gitlab-ce_13.2.10-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.0-ce.1_amd64.deb
dpkg -i gitlab-ce_13.3.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.8-ce.0_amd64.deb
dpkg -i gitlab-ce_13.3.9-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.4.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.5.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.6.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.8-ce.0_amd64.deb
dpkg -i gitlab-ce_13.7.9-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.8.8-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.9.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.10.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.10.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.10.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.10.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.10.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.10.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.11.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.0-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.1-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.2-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.3-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.4-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.5-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.6-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.7-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.8-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.9-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.10-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.11-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.12-ce.0_amd64.deb
dpkg -i gitlab-ce_13.12.15-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.7-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.8-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.9-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.10-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.11-ce.0_amd64.deb
dpkg -i gitlab-ce_14.0.12-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.7-ce.0_amd64.deb
dpkg -i gitlab-ce_14.1.8-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.2.7-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.3.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.4.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.4.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.4.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.4.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.4.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.4.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.5.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.5.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.5.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.5.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.5.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.6.7-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.7.7-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.8.6-ce.0_amd64.deb
dpkg -i gitlab-ce_14.9.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.9.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.9.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.9.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.9.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.9.5-ce.0_amd64.deb
dpkg -i gitlab-ce_14.10.0-ce.0_amd64.deb
dpkg -i gitlab-ce_14.10.1-ce.0_amd64.deb
dpkg -i gitlab-ce_14.10.2-ce.0_amd64.deb
dpkg -i gitlab-ce_14.10.3-ce.0_amd64.deb
dpkg -i gitlab-ce_14.10.4-ce.0_amd64.deb
dpkg -i gitlab-ce_14.10.5-ce.0_amd64.deb
dpkg -i gitlab-ce_15.0.0-ce.0_amd64.deb
dpkg -i gitlab-ce_15.0.1-ce.0_amd64.deb
dpkg -i gitlab-ce_15.0.2-ce.0_amd64.deb
dpkg -i gitlab-ce_15.0.3-ce.0_amd64.deb
dpkg -i gitlab-ce_15.0.4-ce.0_amd64.deb
dpkg -i gitlab-ce_15.1.0-ce.0_amd64.deb
dpkg -i gitlab-ce_15.1.1-ce.0_amd64.deb
dpkg -i gitlab-ce_15.1.2-ce.0_amd64.deb
踩过的坑:
- 从14.8.0升级到14.8.1出现以下错误:
解决方案:
创建文件夹:mkdir /var/opt/gitlab/gitlab-rails/shared/registry
参考文档:https://gitlab.com/gitlab-org/gitlab/-/issues/353625
2.从14.9.5升级到14.10.0出现以下错误:
Running handlers:
There was an error running gitlab-ctl reconfigure:
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database ] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
解决方案:
sudo gitlab-rake db:migrate
sudo gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,’[null\,”up”]’]
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
参考文档:https://yangyq.net/2022/05/gitlab-update-error.html
GitLab从旧服务器迁移到新服务器
迁移前首先要保证新旧服务器上的GitLab版本号一致。
查看当前GitLab版本
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
1
显示为 10.3.3。
1 新服务器升级系统
内核和软件一起升级
yum -y update
1
升级完成后查看系统版本号
cat /etc/redhat-release
1
输出如下:CentOS Linux release 7.6
2 新服务器上安装GitLab
安装教程在这里
安装完成后,最新版本的GitLab是 12.0.1。相当于说,要在旧服务器上把GitLab从10.3.3升级到12.0.1。
3 旧服务器升级GitLab
GitLab不能跨版本升级,需一个一个大版本升级。例如:10.8.7是10的最后一个版本,11.11.0是11的最后一个版本,则从 10.3.3 升级到 12.0.1,需要经过 10.3.3 -> 10.8.7 -> 11.11.0 -> 12.0.1。。
yum install -y gitlab-ce-10.8.7-ce.0.el7
yum install -y gitlab-ce-11.11.0-ce.0.el7
yum install -y gitlab-ce
1
2
3
注:如果不指定版本号,则自动升级到最新版本。
在每一次升级后,都要测试GitLab后台系统是否正常,如果不能访问了,则说明本次升级失败,应解决错误或回退版本。
4 拷贝旧服务器的备份文件到新服务器
4.1 备份旧服务器的文件
gitlab-rake gitlab:backup:create
1
默认将会在 /var/opt/gitlab/backups/ 目录下生成备份文件。
4.2 使用scp命令从本地旧服务器复制文件到新服务器
scp /var/opt/gitlab/backups/1561597102_2019_06_27_12.0.1_gitlab_backup.tar root@xxx.xxx.xxx.xxx:/var/opt/gitlab/backups/
1
根据提示输入自己新服务器的密码:xxxxxx
5 新服务器恢复GitLab
5.1 将备份文件权限修改为777,避免出现权限不够的问题
cd /var/opt/gitlab/backups
chomd 777 1561597102_2019_06_27_12.0.1_gitlab_backup.tar
1
2
5.2 停止数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
1
2
5.3 恢复备份文件到GitLab
gitlab-rake gitlab:backup:restore BACKUP=备份文件编号
1
例如:备份文件名为1561597102_2019_06_27_12.0.1_gitlab_backup.tar,则编号为1561597102_2019_06_27_12.0.1。
在提示中敲入“yes”继续。
5.4 启动GitLab
gitlab-ctl start
最后检查新旧GitLab的内容,完全一模一样,迁移成功!