Overview

This is a note on the procedure for updating Drupal on Sakura rental server.

First, we referred to the following site.

https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-drush

However, it contained the following note:

Use Composer to manage Drupal dependencies. Drush 9 and newer no longer supports updating Drupal.

We also referred to the following:

https://drupalfan.com/drupal10を最新版にアップデートする/

Procedure

!

This may contain incorrect or unnecessary steps. Please use it as a reference only.

Navigate to the directory where Drupal was downloaded.

cd ~/www/{project_name}

Preparation (Not Required if Already Installed)

composer

If only composer.phar exists, create composer. (Using mv should also work.)

cp composer.phar composer

drush

composer require --dev drush/drush

Enable Maintenance Mode

./vendor/bin/drush state-set system.maintenance_mode 1

Clear Cache

./vendor/bin/drush cr

Backup

Create a backup directory.

mkdir ~/bk

SQL Backup

./vendor/bin/drush sql:dump --extra-dump=--no-tablespaces > ~/bk/dump.sql

Reference

Without specifying --extra-dump=--no-tablespaces, the following error message was displayed:

./vendor/bin/drush sql:dump > ~/bk/dump.sql
> mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces

File Backup

tar cvzf ~/bk/web.zip .

Update

Dry Run

composer update "drupal/core-*" --with-all-dependencies --dry-run

Update

composer update "drupal/core-*" --with-all-dependencies

Update Contributed Modules

composer update

Database Update

./vendor/bin/drush updatedb

Disable Maintenance Mode

./vendor/bin/drush state-set system.maintenance_mode 0

Clear Cache

./vendor/bin/drush cr

If the cache is not cleared after the update, the display may break.

Summary

This may contain incorrect or unnecessary steps, but we hope it serves as a useful reference.