googledrupal

Upgrade Drupal

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

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 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 depending on your installation type:

Approach A: Bitnami installations using system packages
  • 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
    
Approach B: Self-contained Bitnami installations
  • Create a backup of the .htaccess, settings.php and robots.txt files:

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

    $ cd /opt/bitnami/apps/drupal/htdocs/
    
  • Upgrade the application using the 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/apps/drupal/htdocs/.htaccess
    $ cp /home/bitnami/robots.txt.backup /opt/bitnami/apps/drupal/htdocs/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 depending on your installation type:

    • Approach A (Bitnami installations using system packages):

      $ cd /opt/bitnami/drupal/
      
    • Approach B (Self-contained Bitnami installations):

      $ cd /opt/bitnami/apps/drupal/htdocs/
      
  • 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. Depending on your installation type, run the following commands:

    • Approach A (Bitnami installations using system packages):

      $ 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/
      
    • Approach B (Self-contained Bitnami installations):

      $ cp /opt/bitnami/apps/drupal/htdocs/.htaccess /home/bitnami/.htaccess.backup
      $ cp /opt/bitnami/apps/drupal/htdocs/sites/default/settings.php /home/bitnami/settings.php.backup
      $ sudo cp -R drupal-X.Y/* /opt/bitnami/apps/drupal/htdocs/
      
  • 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 July 13, 2020