Tutorial: How to Safely Update a Drupal Website
1. Back Everything Up
Before doing anything, make a full backup.
Database Backup:
drush sql-dump > ~/backups/drupal-db.sql
Files Backup:
tar czf ~/backups/drupal-files.tar.gz ~/public_html
2. Check Your Drupal Version
Log in to your admin dashboard or run:
drush status
3. Check for Available Updates
Run in your root Drupal directory:
drush up:db
drush pm:security
Or check via Admin > Reports > Available Updates
4. Put the Site in Maintenance Mode
Admin: Configuration > Development > Maintenance Mode
Or via Drush:
drush sset system.maintenance_mode 1
5. Update Drupal Core
Option A (Composer):
composer update drupal/core "drupal/core-*" --with-all-dependencies
Option B (Manual - not recommended for Composer-managed sites):
1. Download from drupal.org
2. Replace all except /sites, /modules, /themes
3. Run database updates
6. Update the Database
Run:
drush updb
Or go to:
https://yourdomain.com/update.php
7. Clear the Cache
drush cr
Or via Admin: Configuration > Development > Performance > Clear All Caches
8. Take the Site Out of Maintenance Mode
drush sset system.maintenance_mode 0
drush cr
9. Verify Everything Works
Test pages, forms, and logins
Check Admin > Reports > Recent log messages
10. Keep a Changelog
Record:
- Upgraded version
- Errors encountered
- Modules or themes updated
You're Done!
Your Drupal site is updated and secure.
Check regularly for module and theme updates.