Building the Server

Introduction

This section lists the various steps that were taken to install and configure the OS and the various application software packages.  Each step is described briefly in English -- often only the task to be accomplished -- followed by the command line steps that were used.

ImportantThe command line steps are almost certainly neither complete nor completely accurate. This is due to any number of benign causes, including transcription errors, forgetting to write down a step, software updates that somehow invalidate one of the steps, etc. Therefore a Linux-savvy System Administrator will always be required to maintain the system.

Initial Server Build-Out

Using Rackspace's cloud server management console, select the minimum size configuration (256MB RAM, 10GB disk) and the Ubuntu 32-bit Server Edition, version 11.10.

After Rackspace completes the initial OS load, login as root using the password provided by Rackspace. Then create an ordinary user account for the sysadmin to use, add that user to the www-data and sudo groups, then log out.

adduser xxx    # xxx is a placeholder, obviously
usermod -G sudo,www-data,xxx xxx
exit

Log back in as user xxx.

Pick up the latest OS patches and updates:

sudo apt-get update
sudo apt-get upgrade

Next, install Drupal's pre-requisite packages:

sudo apt-get install apache2 mysql-server-5.1 php5 php5-mysql php5-gd php5-curl php5-cli

Install the curl utility (a command line tool for retrieving web pages and files from HTTP servers), the command-line email client, and the SSH and FTP servers:

sudo apt-get install curl mailutils openssh-server proftpd

Create a directory to hold the Drupal files, download the latest release of Drupal 7, then make all subdirectories group-writeable:

cd /usr/local/share
curl http://ftp.drupal.org/files/projects/drupal-7.12.tar.gz | sudo -u www-data tar xvz
# N.B.: 7.12 was the current release as of this writing. New releases come out several times a year.
sudo ln -s drupal-7.12 drupal7
cd drupal7
find . -type d -print0 | sudo xargs -0 chmod 775

Enable the required Apache rewrite module:

 

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/rewrite.load rewrite.load

 

Configure PHP by editing /etc/php5/apache2/php.ini:

  • To suppress deprecation warnings, change the error_reporting variable to E_ALL & ~E_DEPRECATED & ~E_NOTICE
  • Instruct PHP to load the 'gd' graphics library by adding the following at the end of the file: extension=gd.so

Restart Apache to pick up the configuration changes:

sudo apache2ctl restart
# You can safely ignore the warning message about the server name

Initialize the Database

Create user IDs and passwords for MySQL:

mysql -u root
set password for 'root'@'localhost' = password('some-suitable-password);
create user 'iacweb_prod'@'localhost' identified by 'another-suitable-password';

Create Drupal's MySQL database and grant privileges to the newly created user acct (still within the mysql command shell):

create database iacweb_prod;
grant all on iacweb_prod.* to 'iacweb_prod'@'localhost' identified by 'the previously specified password';
flush privileges;
exit

$D7 Environment Variable

To help reduce the amount of command line typing and to make the Drupal path name somewhat more portable, I created an environment variable called D7 in ~webmaster/.bashrc, which equates to /usr/local/share/drupal7. So rather than spelling out /usr/local/share/drupal7/sites/all/modules/blah, one can type $D7/sites/all/modules/blah. And henceforth the pages of the Webmaster's Guide will use $D7 as well.

Initialize the Drupal site

Create the site directory:

cd $D7/sites
sudo -u www-data mkdir iac.org
sudo -u www-data chmod 775 iac.org
sudo -u www-data cp default/default.settings.php iac.org/settings.php

Configure Apache

 

Set up cron

sudo su www-data
crontab -e
   [Add the following line:]   0 *   *   *   *    wget -O - -q -t 1 http://www.iac.org/cron.php
 

Install Drush

Drush is a command-line admin and scripting tool for Drupal. While not critical for site building and operations, it is handy to have around for "black belt" level tasks.
sudo apt-get install php-pear # Installs the PHP Extension and Application Repository utility
pear upgrade --force Console_Getopt
pear upgrade --force pear
pear upgrade-all
pear channel-discover pear.drush.org
pear install drush/drush