How to upgrade Drupal 8 to Drupal 9 step by step tutorial

Here we are going to discuss how to upgrade your Drupal 8 website to Drupal 9.

Step1 

First upgrade from 8.X to 8.9.x version.

Step2

Make sure all your all themes and contributed modules compatible with Drupal 8.9 and 9

For checking this first enable update manager module

After installing above  core module you can see  under reports, you can see available updates page.

/admin/reports/updates

In this available updates page check for available updates of each modules. Update each module to latest version which is compatible with Drupal 9. In module page you can see compatibility mentioned as below.

Update module to that specific version using below composer command.

So you can update modules to specific version as below.

composer require ‘drupal/custommodule:^1.2′

Here 1.2 is the comparable version, you can check module view all releases page take version which is compatible with Drupal 9

And then execute below command for updating module.

composer update drupal/modulename withdependencies

Execute below rush commands to complete updates

drush updatedb

drush cache:rebuild

Make sure all Modules are upto date 

Step 3

In custom module and custom theme make sure you  have below line in your *.info.yml. file 

core_version_requirement: ^8.9 || ^9

Change core: 8.x

To 

core_version_requirement: ^8.9 || ^9

Clear the cache .

Step 4

Next we are going to update Drupal Core.

Before that make sure you are doing below updates in your composer.json file.

1)Remove  Drupal console from composer

composer remove drupal/console

2)If you have drush and Devel installed, manually update versions to be below version in composer.

“drupal/devel”: “^4.0”,

“drush/drush”: “^10.0.0”,

3)Make sure below files are editable. Execute below commands to make editable.

chmod 777 web/sites/default find web/sites/default -name “*settings.php” -exec chmod 777 {} ; find web/sites/default -name “*services.yml” -exec chmod 777 {} ;

Run below command

composer require drupal/core-recommended:^9 drupal/core-composer-scaffold:^9 drupal/core-project-message:^9 –update-with-dependencies —no-update

if you have drupal/core-dev installed run below command

composer require drupal/core-dev:^9 –dev –update-with-dependencies —no-update

Step 5

Run below  command

composer require “drupal/core:9.3.3 as 8.9.16″ –no-update && composer update

Update version number as per your requirement.

Step 6

Run drush updatedb command as below.

   drush updatedb 

Now all done , you should see the success message.

If you are still facing any issues with Core. Try below steps

  1.  Run  Composer outdated “drupal/*” and update this listed module into the Drupal 9 version and upgrade the appropriate custom modules and themes with Drupal 9.
  2.   In settings.php  $config_directories[‘sync’] change to $settings[“config_sync_directory”]
Get Free E-book
Get a free Ebook on Drupal 8 -theme tutorial
I agree to have my personal information transfered to MailChimp ( more information )
if you like this article Buy me a Coffee this will be an ispiration for me to write articles like this.

You may also like...