Updating your Drupal installation - a couple of nice shortcuts

So having gone from Drupal 5.2 to 5.3 only last week, Drupal 5.4 came out this week and I thought I had better streamline my update process, putting some stuff in place to make the process smooth, quick, easy and *reversible* ... just in case. Since Drupal 5.5 came out while I was sleeping last night, I can now test my own instructions and time the entire update process ... see below for the results.

I run my installation from the terminal on an Apache2 server ... I think this stuff will work for most any Linux server, but I make no promises 'cause I have no idea!

Install the latest Drupal release:
In the terminal login to your server: ssh -l root yoursite.com enter your password then enter: cd /var/www to take you to where your Drupal installation lives.

Go to drupal.org and find the url for the latest release you want to upgrade to. Copy that url (in Firefox, right click and select "copy link location" for example). Back in the terminal enter wget followed by the Drupal tarball url: http://ftp.drupal.org/files/projects/drupal-5.4.tar.gz

Upack/Unzip that file where you are like so: tar -zxvf drupal-5.4.tar.gz

Progress so far: You have the latest version of Drupal on your server and ready to go!

Streamlining for future updates 1:
Here's where we do a couple of little things to make this easier in future. You would normally have to copy our current "sites" directory from the old installation to the new one every time you do an update, but as long as we are only dealing with a newer version (a version that uses the same files and structures) we can save ourselves that step and give all the site on our drupal installation a permanent home outside of the Drupal installation itself.

Move your "sites" folder from your current Drupal to the root area: mv -r drupal-5.4/sites . - this moves the sites folder to your current location, i.e. the root level.

TIP ONE: The grammar of this command is mv MOVE -r RECURSIVELY (i.e. folder and all contents) drupal-5.4/sites FOLDER to . HERE ("." = current location). Alternately, you can also put in a second absolute path to any other location in place of the "." - here, that would be mv -r drupal-5.4/sites /var/www/sites - you can even rename the newly moved file as you go like so: mv -r drupal-5.4/sites /var/www/new_sites ...

TIP FOR YOUNG PLAYERS - PRACTICE SAFE TERMINAL: This mv -r drupal-5.4/sites . will move the FOLDER you want and all of its contents to a new location (in this case "here"), but this: mv -r drupal-5.4/sites/ . (note the trailing slash) will ove only the CONTENTS of the given folder and place it here ... not a mistake you want to have to undo if you can avoid it! It can leave a big mess, I promise.

Back to business ...
Now remove the "sites" folder from your new Drupal installation: rm -r drupal-5.4/sites.

Your Drupal installation now needs to know where to find the sites folder now that you have taken it from where it is supposed to be. Replace it with a symbolic link (symlink) called "sites" that points to the folder in its new location and Drupal will never know the difference! (It treats this link as though it were the folder itself.) ln -s /var/www/sites/ /var/www/drupal-5.4/sites [ln MAKE LINK -s SYMBOLIC /var/www/sites WITH THIS TARGET /var/www/drupal-5.4/sites WITH THIS NAME IN THIS LOCATION - as above, the "." or the absolute path are interchangeable.]

The good news: Now you never have to move your sites folder around or copy it into a new installation - this means all your changes and content will remain the same even if you change between versions - especially nice if you have to roll back to an older version after having created new content or themeing changes! Whenever you install an updated version of Drupal, delete the sites folder in the new version (rm -r old_drupal_version/sites) and replace it with a symlink to your permanent, root-level sites folder (ln -s /var/www/sites /var/www/new_drupal_version/sites)

So just in case you have any problem at all with the new version, you can almost instantly switch back to the old version without reconfiguring/copying/worrying about your content and themeing - don't delete older versions until you are sure everything is okay. The last steps in this reversible update process now follow ...

You won't even need to restart Apache after your next update if you do this:
Make sure you are in your root area: cd /var/www, then create one more symlink: ln -s drupal-5.4 ./document_root. This symlink says "When you point at me, I point you to drupal-5.4" - more on this in a minute.

There is a file in Apache for each of the sites in your Drupal installation that tells the server where to go to find it: since we have a new version of Drupal, we want Apache to go there now. Go to this location: cd /etc/apache2/sites-available - each site has a small file with two lines like this:

DocumentRoot /var/www/drupal-5.3
<Directory /var/www/drupal-5.3>

and we have to manually change each drupal-5.3 to drupal-5.4 now AND restart Apache ... every time we update Drupal ... but no more!

