Drupal‎ > ‎

Drupal installation

[draft; outdated!]  

Summary: This page describes, both at a high level and in detail, how to install Drupal 6.x. This page also provides links to installation-related resources.

Background

A Drupal site has two basic components: (1) the Drupal code, and (2) the site content. The Drupal code consists mostly of various PHP files; the site content is stored in a SQL database. Setting up Drupal therefore involves two distinct operations:
  1. Creating a SQL database to store the site content; and
  2. Installing the Drupal code and configuring it to interface properly with that database.
Drupal comes with a good installation script, so basic installation is easy—perhaps too easy: you can get a Drupal site up and running without really having any idea how you did it. But it's worth understanding a few things about Drupal's installation and operation routines.
  • First, Drupal serves all requests from a single web page: index.php, within your Drupal-code directory.
  • Second, when you visit your Drupal-code directory with a web browser, Drupal looks for a file called settings.php to determine how to respond.
    • After you have installed Drupal, settings.php will contain the information Drupal needs to deliver your content—most importantly, settings.php will have the name of the SQL database that stores your site content, along with a username and password for Drupal to access the database.
    • Before you have installed Drupal, settings.php contains dummy values.
    • If Drupal finds dummy values in settings.php, Drupal runs its installation script.
      • Note that Drupal runs its installation script automatically if you browse to a site's root and Drupal finds a settings.php file containing dummy values. Thus, you do not need to run the installation script (install.php) directly. If you do run it directly and Drupal finds a settings.php file containing non-dummy values, you will get an error message (since non-dummy values in settings.php mean that Drupal has been installed).

About settings.php

Drupal looks for the settings.php file in a subdirectory of the /sites/ directory within your Drupal-code directory.

Drupal first looks to see whether there is a specific subdirectory within /sites/ that corresponds to the URL of your site. If not—and, if you do a barebones Drupal installation, there will not be any such specific subdirectory—Drupal looks for settings.php in the /sites/default/ directory, and the installation script will modify that file.
  • I advise you to create a site-specific directory for settings.php instead of letting Drupal modify /sites/default/settings.php.
  • I also advise you to not install Drupal in your web server's public root directory. Instead, I suggest that you always install Drupal in its own subdirectory; this will make your site more flexible and easier to maintain.
(Note: At least one person suggests putting your Drupal code entirely outside your web server's public root directory and using symbolic links to make the code work. That might be a good idea, but it's fairly complicated. For now, I am sticking to the basics).

Detailed instructions

  1. Copy Drupal code to a subdirectory of your web server's public root directory.
    1. You can do this at the command line or via FTP.
      1. If you plan to do it by FTP, get the latest release from Drupal.org.
    2. For purposes of these instructions:
      1. Web site = www.example.com
      2. Web server's public root directory = /docroot/
      3. Drupal subdirectory = /docroot/drupal6/
  2. Create a subdirectory for your site in /sites/ (within /docroot/drupal6/) and copy settings.php with dummy values to this subdirectory.
    1. For purposes of these instructions:
      1. Site = www.example.com
      2. Site-specific subdirectory for settings.php = /docroot/drupal6/sites/www.example.com/
        • The name of the site-specific subdirectory is derived from the name of your site. In fact, here it is identical to the name of your site—but it won't always be. I go into the conventions of naming subdirectories in more detail in my page on multisite installation.
    2. To get settings.php with dummy values:
      1. Copy the file default.settings.php from the /sites/default/ directory (i.e., here, /docroot/drupal6/sites/default/) to the site-specific directory you just created (i.e., here, /docroot/drupal6/sites/www.example.com/)
      2. Rename this file settings.php.
  3. Create a SQL database for your site. 
    1. Drupal uses the database name and settings for internal purposes only, so you can use whatever you want. (But be sensible!)
    2. Exactly how to create the database will depend on your hosting platform, but you will need to specify several things:
      1. A user that Drupal will run as. This user basically represents Drupal itself, not a human being. With respect to this user, you need to specify:
        1. The password for the username.
          1. Write down the username and the associated password. Drupal's installation script needs them.
        2. The host for the username. (This is probably "localhost," but will depend on your web-server setup.)
          1. [To be added: XAMPP convention; NFS.net convention]
        3. The privileges for the username, either global or database-specific.
          • The user needs to have eight specific privileges with respect to your Drupal site's database. I find it easiest to create the user and assign the needed privileges to the user as "Global" privileges. Alternatively, you can give the user the necessary privileges on a database-by-database basis.
          • The eight priviliges needed are:
            • SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP
          • Note: These are the privileges needed according to INSTALL.mysql.txt in the Drupal 6 installation files. Drupal 5 required two privileges that Drupal 6 does not: CREATE TEMPORARY TABLES and LOCK TABLES (see Drupal 5 documentation).
      2. The database name. Again, write it down; you will need this to set up Drupal.
      3. The database's collation type: set it to utf8_unicode_ci.
        • It's possible that utf8_general_ci will also work. 
  4. Browse to your Drupal directory to run the installation script.
    1. In my example, you would browse to: http://www.example.com/drupal6/
      • Since settings.php in the directory /sites/www.example.com/ has dummy values, browsing to the Drupal directory will cause Drupal to run its installation script.
    2. Alternatively, you could (but need not) browse directly to the installation script, install.php.
      • In the example given here, you would browse to http://www.example.com/drupal6/install.php.
    3. Follow the prompts, and supply the information about the associated database (i.e., username, password, and possibly hostname).

