I’ve already explained the procedure of upgrading from Drupal 7 to Drupal 8 in a previous article.
Kudos to you if you’ve already ventured into the awesome realms of Drupal 8. Now as far as being on the cutting-edge goes, the next thing you will need on this adventure is to know how to update Drupal core to each of its latest versions.
Please note that in the world of Drupal, “Upgrade” means changing to a major version such as from Drupal 7 to Drupal 8. On the other hand, to Update Drupal core means updating to a minor version such as from Drupal 8.2.5 to Drupal 8.2.6.
In this tutorial I am going show you the steps needed to upgrade your Drupal 8 version to its latest releases.There are three main ways to update Drupal 8 Core, which are:
Since the composer and Drush methods are the easiest ones, I’ll show you how to update using these first. If in case, you aren’t able to update using these methods, you can go with the manual method which is a bit more complex but more thorough. It is a good practice to activate maintenance mode from your Drupal admin area before making any changes to your site.
Note: Make sure to always backup your site before attempting to update to avoid any loss of data in case of any mishap.
Composer is a very powerful dependencies management tool for PHP based applications. To read more about Composer, you can head over to its official page for Drupal.
To update via composer simply run the “composer update” command in your site’s CLI (Command Line Interface).
Note: Composer is pre-installed on Cloudways servers.
Drush is a shell interface for Drupal that allows you to perform administrative tasks from your cloud server command line itself. If you prefer using Drush over composer to update your Drupal core, you can follow the step given below to achieve that.
- Install Drush: To learn how to install Drush you can head over here.
- Backup: Always backup your site before making any core changes. You can make a backup of your site via drush through this command: drush archive-dump
- Put site in maintenance mode: As i mentioned before, it is always recommended to put your site in maintenance mode prior to making changes in your site. You can do this through Drush through the following command: drush sset system.maintenance_mode 1
- Run Update command in Drush: Now you need to run the following command to perform the update: drush pm-update
- Put site online: After update is performed, enter the following command to put your site back online: drush sset system.maintenance_mode 0
That’s it. It’s as simple as entering 3 commands to update your Drupal 8 core to drush.
Manually Updating Drupal 8 Core
This is the most tedious method but also the one which is most thorough. The steps involved in this method are as follows:
- Download and extract the latest version of Drupal from here.
- Login to your site’s admin panel using your admin credentials.
- Backup your database (ex: through PHPMyAdmin) and website before proceeding.
- Put your site in maintenance mode by navigation to configuration -> maintenance mode
- Remove ‘core’ and ‘vendor’ directory from your project. Also remove all the files from your project’s top-level directory, leaving out any files that you made changes to.
- Upload the core directory from the Drupal version you downloaded in step 1 to your project.
- Upload .htaccess, composer.lock and composer.json files from the downloaded Drupal version to your project.
- Upload vendor directory from the download Drupal version to your project.
- Go to yoursite.com/update where “yoursite” is your website’s domain name.
- Follow the onscreen instructions.
Updating your Drupal 8 core is a pretty straightforward and easy task once you grasp the basics of it. It is very important to update Drupal core for a variety of reasons which I will cover in a future article, so be sure to stay tuned for that.
We also saw in this article how tools like Composer and Drush make it incredibly easy to update Drupal 8 core. Let me know in the comments if you get stuck at any point and I’ll be happy to help you out.
Create interactive Drupal websites easily on the Cloud.
Host your website on optimized Drupal hosting servers.