This article summarizes the procedure for updating Drupal from 10.1.5 to 10.6.1 on Sakura rental server.

Environment

  • Server: Sakura rental server
  • Drupal: 10.1.5 -> 10.6.1
  • Installation type: Traditional (tarball, no web/ directory)

Preparation

Creating a Working Directory

Store backups outside of www (to prevent web access).

mkdir -p /home/[username]/backups/drupal

Backing Up Files

cd /home/[username]/www
tar -czvf /home/[username]/backups/drupal/drupal_backup_$(date +%Y%m%d).tar.gz [drupal-directory]/

Backing Up the Database

On Sakura rental server, the --no-tablespaces option is required.

cd /home/[username]/www/[drupal-directory]
./vendor/bin/drush sql-dump --extra-dump="--no-tablespaces" > /home/[username]/backups/drupal/db_backup_$(date +%Y%m%d).sql

Updating Drupal Core

Changing Permissions

The sites/default directory is often write-protected, so temporarily change its permissions.

chmod 755 /home/[username]/www/[drupal-directory]/sites/default
chmod 644 /home/[username]/www/[drupal-directory]/sites/default/default.services.yml

Updating with Composer

Since the composer command is not available on Sakura rental server, use composer.phar instead.

cd /home/[username]/www/[drupal-directory]
php composer.phar require drupal/core-recommended:^10 drupal/core-composer-scaffold:^10 --update-with-dependencies

Database Update and Cache Clear

./vendor/bin/drush updatedb -y
./vendor/bin/drush cache:rebuild

Restoring Permissions

chmod 555 /home/[username]/www/[drupal-directory]/sites/default
chmod 444 /home/[username]/www/[drupal-directory]/sites/default/settings.php

Troubleshooting

Rules Module Compatibility Error

If you see the following error after updating:

The "entity_bundle:node" plugin does not exist.

The Rules module may be incompatible with the new Drupal core. Temporarily disable it:

./vendor/bin/drush pm:uninstall rules -y
./vendor/bin/drush cache:rebuild

Configuring trusted_host_patterns

Add the following to settings.php:

chmod 644 /home/[username]/www/[drupal-directory]/sites/default/settings.php

echo "
\$settings['trusted_host_patterns'] = [
  '^example\\.jp\$',
  '^www\\.example\\.jp\$',
];" >> /home/[username]/www/[drupal-directory]/sites/default/settings.php

chmod 444 /home/[username]/www/[drupal-directory]/sites/default/settings.php

Enabling state_cache

As preparation for Drupal 11, add to settings.php:

$settings['state_cache'] = TRUE;

Disabling Deprecated Modules

Disable modules scheduled for removal in Drupal 11:

./vendor/bin/drush pm:uninstall tour -y
./vendor/bin/drush pm:uninstall layout_builder_expose_all_field_blocks -y

Updating Modules

For Composer-managed Drupal, update via Composer rather than from the admin panel.

cd /home/[username]/www/[drupal-directory]
php composer.phar update --with-all-dependencies
./vendor/bin/drush updatedb -y
./vendor/bin/drush cache:rebuild

Appendix: Drupal Configuration Types

There are two types of Drupal configurations.

ConfigurationCharacteristicsSymlink Separation
Traditional (tarball)index.php at the rootNot effective
Composer recommendedHas a web/ directoryEffective

With the traditional configuration, vendor/ and composer.json are accessible from the web, so .htaccess protection is important.

Summary

  1. Always create backups (files and database)
  2. Update via Composer (not from the admin panel)
  3. Do not forget to temporarily change permissions
  4. Run drush updatedb and cache:rebuild
  5. Temporarily disable incompatible modules