Change the specific Drupal version reference to "document_root" - the symlink we made before - in every file:

DocumentRoot /var/www/document_root
<Directory /var/www/document_root>

Restart Apache: /etc/init.d/apache2 restart ... for that last time!

Now that you have all of this in place, you only need to change the target of the symlink in your root location to point at the new Drupal installation and all of your sites will point to it without a server restart and without changing all of the "sites-available" entries manually every time. Providing that your old installation is also set up in this way, changing versions of Drupal becomes a matter of changing one, single symlink! Whee!

Whew! That looks like a lot, but once it is set up right the first time, this set up makes these updates a breeze! Now check that all your sites are running properly, run update.php if a site asks you to and you are good to go.

Summary w/full set-up:
- Get and unzip tarball of latest Drupal release to your root folder.
- Move the "sites" folder of your current Drupal installation to your root folder
- Remove the "sites" folder from the new Drupal installation
- Put symlinks to the relocated "sites" folder in *both* installations, old and new.
- Create a symlink, "document_root" in your root folder that points to the new Drupal installation
- Change all references to a specific installation in the files contained in /etc/apache2/sites-available to refer to "document_root" - 2 references per file/site!
- restart Apache
- check sites, update if needed
- make coffee

Summary for the subsquent time(s):
- Get and unzip tarball of latest Drupal release to your root folder.
- Remove the "sites" folder from the new Drupal installation.
- Put a symlink to the relocated "sites" folder in the new installation.
- ***Change the "document_root" symlink to point to the new Drupal installation!***
- check sites, update if needed
- make coffee

Test Results:
Including the time it took me to correct my typos in this post, my entire update to Drupal 5.5 took me five minutes! I guess without the typos, I would have been done in under three. As far as I am concerned, that is definitely worth the time it took to set up my server for this.

Comments

open credit card business

bank one credit card balance

card credit number sample

credit card application for

Very Nice Site! Thanx!
http://airline-credit-card-bad.reestablish-credit-cards.cn >how can i improve my credit score when i have crdit cards that are charged off
http://centennial-secured-cedit-cards.bad-credit-holder.cn/eligibility-d... >which credit report does orchard bank use to determine eligibility
http://rebuilding-credit-bad.creditimprovingredit.cn/restore-credit-scor... >how long does it take to restore bank credit score
http://creditimproving-cresit.cn/because-credit-money-too.html >money because credit is too bad
http://people-credit-cards-visa.highriskcredcard.cn/mastercard-instant-a... >bad credit mastercard instant aprovel

credit card for students

Very Nice Site! Thanx!
http://credtit-credit-cards-bad.bad-credit-carda.cn/rebuilding-backrupct... >rebuilding backrupcty credit
http://bad-credit-jeweler.cn >6000 dollar credit limit poor credit
http://bad-credit-cad.creditcard-poor-credit.cn/credit-rebuilding.html >credit rebuilding
http://permier-master-first-card.bank-poor-credit.cn/rebuild-bredit-cred... >bredit card to rebuild credit
http://bad-criedt-card.cn >creditcards w no credit bad credit no deposits

loans or credit cards

credit card for online shopping

Very Nice Site! Thanx!
http://creditimproving-creidt.cn/leading-credit-banks-bad.html >bad credit banks for leading
http://creditcards-for-bad.cn/mastercard-minimum-dollars-credit.html >visa or mastercard with a minimum of 5000 dollars with bad credit
http://repair-bad-credit.creditimproving-crediot.cn/rebuild-credit-now.h... >rebuild credit now
http://clearing-bad-credit.cn >majestic aspire visa card
http://highrisk-crdut.cn >bad credit master card

problems with credit cards

change credit card payment

accept credit cards online free

Very Nice Site! Thanx!
http://reestablishing-credit-ways-your.highriskchredit.cn/mastercard-uns... >unsecured visa or mastercard for people with bad credit
http://approval-instant-credit-cards.bd-credit-cards.cn/creditcard-credi... >i have bad credit but i need a creditcard
http://credit-repair-forums.cn/wwwcredit-card-bad.html >www.credit card bad
http://money-bad-credit.cn >build your credit with bad credit
http://credicars-credit-bad.creit-cards-poor.cn/credit-have-want-card.ht... >i have bad credit i want a gas card

credit card acceptance

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre>
  • Lines and paragraphs break automatically.

More information about formatting options