Installation instructions

  • Install Drupal in \htdocs directory, which is where XAMPP puts web-accessible files
    • To keep this separate from other Drupal installations, I installed all the book's source files in a \usingdrupal subdirectory pf \htdocs
    • So the path to Drupal's main installation script is http://localhost/usingdrupal/drupal/install.php
    • And navigating to http://localhost/usingdrupal/drupal/ pulls up Drupal's installer, which asks you to select an "Installation Profile"
      • I picked Wiki
      • Freakishly, I get a timeout: Fatal error: Maximum execution time of 60 seconds exceeded in F:\xampp\htdocs\usingdrupal\drupal\includes\file.inc on line 886
        • Why am I having this problem on an dual-core Athlon machine?
        • I tried to solve this through the method mentioned here: increasing php_value max_execution_time in .htaccess to 600
  • Using phpMyAdmin (at http://localhost/phpmyadmin/), create a user that Drupal will run as. This user is basically "Drupal itself," not an actual user.
    • Go to "Privileges" tab and click "Add a new user." (I am creating the user before the databases and granting the user global privileges on all databases. I'm not sure this is a great idea for a production environment.)
      • Pick any name (I picked "usingdrupal")
      • Set "Host" dropdown to "Local" (this will fill in "localhost" in the adjacent textbox)
      • Enter a password (I picked "oreilly" to be consistent with the book)
      • Leave the radio button for "Database for user" set to "None"
      • Under "Global Privileges," check the following:
    • (Note: Typical Drupal-installation instructions tell you to (1) create the database, (2) create a user (Drupal itself), and (3) grant that user privileges on the database.)
  • At the phpMyAdmin home page, create eight MySql databases (one each chapters 3–10 in Using Drupal)
    • jobs, reviews, wiki, newspaper, gallery, i18n, events, store
    • For each database:
      • In phpMyAdmin, create new database: (1) enter its name, and (2) change "collation" dropdown to utf8_unicode_ci (the Drupal documentation buries this requirement).
      • (Note: It's unclear to me whether you should change the "MySQL connection collation" setting, which (by default) is utf8_general_ci. I think not. It's also unclear to me whether this is necessary, since the utf8_general_ci may be insignificantly different from utf8_unicode_ci)
    • If you didn't create a user and assign global privileges as discussed above, you'll need to create a user and assign it either (1) global rights, or (2) rights to each particular database.
    • To assign the user rights to each database
      • If you haven't yet, create a user that Drupal will run as (a "Drupal-itself" user)
      • In "Privileges" tab of phpMyAdmin (at http://localhost/phpmyadmin/), click on the username for the Drupal-itself user
      • In the "Database-specific privileges" box, select one of the databases in the dropdown list that says "Use text field"; the page will change and allow you to grant particular privileges on the chosen database alone.
  • Create subdirectories under Drupal's \sites directory to hold, at least, separate settings.php files for each database
    • This will be a "multisite" Drupal installation. I hope.
    • So the directories are: \htdocs\usingdrupal\drupal\
      • jobs.usingdrupal.local
      • reviews.usingdrupal.local
      • etc



Resources

Modules


I had hoped that the Acquia Drupal package would solve some problems by packaging most of the key Drupal modules, but it's missing one essential one: a WYSIWYG editor. So I think I'll still basically roll my own Drupal installation. (Though Acquia does have much better installation instructions than Drupal itself.)


General setup

Multisite installation

Note: I will be posting my own page about multisite installation at some point.
Comments