Step by step guide to update drupal 8 core

Step by step guide to update drupal 8 core

Wed, 03/16/2016 - 21:46
Posted in:
0 comments

This article explains how to update drupal 8 core minor updates. You can update Drupal from one 8.x.x version to any later 8.x.x version (For example, from 8.2.1 to 8.2.2, or from 8.3.5 to 8.4.0) in two ways - 

First common steps and definitions for both ways

  • Consider you are upgrading to Drupal 8 version x.y.z,
    x is called the major version number,
    y is known as the minor version number, and
    z is known as the patch version number.
  • Make a full backup of all files, directories, and your database(s) before starting an update.
  • It is always better to update or upgrade a test copy of your site before applying it to live. Even minor updates can cause your site's behavior to change.
  • With each new release of Drupal, release notes related to new version get published, which list outs and explain the changes made since the previous version and any special instructions needed to update or upgrade to the new version.
  • You can find the release notes for your version at https://www.drupal.org/project/drupal/releases/8.x.x. Where 1st x = minor version and 2nd x = patch version.

Steps to update minor and patch versions of Drupal 8 manually

  1. Log in as admin or user with the permission "Administer software updates".
     
  2. Go to Administration > Configuration > Development > Maintenance mode and put the site into maintenance mode by enabling "Put site into maintenance mode" checkbox.
     
  3. Remove the 'core' and 'vendor' directories. (Do not override these directories with new directories as it will lead to WSOD and site will break)
    Keep modules, themes, profiles, sites directories. 
    Also remove all of the files in the top-level directory, except any that you added manually (like Google, Bing verification files, error log file).

     
  4. Download the latest Drupal 8.x.x release from Drupal website to a directory outside of your web root. Extract the archive and copy the files into your Drupal directory.
     
  5. If you made changes in files like .htaccess, composer.json, or robots.txt then you have to re-apply them from your backup, after the new files are in place.

    Sometimes an update includes changes to default.settings.php (this will be noted in the release notes). If that's the case, follow these steps:
    • find your settings.php file in the /sites/* directory. (Typically sites/default.)
    • Make a backup copy of your settings.php file, with a different file name.
    • Make a copy of the new default.settings.php file, and name the copy settings.php (overwriting your previous settings.php file).
    • Copy the custom and site-specific entries from the backup you made into the new settings.php file. You must have to copy lines giving the database information, and you will also want to copy in any other customizations you have added.
       
  6. Run update.php by navigating to http://yourdrupalsitename/update.php and follow the process. This will update the core database tables.

    If you are unable to access update.php do the following:

    • Open settings.php in editor.
    • Find the line:
      $settings['update_free_access'] = FALSE;
      
    • Change it to:
      $settings['update_free_access'] = TRUE;
      
    • Save settings.php. Try again to run update.php.
    • Once the update is done, $settings['update_free_access'] must be reverted to FALSE.
       
  7. Go to Administration > Reports > Status report. Verify that everything is working as expected.
     
  8. Go to Administration > Configuration > Development > Maintenance mode. Disable the "Put site into maintenance mode" checkbox and save the configuration.

 

Steps to update minor and patch versions of Drupal 8 through drush

Drush make backup the Drupal core installation for you, but you might want to backup the sites directory just in case something goes wrong. You can use Drush to back-up the database too.

Check now : How to install drush for drupal 8 on shared hosting?

  1. Put your site in maintenance mode.
    drush sset system.maintenance_mode 1
    drush cr
    drush cr used to rebuilt cache.
     
  2. Run update command  in drush to start update.
    drush pm-update
    When you enter this command confirmation question will be asked. type y and enter
    Drush Drupal 8 update command
    Drush will also update your database if necessary and make backup in your home directory. Check if there are any errors, warnings or notices. If yes then note it down and try to solve errors manually.
     
  3. Check that everything works
    Check site and test everything! If you had modified robots.txt or .htaccess, make sure you should reapply them. (Sometimes you can just copy the old files back.) If you used a custom installation profile, you might have to copy that back too. If the default.settings.php file has changed, make sure settings.php file has the latest and correct information.
     
  4. Put your site online again
    drush sset system.maintenance_mode 0
    drush cr
  5. Some other options
    drush pm-update is the same as running drush pm-updatecode and then drush updatedb so you can optionally run the latter two commands to break up the process. drush pm-updatecode has a number of options you can use with  drush pm-update, including --security-only.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The content of this field is kept private and will not be shown publicly.