My Drupal 6 to 7 Upgrade Process

Drupal 7 image

Oh, hello! If you’re reading this, it’s the first entry I’ve posted to my blog since upgrading the site to Drupal 7!

A major version upgrade like this isn’t something to be taken lightly. I’ve had to drop certain modules along the way and make a full backup of my site’s database and files. There’s a certain kind of anxiety one experiences when doing a major version Drupal upgrade, so I thought I would share my upgrade process with others. Other Drupal users are invited to share their experience and tips on upgrading at the end of the post!

So you want to upgrade to Drupal 7? Well, here’s how I went about it:

1. Inventory your third party modules

Take stock of third party modules in use on your site. In its Drupal 6 incarnation, I was using CCK, Administration Menu, Boost, Date/Time (Date popup), Geshi Filter, ImageFieldl Assist, ImageAPI/ImageCache, Backup/Migrate, Feedburner, Global Redirect, IMCE, Integrated Metatags, Mollom, Pathauto, Read More Link, Scheduler, Site Verification, Token, Anti Spam, Google Analytics, Views, jQuery UI, WYSIWYG, XML Sitemaps.

A bit of preparation work will save you time in the long run: CCK is largely integrated into Drupal core now, so there’s no need to install it for Drupal 7. The Feedburner module seems to be dead in the water. Integrated Metatags has been replaced with the Drupal Metatag module. The list goes on. You need to check this sort of thing out in advance, because if there’s a critical module on your site that hasn’t been ported to Drupal 7 yet, it’s a bit of a deal breaker. Lesson? Do your prep work!

2. Backup your database

I used the Backup/Migrate Module to backup my site’s database and downloaded it to my hard drive. Worth mentioning that at this point you should consider the site frozen and not be adding any new content or files to it.

3. Backup your CMS files

I also take a full backup of the entire Drupal installation at this point. You can either FTP your files locally, sync them over SSH with the rsync command or just zip up the entire Drupal installation and download the tar.gz file.

I literally tarred up my entire Drupal root and downloaded the tarball, which left me with a reliable database and directory structure in case the upgrade was a disaster and I had to roll back.

4. Maintenance mode

Right, it’s time to start making changes, so pop your site into maintenance mode so that visitors know the site is temporarily unavailable.

5. Disable third party modules and themes

At this point, you want to disable all third party themes and set your theme to one of the Drupal defaults like Garland. This reduces the risk of upgrade problems associated with third party code and brings your site back to a basic Drupal install.

6. Remove the old Drupal installation

