Skip to content Skip to navigation

Drupal 7 Installation Instructions

Posted by: 
Topics: 
Tags: 
[Reviewed for Drupal 7.14 on 2012-05-03]

This quick note outlines the additional steps required for installing Drupal 7 on the central web infrastructure (www.stanford.edu and AFS). In other words, it doesn't show all the steps (download Drupal, untar it, etc.), just the few steps needed that are special to our infrastructure.

Allowing Drupal to install by changing the .htaccess file

After you've downloaded Drupal, you'll need to modify the .htaccess file that comes with it before you do anything else or the installation won't even start. You'll get an error from the web server.

Comment out the following line found towards the beginning of the .htaccess file:
# Follow symbolic links in this directory.
Options +FollowSymLinks
so that it looks like this:
# Follow symbolic links in this directory.
# Options +FollowSymLinks

Preparing for Clean URLs

Drupal 7 will check whether the server supports clean URLs during installation and will turn them on if it does. To do this, Drupal 7 needs a little help. It requires a change in the .htaccess file. Find these lines at the bottom of the file:

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
and uncomment the RewriteBase part, specifying the location of your drupal install. If you placed it in /afs/ir/dept/its/cgi-bin/drupalrocks, you'd change the lines to read:
  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  RewriteBase /dept/its/cgi-bin/drupalrocks

That's it for the .htaccess file.

Database Settings

You can now proceed with the installation. At some point Drupal will ask you for the database information. (You can request a MySQL database here.) By default, it wants to use localhost as the database host. That won't work as the database server is not on the same server as the web server.

Make sure to use 127.0.0.1 for the Database host under Advanced Options. This will use stunnel to connect from the web server to the MySQL server. It has the added benefit of encrypting communication between the two.

Post Installation Tweaks

Drupal 7 might create an .htaccess file in your /sites/default/files directory containing lines starting with the word "Options". This will cause files, such as images, not to appear on your site. You can comment those lines out if you observe your images not loading, or do a bit of pre-emptive work and create a blank .htaccess file yourself (which might stop Drupal from creating its own version).

The .htaccess file will look like this:

SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
Options None
Options +FollowSymLinks
Change it to:
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
#Options None
#Options +FollowSymLinks

Running Cron

To set up cron so that cleanup and indexing tasks can be run independently, see John Bickar's excellent guide: Running Cron

A note about /tmp

For Drupal 6.x we used to have to set the temporary directory to one in AFS so that it could be shared amongst all the web servers (/tmp isn't shared). This was particularly important when uploading multiple files. This hasn't cropped up yet in Drupal 7. If you encounter issues that might seem related to Drupal losing some files after it has uploaded them, please let us know on drupallers@lists.stanford.edu.