How to Update Drupal 8 on CentOS 8
Traducciones al EspañolEstamos 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.
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 CentOS 8.
Before You Begin
Complete all the steps in the Install and Configure Drupal 8 on CentOS 8 guide.
If you followed the Install and Configure Drupal 8 on CentOS 8 guide, your site’s document root should be in the
example.comis your own site’s domain name. You can list all your directories in
/var/www/htmlto verify the location of your site’s document root.
Update your CentOS 8 system if you did not complete that step while installing Drupal 8.
sudo yum update
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
sudocommand, visit our Users and Groups guide.
All configuration files should be edited with elevated privileges. Remember to include
sudobefore running your text editor.
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.
backupsdirectory in your site’s document root to store any backups you make of your Drupal site.
sudo mkdir /var/www/html/example.com/backups
Create an archive of your existing site files and move it into the
backupsdirectory. Ensure you replace
example.comwith 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
NoteThis process can also be scripted and run on a regular basis using cron.
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.
Log in to your Drupal site and navigate to the Admin Toolbar. Click on Reports and then on Available updates.
Right click the link under the RECOMMENDED VERSION heading and copy the link address and paste it somewhere you can access later.
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.
If your CentOS installation is running in enforcing mode, ensure you are allowing httpd to make network connections. One way to do this is to set the corresponding SELinux boolean to
sudo setsebool httpd_can_network_connect true
Also, ensure that firewalld is allowing
sudo firewall-cmd --zone=public --add-service=https
Connect to your Linode over SSH:
Navigate to your site’s directory. Download the Drupal core archive using
wgetand pasting the link address you copied from Step 2. Ensure you replace
example.comwith 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.
While logged into your Drupal site, navigate to Configuration. Under the Development heading, click on Maintenance mode.
Check the box next to “Put site into maintenance mode.” Enter a message if desired, and click Save Configuration.
Replace System Files
Toggle back to your terminal window and ensure you are connected to your Linode over SSH.
Navigate to your site’s
/var/www/html/example.com/public_htmldirectory and remove existing files and folders except
profiles. Ensure you replace
example.comwith 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/
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
drupal-8.8.2.tar.gzwith the name of the archive you downloaded:
cd .. sudo tar -zxvf drupal-8.8.2.tar.gz --strip-components=1 -C public_html
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.comwith your own site’s domain name. Follow the prompts to continue the update.
update.phpdoes 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.
NoteThe Next Steps section includes a list of Drupal security modules you may consider installing.
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.
Verify your site’s status by viewing its status report. In the Admin Toolbar, click on Reports, then click on Status report.
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.
As a next step, consider installing additional security modules from the Drupal Project Module:
This page was originally published on