# 升级gitlab-ce/trusty $ apt upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages were automatically installed and are no longer required: amd64-microcode linux-modules-extra-4.4.0-148-generic Use 'apt-get autoremove' to remove them. The following packages have been kept back: linux-generic-lts-xenial linux-headers-generic-lts-xenial linux-image-generic-lts-xenial The following packages will be upgraded: gitlab-ce 1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. Need to get 620 MB of archives. After this operation, 488 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/ trusty/main gitlab-ce amd64 11.10.8-ce.0 [620 MB] Err https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/ trusty/main gitlab-ce amd64 11.10.8-ce.0 HttpError404 E: Failed to fetch https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/gitlab-ce_11.10.8-ce.0_amd64.deb HttpError404
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? # 遇到了404错误
Welcome to Ubuntu 16.04.7 LTS (GNU/Linux 4.4.0-210-generic x86_64)
* Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage $ apt update Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease Hit:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease Hit:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease Hit:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. # 修改一下gitlab-ce源,升级的时候ubunut已经修改过来并注释了,我们只需把注释去掉 $ vim /etc/apt/sources.list.d/gitlab-ce.list # 把注释去掉 # 查看gitlab版本 $ gitlab-rake gitlab:env:info
System information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.3.6p384 Gem Version: 2.6.13 Bundler Version:1.13.7 Rake Version: 12.3.0 Redis Version: 3.2.11 Git Version: 2.14.3 Sidekiq Version:5.0.5 Go Version: unknown
GitLab information Version: 10.5.5 Revision: c7e4919 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql Using LDAP: no Using Omniauth: no
$ apt list --upgradable -a |grep 10.8.7 gitlab-ce/xenial 10.8.7-ce.0 amd64 # 安装指定版本 $ apt install gitlab-ce=10.8.7-ce.0 Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic Use 'apt autoremove' to remove them. The following packages will be upgraded: gitlab-ce 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 425 MB of archives. After this operation, 115 MB of additional disk space will be used. Get:1 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial/main amd64 gitlab-ce amd64 10.8.7-ce.0 [425 MB] Fetched 425 MB in 3min 47s (1,867 kB/s) (Reading database ... 225666 files and directories currently installed.) Preparing to unpack .../gitlab-ce_10.8.7-ce.0_amd64.deb ... Unpacking gitlab-ce (10.8.7-ce.0) over (10.5.5-ce.0) ... Setting up gitlab-ce (10.8.7-ce.0) ... Checking PostgreSQL executables:Starting Chef Client, version 13.6.4 resolving cookbooks for run list: ["gitlab::config", "postgresql::bin"] Synchronizing Cookbooks: - postgresql (0.1.0) - gitlab (0.0.1) - consul (0.0.0) - package (0.1.0) - registry (0.1.0) - mattermost (0.1.0) - letsencrypt (0.1.0) - gitaly (0.1.0) - runit (0.14.2) - nginx (0.1.0) - acme (3.1.0) - crond (0.1.0) - compat_resource (12.19.0) Installing Cookbook Gems: Compiling Cookbooks... Converging 1 resources Recipe: postgresql::bin * ruby_block[Link postgresql bin files to the correct version] action run (skipped due to only_if)
Running handlers: Running handlers complete Chef Client finished, 0/1 resources updated in 03 seconds Checking PostgreSQL executables: OK Found /etc/gitlab/skip-auto-migrations, exiting...
Upgrade complete! If your GitLab server is misbehaving try running sudo gitlab-ctl restart before anything else. If you need to roll back to the previous version you can use the database backup made during the upgrade (scroll up for the filename). $ gitlab-rake gitlab:env:info
System information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.3.7p456 Gem Version: 2.6.14 Bundler Version:1.13.7 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.16.4 Sidekiq Version:5.0.5 Go Version: unknown
GitLab information Version: 10.8.7 Revision: eb600b0 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql Using LDAP: no Using Omniauth: no
# 查看关系数据库的升级状态,果然很多错误 $ gitlab-rake db:migrate:status down 20180502122856 Create project mirror data down 20180502134117 Migrate import attributes data from projects to project mirror data down 20180503131624 Create remote mirrors down 20180503141722 Add remote mirror available overridden to projects down 20180503150427 Add index to namespaces runners token down 20180503175053 Ensure missing columns to project mirror data down 20180503175054 Add indexes to project mirror data down 20180503193542 Add indexes to remote mirror down 20180503193953 Add mirror available to application settings down 20180503200320 Enable prometheus metrics by default down 20180508055821 Make remote mirrors disabled by default down 20180508100222 Add not null constraint to project mirror data foreign key down 20180508102840 Add unique constraint to project mirror data project id index down 20180529093006 Ensure remote mirror columns # 升级数据库 $ gitlab-ctl stop # (注意:先停止服务) $ gitlab-rake db:migrate $ gitlab-ctl start # (注意:先开启服务) $ gitlab-ctl reconfigure
Running handlers: Running handlers complete Chef Client finished, 31/558 resources updated in 34 seconds
Deprecations:
Old file /etc/gitlab/skip-auto-migrations found. This file will stop being checked in GitLab 11, use /etc/gitlab/skip-auto-reconfigure instead. This file has been automatically created for you as a migration aid.
To disable this message, remove the deprecated /etc/gitlab/skip-auto-migrations
$ dpkg -i gitlab-ce_12.9.5-ce.0_amd64 GitLab now ships with a newer version of PostgreSQL (11.7), but it is not yet enabled by default. To upgrade, please see: https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server # 提示要升级PostgreSQL $ gitlab-ctl reconfigure Warnings: The version of the running postgresql service is different than what is installed. Please restart postgresql to start the new version.
sudo gitlab-ctl restart postgresql
gitlab Reconfigured! $ gitlab-ctl restart $ gitlab-ctl restart sidekiq $ gitlab-ctl hup unicorn # 502错误 # 升级PostgreSQL(https://docs.gitlab.com/omnibus/settings/database.html#gitlab-128-and-later) $ gitlab-ctl pg-upgrade -V 11 Checking for an omnibus managed postgresql: OK Checking if postgresql['version'] is set: OK Checking if we already upgraded: NOT OK Checking for a newer version of PostgreSQL to install Upgrading PostgreSQL to 11.7 Checking if PostgreSQL bin files are symlinked to the expected location: OK Waiting 30 seconds to ensure tasks complete before PostgreSQL upgrade. See https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server for details If you do not want to upgrade the PostgreSQL server at this time, enter Ctrl-C and see the documentation for details
Please hit Ctrl-C now if you want to cancel the operation. Toggling deploy page:cp /opt/gitlab/embedded/service/gitlab-rails/public/deploy.html /opt/gitlab/embedded/service/gitlab-rails/public/index.html
Toggling services: OK ==== Upgrade has completed ==== Please verify everything is working and run the following if so sudo rm -rf /var/opt/gitlab/postgresql/data.9.6 sudo rm -f /var/opt/gitlab/postgresql-version.old # 可以正常访问
System information System: Ubuntu 18.04 Current User: git Using RVM: no Ruby Version: 2.6.5p114 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.7 Git Version: 2.24.3 Sidekiq Version:5.2.7 Go Version: unknown
GitLab information Version: 12.9.5 Revision: 58afee038ec Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 11.7 Using LDAP: no Using Omniauth: yes Omniauth Providers:
System information System: Ubuntu 20.04 Current User: git Using RVM: no Ruby Version: 2.6.5p114 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.7 Git Version: 2.24.3 Sidekiq Version:5.2.7 Go Version: unknown
GitLab information Version: 12.9.5 Revision: 58afee038ec Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 11.7 Using LDAP: no Using Omniauth: yes Omniauth Providers: