This is a tutorial on how to update your site’s Drupal 8 to another minor version using SSH.
If you haven’t already, put your site into maintenance mode and log in to SSH using your login details.
- Go to your site’s root directory using: cd /home/yoursite/public_html
- Create a temporary folder to hold your current Drupal’s “old” files/folders to keep as a backup incase the upgrade does not succeed. Use: mkdir cmsbackup
Paste the code below in the following command which will move all of your Drupal’s files and folders next to your other folders like /sites and modules/ into the just created folder “cmsbackup”:
mv core vendor modules profiles sites themes web.config .csslintrc .editorconfig .eslintignore .eslintrc .gitattributes example.gitignore .htaccess composer.json composer.lock autoload.php index.php update.php LICENSE.txt README.txt robots.txt ../
NOTE: Feel free not to include .htaccess and robots.txt since your original files may already be altered.
- Go to Drupal.org and retrieve the latest version for Drupal and the download link. You should read the UPGRADE.txt files for each version before upgrading. If you are upgrading between major releases like from 7.x to 8.x, you should be more careful.
Use one of the below commands to download the file.
- Remove your current Drupal’s core and vendor folders completely by using the commands below separately:
rm -R core
rm -R vendor
- Extract the freshly downloaded file using the command below. This will create its own sub-folder like drupal-8.1.7.
tar -zxvf drupal-8.1.7.tar.gz
NOTE: you may replace the full drupal folder name with just drupal-* if you just have one folder called drupal. If not, just use the command from step five.
- Move into the new directory you just extracted using the command below:
NOTE: Or you can use cd drupal-*
- Use the command below to move the newly upgraded Drupal files out of the folder they were extracted into and into your site’s root directory:
mv core vendor web.config .csslintrc .editorconfig .eslintignore .eslintrc .gitattributes example.gitignore .htaccess composer.json composer.lock autoload.php index.php update.php LICENSE.txt README.txt robots.txt ../
- Move back one directory into your root directory using the following command:
cd .. (Move back one directory)
- Completely remove both the newly extracted Drupal folder and the downloaded file ending with tar.gz (before extraction) using the command below:
rm -R drupal-*
- Go to your website’s update.php file in your web browser to check if there are any necessary updates and changes that need to be made to your core’s database tables. (Example: http:///www.yoursite.com/update.php)
If you are unable to access your update.php file, open settings.php with a text editor and find the following line that says: $settings[‘update_free_access’] = FALSE;
And change it into:
$settings[‘update_free_access’] = TRUE;
Then try again in running update.php. When the update is complete, the TRUE setting must be reverted to FALSE.
- Go to Administration > Reports > Status report. Make sure everything is working as intended. If you see red highlight the core version, check the available updates to make sure that the core and everything else is highlighted with green. You may go back to status report, and the red highlight should disappear.
- Disable maintenance mode.