| Drupal

You should always update to the latest version of Drupal to take advantage of updates and to also guard your site's security. It's not a difficult process, but there are quite a few steps if you want to avoid errors and get it right the first time. This tutorial shows you every step involved.

Here's how to update your Drupal 6 core files:

Backing up your site files and your database before you begin

You need two elements to constitute a complete backup.

  1. A copy of all the files in your current Drupal home directory. You can use FTP to download them, or your server's file manager to copy them to another directory.
  2. A copy of your data base. You can use phpMyAdmin to export an SQL file to save.

Here are some tutorials we have you might want to review to hone your backup skills.

If you want the Drupal Backup and Migrate module, you can download it here: http://drupal.org/project/backup_migrate

Step 1. Checking for updates

tutuploadsmedia_1331686008050.png

Go to Administrator. If you require security upgrades you will see a warning message. Inside the warning message is a link to check for available updates.

tutuploadsmedia_1331688212791.png

You can also check for Available updates under the Reports menu. Running a Status Report is also a good idea. You'll see the status of your entire installation.

tutuploadsmedia_1331686069135.png

Checking Available Updates will tell you your current version, the recommended version and links for downloading what you need. You can go directly from 6.22 to 6.25. You can skip 6.23 completely.

Step 2. Create a duplicate of your current site

Don't upgrade a live site. Always work on a copy.

We have a great tutorial on making duplicates of your site using the Backup and Migrate module. Check it out for detailed instructions. If you prefer you can simply download your entire database using phpMyAdmin and use FTP to download all the files in you drupal directory, and keep those downloads as a backup.

Step 3. Login to your site as User 1

tutuploadsmedia_1331691889363.png

Login to Drupal as User ID #1. This user has special privileges, including use of the Backup and Migrate module if you are using it. But to run the upgrade.php script, which we'll do in a later step, you need to be logged in as user ID #1. You can find our more about Drupal User 1 here.

Step 4. Take your site Off-line for maintenance

tutuploadsmedia_1331692086287.png

Go to Site Configuration > Site Maintenance. Choose Off-line and click Save Configuration.

Step 5. Disable all contributed or custom modules

tutuploadsmedia_1331692635667.png

Go to Site Building > Modules. Uncheck the contributed modules. Click Save configuration.

Step 6. Switch to a core theme

tutuploadsmedia_1331693262827.png

Switch to a core theme (for instance, Blue Marine) or any of the ones that originally came with the basic drupal installation.

Step 7. Remove all Drupal files except for the sites folder.

Use your file manager or FTP program or a shell command to remove everything EXCEPT edited files and the sites folder. Keep any files you've edited, such as the .htaccess or robots.txt files.

The sites folder has everything you've added and all the files you've modified. Everything except the drupal core files and the database. If you followed the Drupal principle of "Never hack core" you'll be able to get everything back to normal as long as you have a sites folder that is intact. This is one reason you want to be working on a copy and have a backup.

Step 8. Decompress the upgrade, and load the files to the server using FTP - except for the sites folder.

tutuploadsmedia_1331694789966.png

The thing to make sure of here is that the new files do not overwrite anything you've saved from the original version. After you decompress the files, delete the new sites folder so there is no chance of overwriting the one you are upgrading,.

As you can see, I've created a test directory called UPGRADE and I've removed everything but the sites folder. Upload all the new folders and files to the UPGRADE directory, except for one.

NOTE: There are several procedures you could use for file transferring. For example, you could alternately decompress the upgrade file into on the server, delete the sites folder, and then copy the original site folder into the new directory. Either way, you want all your old sites folder and all brand new core files. Don't forget any htaccess or robots.txt files from the original site as well.

The problem with this for beginners, is trying to copy and transfer files in the sites/default directory. The default directory permissions may be 555 and the settings.php file 444, so a copying and saving things there might fail. You need to deal with the permissions in the sites directory. You will need to CHMOD all the folders recursively from sites on down to 755. You will also need to make all the files at least 644 (especially the settings.php file). Change them back when you're done for security.

tutuploadsmedia_1331699257056.png

If you try to visit your test site, by going to your URL you will see that it is offline.

Step 10. Login again

tutuploadsmedia_1331699576602.png

Login to your site's admin by going to http://yourSite.com/user?locallogin. (in my case http://yourSite.com/UPGRADE/user?locallogin. Enter the username and password for User 1.

Step 11. Run update.php

tutuploadsmedia_1331699711337.png

Once you are logged in, enter http://yoursite.com/update.php (in my case it's /UPGRADE/update.php) You must be logged in as user 1 to begin the upgrade. Otherwise you will get a message telling you how to edit the configuration file to allow the update to proceed.

tutuploadsmedia_1331699755945.png

Click Continue. If you made the backup before you started you don't have to do it again.

tutuploadsmedia_1331699778853.png

Click Update.

Successful Update

tutuploadsmedia_1331699833459.png

The image above shows a successful update response. If you get error messages at this point you need to try to correct them before moving on.

Step 12. Enable all the installed modules.

tutuploadsmedia_1331700582590.png
  • Return to Administration Pages.
  • Go to Site building > Modules.
  • Place checks next to all the modules you want to activate.
  • Scroll to the bottom of the page and Save.
  • Run update.php AGAIN to update the database tables for the modules.

Step 13. Run update.php after module installation

tutuploadsmedia_1331700927714.png

This time you can run update.php from a link on the modules page.

Step 14. Run Reports - Available Updates

tutuploadsmedia_1331701129564.png

Go to Reports > Available updates. Everything should be green, and your new version number should be visible. If anything needs to be updated you'll spot it here and be able to download the newer version.

Step 15. Give it a test run.

It would be a good idea to give it a test run at this point and check out some common tasks.

  • Create content.
  • Upload files.
  • Check for broken links.
  • Check out all your modules and make sure everything is running correctly.

If everything is OK, you can now you can activate your theme. I usually do a check before I introduce the theme to keep the number of variables to a minimum.

Step 16. Activate or upload your custom theme.

tutuploadsmedia_1331703186594.png
  • Go to Site building > Themes.
  • Upload or activate a theme.
  • Run update.php again.
  • Transfer and test any edits or hacks you made to module or themes. Make sure you have the correct .htaccess file and robots.txt file and any others you need.
  • Do a thorough final check of the test site.
  • After that you're ready to go live.

Step 17. Put your site back Online

tutuploadsmedia_1331703403448.png

Go to Administer > Site configuration >Site Maintenance as you did in Step 4. and change the Site status back to Online.
Save the configuration.

If all is going well you are ready to open to the public. Move your newly updated site to your main directory.

TIP: Move or copy your old site to a backup directory instead of deleting it. It makes for an easy recovery if something breaks.