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
Recommended Settings
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.
| Configuration | Characteristics | Symlink Separation |
|---|---|---|
| Traditional (tarball) | index.php at the root | Not effective |
| Composer recommended | Has a web/ directory | Effective |
With the traditional configuration, vendor/ and composer.json are accessible from the web, so .htaccess protection is important.
Summary
- Always create backups (files and database)
- Update via Composer (not from the admin panel)
- Do not forget to temporarily change permissions
- Run drush updatedb and cache:rebuild
- Temporarily disable incompatible modules