Next, I create a subfolder under my ‘sites’ directory and move all the Drupal 6 themes and third party modules from sites/*/modules in there. The D6 versions will be incompatible with Drupal 7 anyway, but these serve as a reminder of which modules need to be reinstalled at the end of the upgrade process.

Once I’ve done this, I create a folder in the site root and move the old Drupal installation in there. This is pretty much everything except the ‘site’ and ‘files’ folders, which contain the bulk of the user-generated content. Again, this is mostly a convenient failsafe in case we need to roll back, and it also ensures a clean Drupal 7 installation. It would be incredibly messy to just overwrite the old Drupal 6 with the new files.

7. Download and unpack Drupal 7 files

Download and unpackage the Drupal 7 files. Whatever your preferred method – FTP the files up to your host, which. An be slow, or my favourite technique: using SSH and downloading and extracting the tarball.

wget http://ftp.drupal.org/files/projects/drupal-7.10.tar.gz
tar xfz drupal-7.10.tar.gz
cd drupal-7.10/
cp –rpf * ../
rm -rf ./drupal-7.10/
rm -f drupal-7.10.tar.gz

The above procedure downloads the latest version of Drupal (7.10 at the time of writing this), extracts it to a subfolder in my web root. I then jump into the Drupal-7.10 directory and copy all the files to the web root. The last two commands are simply cleanup to remove the archive and extracted files.

8. Begin the upgrade process

With all your Drupal 7 files in place, it’s time to visit your site and begin the upgrade process. I found by hitting the homepage, it automatically threw an alert about the ‘existing Drupal site’ and gave a link to run the upgrade script.

However, if there are any lingering issues that need addressed before you can upgrade, you’ll see a diagnostic page detailing what needs fixed before you can continue. Once the upgrade is finished you should be able to see your site content. Breathe a sigh of relief that you’ve got this far and haven’t lost your content!

9. Reinstall and update modules

Now begins the laborious process of downloading, enabling and upgrading the third party modules. I found drush to be essential here. I’d download one or two modules at a time, enable them and then run any attendant database updates. It’s as easy as this (probably easier if you’re a Drush ninja!):

drush dl token pathauto
drush en token pathauto
drush updatedb

I worked through my list of D6 modules and installed the Drupal 7 equivalents. I found that installing the Drupal 7 version of a module meant running database updates, which is why the updatedb command is included here.

It’s probably a good idea to check the functionality of each module as you go along to ensure it’s working as expected and that there aren’t any new settings that require your attention. Also worth checking your Drupal error log and status reports in case you need to address any compatibility issues.

10. Install a Drupal 7 compatible theme

Before I began the upgrade process, I gave my Gerrybot theme a complete overhaul to work with Drupal 7. It’s not quite ready for public use yet – there are a few things I need to tidy up – but I’m hoping to release a version of the theme for other Drupal users shortly.

Hint: If there are any Drupal theming folks who would like to help tidy up the code for public use, please get in touch with me!

Over to you…

So, that’s my Drupal 7 upgrade process. Hopefully others will find it helpful, and hopefully other Drupal experts will take advantage of the comments area to talk about their own process for upgrading from Drupal 6 to 7. If there’s a more streamlined method, I’d certainly love to hear it!

About gerardmcgarry

Gerard is a web designer, blogger and web publisher. He’s one of the founders of the enormously popular UK reality TV blog, Unreality TV and is currently developing its sister site Unreality TV USA.

16 comments

    1. No, don’t uninstall the third party modules. I recommend updating them to the latest D6 version before you do the upgrade, then gradually replace them with their D7 equivalents after you’ve upgraded to Drupal 7

  1. You mentioned before you upgraded, you overhauled your 6 theme to work in 7. Were you able to create the new theme in the 6 environment or did you have a clean install of 7 somewhere to create and test the theme?

    1. I created a test Drupal 7 environment using Xampp so that I could run it offline and develop the D7 version of the theme. Then when I upgraded the site, it was a simple matter of uploading the new D7 version.

  2. Hi Gerard,
    1) In step 9 you recommend to use Drush. I do not have any experience with it and would just use what you recommend. However, I do not even know where to insert these commands. Could you detail that?
    2) I do not have many extra modules. Hence, I could also work through them. Would I install a new (i.e., upgrade a) module and then run ‘www.mydomain.com/upgrade.php’ ? to get the database up-to-date?
    3) if I do not plan to use a module anymore, should I delete the modules data from my database? (it’s not a big database, so there should not be too much data). If yes, how?
    Thank you, Daniel

  3. You make no mention at all of the ./sites/default/default.settings.php file. How did your magical Drupal 7 even find a database when that file didn’t exist?

    1. Hmmm. It’s been a couple of years since I did that upgrade. Bear in mind that it WAS an upgrade, so the file was probably there and in place from the Drupal 6 version. As I say, I can’t quite recall. All I know is that the upgrade went off fairly smoothly.

  4. I have some modules that are not available at Dtupal 7, I can’t upgrade them but really want to use them in Drupal 7. Would you be so kind to advise me what should i proceed with?

    And one more, I found tool called cms2cms that upgrades Drupal content automatedly. Maybe it masters such upgrade? Have you faced with this tool?

    1. Sorry, Mark. The only help I can offer with modules that aren’t available for Drupal 7 is – either find an alternative module that IS available for D7, or consider whether it’s essential for you going forward.

      As for cms2cms, I’m not sure. I’d say it’s probably a decent tool, but do your homework and test the facility before you commit to it. And make sure you’ve got full backups of your database and files before doing ANY upgrade work.

    1. I’m honestly not entirely sure, Henry. I think I did a practice run first on a local server – I cloned my old Drupal site to that and performed the upgrade, noting problems along the way and things to watch out for. Once I was certain I could do the upgrade without issues, I performed it on the live site. Couldn’t tell you how many hours exactly.

  5. Thanks Gerard for this info.
    My drupal 6 site has lots of backend errors and no photos anymore. I have been wanting to upgrade to Drupal 7 for a while.

    I was considering moving to WordPress (which all my other sites are), but will give this a go when I get time.

    Cheers!

  6. Thanks for the writeup.
    I used this writeup to accomplish the upgrade. My problems were mostly with upgrading the theme and the fact that theme variables changed. Also, I was surprised that the Drupal 7 admin toolbar didn’t show.
    Here are my steps
    In a nutshell I copied Drupal 6 over Drupal 7 to run the database upgrade.
    I then used the upgraded database with a clean copy of Drupal 7, so that I could rewrite the theme because the Marinelli theme I was using was totally different for Drupal 6 and Drupal 7 obviously.I had to re import all non-core Drupal modulesThe core search module worked and all my content migrated correctlyAgain .. Thanks for the writeup

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>