Nextcloudのコマンドラインでのアップデート

Nextcloud

Nextcloudをコマンドラインでアップデートする方法です.

まず,アップデートがあるかどうかを確認します.Nextcloudのインストールディレクトリ(occコマンドがあるディレクトリ)へ移動し以下のコマンドを実行します.

sudo -u apache php occ update:check

以下当サイトでの実行例です.(実行日: 2022/4/24)

# cd /var/www/xxx/nextcloud
# sudo -u apache php occ update:check
Nextcloud 23.0.4 is available. Get more information on how to update at https://docs.nextcloud.com/server/23/admin_manual/maintenance/upgrade.html.
1 update available
#

アップデートがあることが確認できたら以下のコマンドを実行します.uオプションにはインストールディレクトリの所有者を指定します.

sudo -u apache php updater/updater.phar

以下実行例です…が,その前に以下のメッセージは,web画面でアップデートした際にでたエラーで,ダウンロードフェーズで失敗しているもようです.

Downloading
Parsing response failed.
Show detailed response
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>504 Gateway Timeout</title>
</head><body>
<h1>Gateway Timeout</h1>
<p>The gateway did not receive a timely response
from the upstream server or application.></p>
</body</html>

この後,上記のアップデートコマンドを実行してみたところ,web画面で実行したアップデートのつづきから実行してくれているようです.

# sudo -u apache php updater/updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 23.0.3.

Update to Nextcloud 23.0.4 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-23.0.4.zip
Open changelog ?

Steps that will be executed:
[?] Check for expected files
[?] Check for write permissions
[?] Create backup
[?] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Continue update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[?] Check for expected files
[?] Check for write permissions
[?] Create backup
[?] Downloading
[?] Verify integrity
[?] Extracting
[?] Enable maintenance mode
[?] Replace entry points
[?] Delete old files
[?] Move new files in place
[?] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Repair SQLite autoincrement
Repair step: Copy data from accounts table when migrating from ownCloud
Repair step: Drop account terms table when migrating from ownCloud
Updating database schema
Updated database
Updating <circles> ...
Repair step: Upgrading Circles App
Updated <circles> to 23.1.1
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Repair mime types
Repair step: Clean tags and favorites
Repair info: 0 tags of deleted users have been removed.
Repair info: 0 tags for delete files have been removed.
Repair info: 0 tag entries for deleted tags have been removed.
Repair info: 0 tags with no entries have been removed.
Repair step: Repair invalid shares
Repair step: Move .step file of updater to backup location
Repair info: .step file exists
Repair info: .step-previous-update removed
Repair info: .step file moved to .step-previous-update
Repair step: Add move avatar background job
Repair info: Repair step already executed
Repair step: Add preview cleanup background jobs
Repair step: Migrate oauth2_clients table to nextcloud schema
Repair info: Update the oauth2_access_tokens table schema.
Repair info: Update the oauth2_clients table schema.
Repair step: Fix potential broken mount points
Repair info: No mounts updated
Repair step: Repair language codes
Repair step: Install new core bundle components
Repair step: Add log rotate job
Repair step: Clear frontend caches
Repair info: Image cache cleared
Repair info: SCSS cache cleared
Repair info: JS cache cleared
Repair step: Clear every generated avatar on major updates
Repair step: Add preview background cleanup job
Repair step: Queue a one-time job to cleanup old backups of the updater
Repair step: Cleanup invalid photocache files for carddav
Repair step: Add background job to cleanup login flow v2 tokens
Repair step: Remove potentially over exposing share links
Repair info: No need to remove link shares.
Repair step: Clear access cache of projects
Repair step: Reset generated avatar flag
Repair step: Keep legacy encryption enabled
Repair step: Check encryption key format
Repair step: Remove old dashboard app config data
Repair step: Add job to cleanup the bruteforce entries
Repair step: Queue a one-time job to check for user uploaded certificates
Repair step: Repair DAV shares
Repair step: Add background job to set the lookup server share state for users
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level

Keep maintenance mode active? [y/N] n
Maintenance mode disabled

Maintenance mode is disabled
#

この後,動作確認をしてNextcloudのアップデートは完了です.

タイトルとURLをコピーしました