Update Drupal 8 on Debian 10

Select distribution:
Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

Drupal 8 is the latest version of the popular Drupal content management system. While Drupal 8.1 includes a simple feature for incremental updates, you must preform manual Drupal core updates for any preceding versions. This guide demonstrates how to manually install an incremental Drupal 8 update on your Linode. The examples in this guide assume you have a functional Drupal 8 installation running a LAMP stack on Debian 10.

Before You Begin

  1. Complete all the steps in the Install and Configure Drupal 8 on Debian 10 guide.

  2. If you followed the Install and Configure Drupal 8 on Debian 10 guide, your site’s document root should be in the /var/www/html/example.com/ directory, where example.com is your own site’s domain name. You can list all your directories in /var/www/html to verify the location of your site’s document root.

     ls /var/wwww/html/
    
  3. Update your Debian 10 system if you did not complete that step while installing Drupal 8.

     sudo apt-get update && sudo apt-get upgrade
    
    Note

    This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command, visit our Users and Groups guide.

    All configuration files should be edited with elevated privileges. Remember to include sudo before running your text editor.

Create Backups

In this section, you will create an archive of your Drupal site’s files and store the archive in a backups directory. If needed, you could extract the compressed files in your backup archive to restore the state of your site prior to updating it.

  1. Create a backups directory in your site’s document root to store any backups you make of your Drupal site.

     sudo mkdir /var/www/html/example.com/backups
    
  2. Create an archive of your existing site files and move it into the backups directory. Ensure you replace example.com with your own site’s domain name.

     cd /var/www/html/example.com/public_html
     sudo tar -cvzf example.com-BCKP-$(date +%Y%m%d).tar.gz ./
     sudo mv -v example.com-BCKP-*.tar.gz ../backups
    
    Note
    This process can also be scripted and run on a regular basis using cron.

Download Updates

You are now ready to check your Drupal system for available updates. Once you have identified the necessary updates, you will download them as an archive to your Linode.

  1. Log in to your Drupal site and navigate to the Admin Toolbar. Click on Reports and then on Available updates.

    Note
    If Available updates is not listed, enable the Update Manager module by navigating to the Extend menu item in the Admin Toolbar. See Drupal’s documentation for more details on enabling modules.
  2. Right click the link under the RECOMMENDED VERSION heading and copy the link address and paste it somewhere you can access later.

    Note
    If you receive an error when your Drupal 8 installation checks for available updates, it may be having issues communicating with the Drupal website to see if there are updates. You can check your site’s recent log messages, by navigating to Reports and selecting Recent log messages to further investigate the issue.
  3. Connect to your Linode over SSH:

    ssh user@192.0.2.0
    
  4. Navigate to your site’s directory. Download the Drupal core archive using wget and pasting the link address you copied from Step 2. Ensure you replace example.com with your own site’s directory name.

    cd /var/www/html/example.com
    sudo wget https://ftp.drupal.org/files/projects/drupal-8.8.2.tar.gz
    

Upgrade Your Site

Now that the Drupal core archive is saved to your Linode, you are ready to proceed with the version upgrade of your site.

Enable Maintenance Mode

Drupal’s maintenance mode allows users with the right permissions to use your site while everyone else will be presented with a message that the site is under maintenance.

  1. While logged into your Drupal site, navigate to Configuration. Under the Development heading, click on Maintenance mode.

  2. Check the box next to “Put site into maintenance mode.” Enter a message if desired, and click Save Configuration.

Replace System Files

  1. Toggle back to your terminal window and ensure you are connected to your Linode over SSH.

     ssh user@192.0.2.0
    
  2. Navigate to your site’s /var/www/html/example.com/public_html directory and remove existing files and folders except sites and profiles. Ensure you replace example.com with your own site’s directory name.

    cd /var/www/html/example.com/public_html
    sudo rm -ifr autoload.php composer.* example.gitignore index.php LICENSE.txt README.txt robots.txt update.php web.config && sudo rm -ifr core/ modules/ vendor/ themes/
    
  3. Go up one directory to /var/www/html/example.com/ and expand the Drupal core archive that you downloaded in the Download Updates section into your public_html folder. Replace drupal-8.8.2.tar.gz with the name of the archive you downloaded:

    cd ..
    sudo tar -zxvf drupal-8.8.2.tar.gz --strip-components=1 -C public_html
    
  4. From a browser on your local machine, navigate to the following URL on your Drupal site www.example.com/update.php. Ensure you replace example.com with your own site’s domain name. Follow the prompts to continue the update.

    Note
    If update.php does not load or returns a 403 Forbidden error, you may need to update the ownership and permissions of the newly expanded files. For best practices on Drupal site directory and file permissions, see their documentation.
  5. If you are installing additional modules or configuring additional security settings, complete those updates now and continue on to the next step in this section when you are done.

    Note
    The Next Steps section includes a list of Drupal security modules you may consider installing.
  6. Rebuild the site’s cache by navigating to the Admin Toolbar and click on Configuration. Under the Development heading, click on Performance. Finally, click on the Clear all caches button.

  7. Verify your site’s status by viewing its status report. In the Admin Toolbar, click on Reports, then click on Status report.

  8. If the update was successful and your status report does not display any unexpected information, take the site out of maintenance mode by following step 2 in the Enable Maintenance Mode section. Ensure you uncheck the box next to the “Put site into maintenance mode” setting.

Next Steps

As a next step, consider installing additional security modules from the Drupal Project Module:

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.
The Disqus commenting system for Linode Docs requires the acceptance of Functional Cookies, which allow us to analyze site usage so we can measure and improve performance. To view and create comments for this article, please update your Cookie Preferences on this website and refresh this web page. Please note: You must have JavaScript enabled in your browser.