—Rate this article—
 

Upgrading the Drupal version of an OPDK installation

For an on-premises, or OPDK, installation of the Developer Services portal, you might get a notification that a new version of Drupal is available. A new version can mean a Drupal feature release, patch, security update, or other type of Drupal update. In the case of a security update, you want to upgrade your installation of Drupal as soon as possible to ensure that your site remains secure.

The procedure below describes how to upgrade an OPDK installation of Drupal.

This upgrade is for your OPDK installation of Drupal only. For customers using a cloud deployment of the portal, Apigee will automatically apply all Drupal security updates.

This procedure only upgrades your installation of Drupal. It does not upgrade the Apigee software that ships as part of the portal. For information on upgrading the Apigee portal software, see the Developer Channel Services Installation and Configuration Guide.

Determining your current Drupal version

Before you start the Drupal upgrade, you can determine your current Drupal version by running the following command from the Drupal installation folder. By default, Drupal is installed in /var/www/html:

> cd /var/www/html
> drush status | grep 'Drupal version'

You should see output in the form:

Drupal version                  :  7.31  

If you installed Drupal in a directory other than /var/www/html, make sure to change to that directory before running the drush command.

Upgrading Drupal

To upgrade your OPDK Drupal installation:

  1. Change to the /var/www directory, the default installation directory. Modify this directory if you installed the portal in a different location.
  2. Download the latest Drupal code by using the following command:

    > drush dl drupal

    The command create a directory named drupal-x.y under /var/www, where x.y corresponds to the current version of Drupal.

    Note: If your portal is on a server with no external internet connection, perform this step on a server with internet access, and then copy the drupal-x.y directory to your portal server.
  3. Remove the sites directory under the drupal-x.y directory:

    > rm -R -f drupal-x.y/sites
  4. Use the following commands to copy files from the /var/www/html directory to drupal-x.y:

    > cp html/buildinfo drupal-x.y
    > cp -r html/sites drupal-x.y
    > cp -r html/profiles/apigee drupal-x.y/profiles

     
  5. Set file ownership. This command makes user root the user-owner and group apache the group-owner of all files and directories in Drupal's root directory and all subdirectories and files in those subdirectories:

    > cd drupal-x.y
    > chown -R root:apache .
    > find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
    > find . -type f -exec chmod u=rw,g=r,o= '{}' \;

    Modify this command if you use different owner/group combination. See https://www.drupal.org/node/244924 for more.
  6. Set the files permissions in the sites/files, sites/private, and sites/tmp directories. Change the paths as necessary if you moved these directories from their default location. You can use the drush vget file_ command to determine the location of these directories if you moved them.

    > cd drupal-x.y/sites
    > find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
    > for d in ./*/files
    do
       find $d -type d -exec chmod ug=rwx,o= '{}' \;
       find $d -type f -exec chmod ug=rw,o= '{}' \;
    done
    > for d in ./*/private
    do
       find $d -type d -exec chmod ug=rwx,o= '{}' \;
       find $d -type f -exec chmod ug=rw,o= '{}' \;
    done
    > for d in ./*/tmp
    do
       find $d -type d -exec chmod ug=rwx,o= '{}' \;
       find $d -type f -exec chmod ug=rw,o= '{}' \;
    done
  7. Backup your existing Drupal installation and copy the Drupal update to your Drupal installation directory:

    > mv html html-bak; mv drupal-x.y html

    Depending on file permissions, you might have to use sudo to run this command, or run it as an administrator. Modify the destination directory if you installed Drupal in a directory other than /var/www/html.
  8. Change directories to your Drupal installation directory:

    > cd /var/www/html
  9. Run the following drush command to update the Drupal database:

    > drush updb -y
  10. Clear all caches:

    > drush cc all

The upgrade is now complete.

 

Help or comments?

  • Something's not working: See Apigee Support
  • Something's wrong with the docs: Click Send Feedback in the lower right.
    (Incorrect? Unclear? Broken link? Typo?)