How To Install Drupal

Overview

These instructions assume that drupal runs as the root web application, and that port 8080 is used. Instructions are included to use clean urls. Also, I assume that you have root access to the server.

Install Operating System

Install CentOS as documented in Base Installation of a CentOS Server.

Install packages required by drupal with the following:

yum install httpd mod_ssl php php-gd php-mbstring php-mysql mysql-server

Get Drupal

Retrieve and expand drupal. (Modify url to retrieve most recent release.)

cd /root
wget http://ftp.drupal.org/files/projects/drupal-5.3.tar.gz

rmdir /var/www/html
tar -zxvf drupal-5.3.tar.gz
mv drupal-5.3 /var/www/html
cd /var/www/html
chmod 744 sites/default/settings.php
mkdir files
chown -R apache:apache .

Setup Database

Create a password for the database root account:

mysqladmin password 'admin'

Create an empty database for drupal to use.

Adjust PHP Settings

Increase amount of memory available to PHP scripts from 8MB to 16MB. To do this, modify /etc/php.ini so that the following line specifies 16 MB. This will enable color selection in the themes configuration page.

memory_limit = 16M      ; Maximum amount of memory a script may consume (8MB)

Configure Apache

Configure httpd to run when the system initializes.

chkconfig httpd on

Modify /etc/httpd/conf/httpd.conf to include the following line:

Listen 8080

To start the daemon now with out rebooting, do the following.

service httpd start

Open port 8080. (See How to Open a Port if you don't know how to open port 8080.)

Create file /etc/httpd/conf.d/drupal.conf with the following contents.

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

If you have other applications or static content on the site, you need to either add RewriteCond's to the above or intercept in some other way.

Restart apache.

service httpd restart

Access Drupal

Modify /var/www/html/sites/default/settings.php by adding the following line. (Modify to suit your environment.)

$base_url = 'http://web0.ias.csusb.edu:8080';

Go to the site with a browser, and follow instructions to create database and initial user account.

Configure Cron Job

Drupal needs to perform house cleaning operations. Add the following line to /root/cronfile so that cron.php runs hourly.

45 * * * * /usr/bin/wget -O - -q http://localhost:8080/cron.php

Reset your cron jobs with the following.

crontab /root/cronfile

Run the cron.php immediately with the following, in order to eliminate a problem from the drupal status report.

/usr/bin/wget -O --q http://localhost:8080/cron.php

Configure Drupal

In drupal, go to Administer >> Site building >> Modules and enable the Path module. (This is for clean urls.) Also, enable other modules that you will use; I enabled Statistics and Upload.

In drupal, go to Administer >> Site Configuration >> Clean URLs. Click on the test clean urls test link, and then select the enable url radio button and save configuration.

Configure Theme

Create a themes directory.

cd /var/www/html/sites/all
mkdir themes
chown apache:apache themes

Similarly, create a directory called modules if you are going to install additional modules. This is explained in the readme file in sites/all.

I copied the pushbutton theme into this directory, renamed it csci, and then modified page.tpl.php and style.css to get what I wanted. To make the theme current, go to Administer >> Site building >> Themes.

If you want to use the suggested zen theme, replace the following with your own customizations.

cd /root
wget http://ftp.drupal.org/files/projects/zen-5.x-0.7.tar.gz
cd /var/www/html/sites/all/themes
tar -zxvf /root/zen-5.x-0.7.tar.gz
chown -R apache:apache zen