awsdrupal

Upgrade Drupal

NOTE: It is advisable to create a backup before starting the update process. If you have important data, create and try to restore a backup to ensure that everything works properly.

Put your site into maintenance mode

  • Log in to the Drupal administration panel.

  • Browse to the “Administration -> Configuration -> Development -> Maintenance mode” section. Enable the “Put site into maintenance mode” checkbox and save the configuration:

Drupal Maintenance mode

Enable the Maintenance mode

  • Disable the maintenance mode when the upgrade is finished.

Drupal 9

You can update Drupal core with a minor version change using Composer, a dependency management tool and drush, a command-line shell and scripting interface for Drupal. Both tools are already included in Bitnami Drupal Stack. To upgrade Drupal, follow the steps below:

  • Create a backup of the .htaccess, settings.php and robots.txt files:

      $ cp /opt/bitnami/drupal/.htaccess /home/bitnami/.htaccess.backup
      $ cp /opt/bitnami/drupal/sites/default/settings.php /home/bitnami/settings.php.backup
      $ cp /opt/bitnami/drupal/robots.txt /home/bitnami/robots.txt.backup
    
  • Change your working directory to the Drupal application:

      $ cd /opt/bitnami/drupal/
    
  • Upgrade the application with Composer and drush by executing the commands below:

      $ drush cache:rebuild
      $ sudo composer update drupal/core-recommended --with-dependencies
      $ drush updatedb
      $ drush cache:rebuild
    
  • Check that the application has been successfully updated:

      $ drush core:status
    
  • Restore the backup of the .htaccess and robots.txt files:

      $ cp /home/bitnami/.htaccess.backup /opt/bitnami/drupal/.htaccess
      $ cp /home/bitnami/robots.txt.backup /opt/bitnami/drupal/robots.txt
    

Drupal 8

Upgrade using Drush

You can update Drupal core with a minor version change using drush a command-line shell and scripting interface for Drupal that is already included in Bitnami Drupal Stack. To upgrade Drupal with drush, follow the steps below:

  • Create a backup of the .htaccess, settings.php and robots.txt files:

      $ cp /opt/bitnami/drupal/.htaccess /home/bitnami/.htaccess.backup
      $ cp /opt/bitnami/drupal/sites/default/settings.php /home/bitnami/settings.php.backup
      $ cp /opt/bitnami/drupal/robots.txt /home/bitnami/robots.txt.backup
    
  • Change your working directory to the Drupal application:

      $ cd /opt/bitnami/drupal/
    
  • Upgrade the application using drush updating command:

      $ drush pm-update
    
  • In the Drupal administration panel navigate to the “Report -> Status” section to check that your site has been successfully updated.

Drupal Report Status: successful update

You can also check it in the “Report -> Available updates -> Update” section.

Drupal projects are up to date

  • Restore the backup of the .htaccess and robots.txt files:

      $ cp /home/bitnami/.htaccess.backup /opt/bitnami/drupal/.htaccess
      $ cp /home/bitnami/robots.txt.backup /opt/bitnami/drupal/robots.txt
    

Drupal 7

Upgrade using Drush

You can upgrade the application only without modifying any other stack components. Starting with Drupal v7.12-3, the Bitnami Drupal Stack ships drush, a command-line shell and scripting interface for Drupal. To upgrade Drupal with drush, use the following commands:

  • Change to the application directory:

      $ cd /opt/bitnami/drupal/
    
  • Execute Drush:

      $ drush up
    

More information is available on the Drush website.

Upgrade using built-in tools

To upgrade Drupal without drush, use Drupal’s built-in mechanism for upgrades by following the steps below:

  • Log in to the Drupal administration panel.

  • Browse to the “Administration -> Configuration -> Development -> Maintenance mode” section. Enable the “Put site into maintenance mode” checkbox and save the configuration.

  • At the server console, download the new Drupal version:

      $ wget http://ftp.drupal.org/files/projects/drupal-X.Y.tar.gz
      $ tar -xzvf drupal-X.Y.tar.gz
    
  • Create a backup of the .htaccess and settings.php files and overwrite the old Drupal installation with the new files:

      $ cp /opt/bitnami/drupal/.htaccess /home/bitnami/.htaccess.backup
      $ cp /opt/bitnami/drupal/sites/default/settings.php /home/bitnami/settings.php.backup
      $ sudo cp -R drupal-X.Y/* /opt/bitnami/drupal/
    
  • In case your older installation used custom .htaccess or settings.php files, restore them from backup.

  • In the Drupal administration panel, browse to the “Report -> Status” section and run the database update script if necessary.

    Drupal upgrade

Last modification February 9, 2023