Drupal

Installing Drupal 6

Drupal (http://drupal.org) is the open source content management platform that this blog site was created using. It provides a quick and easy means of deploying multiple blogs, forums and rss feeds all on the same site, with individual user logins and user-customisable preferences.

This document is intended to provide simple instructions on how to set up a Drupal-based web site for those with only limited knowledge of Linux and server administration. This is by no means an exhaustive or detailed “best practice” guide, but runs through the basic requirements to get your server running and serving content.

There are 7 principle steps involved to get your Linux server up and running and Drupal configured:

Install Linux

In this example I am using the free CentOS distribution of Linux, version 5.5

Boot the server with the CentOS installation media available:

Installing Drupal 6

Press Enter to begin the installation.

Installing Drupal 6

Select the option to Skip verifying the installation media.

Installing Drupal 6

Click Next to begin the installation.

Installing Drupal 6

Select your desired installation language and click Next.

Installing Drupal 6

Select your desired region and click Next.

Installing Drupal 6

Select Yes to allow the installer to automatically partition the hard drive.

Installing Drupal 6

Click Next.

Installing Drupal 6

Click Yes again to allow the installer to automatically partition the hard drive.

Installing Drupal 6

Click Edit to assign manual IP address information if required:

Installing Drupal 6

Complete the address and subnet mask details as required, click OK.

Enter hostname and DNS information as required:

Installing Drupal 6

Click Next.

Installing Drupal 6

Select your time zone and click Next.

Installing Drupal 6

Enter a password for the root administrative account and click Next.

Installing Drupal 6

Select the option to Customise installation packages Now and click Next.

Installing Drupal 6

Untick all options.
In the Server section select the option to install a MySQL database server and a Web Server. Click on Details for each entry and select all sub-entries.

Installing Drupal 6

Tick the option to install the Base System.
No other components are required to run Drupal. Other components may be enabled based on your requirements.

Click Next.

Installing Drupal 6

Click Next to begin the installation. The operating system and selected components will now be installed. This process may take a few minutes. When complete, click Reboot:

Installing Drupal 6

When rebooted, the following window will be displayed, select the option to configure the Firewall:

Installing Drupal 6

Turn the firewall off and also disable SELinux:

Installing Drupal 6

Click OK.

The Linux operating system is now installed and the login prompt will be displayed:

Installing Drupal 6

To log in, enter a login name or “root” and the password you entered earlier during the installation.

Install required Linux components

By default, the CentOS 5.5 web server role comes with PHP 5.1 installed. For best results PHP 5.2 should be installed to support some Drupal modules.
The default CentOS update repository file will need to be manually edited to provide the location of the PHP 5.2 source packages.

The file is located in directory /etc/yum.repos.d/CentOS-Base.repo

For those unfamiliar with Linux and editing system files at the command line with vi, the file can be copied to your desktop for editing and then re-copying back.
On Windows, WinSCP can be used to access the Linux file system. On MacOS, Fugu performs a similar function:

Installing Drupal 6

Enter in the IP address of the Linux server. Connect as root on port 22 and enter the administrative password. The target file system will be displayed alongside your local machine’s. Browse to the /etc/yum.repos.d/ directory on the Linux server:

Installing Drupal 6

Copy the file to your local machine and edit it in a Text Editor. Paste the following text at the end of the file:

[c5-testing] 
name=CentOS-5 Testing 
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/ 
enabled=1 
gpgcheck=1 
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing 
includepkgs=php*

Save the file and copy it back to the Linux server, overwriting the original.

Install PHP 5.2 by issuing the following command:

yum update php

NOTE – the Linux server will require access to the Internet (and DNS) for this update to be successful.

Installing Drupal 6

Select (Y)es to install the updates.

Install the following additional PHP packages:

yum install php-gd
yum install php-mbstring
yum install php-dom

Selecting (Y)es each time to accept the packages.

Finally install any available MySQL updates:

yum update mysql

Configure the Apache web server

The web server now needs to be configured to allow “Clean URLs”. By default, Drupal will create links to articles including the characters "/?q=" in the URL. This can confuse some search engines and should be removed. Drupal can be configured to use what are called “Clean URLs” which do not contain the offending characters, however to enable this feature, a change must be made to the default Apache web server configuration file on the host Linux operating system. To do this, locate the file “/etc/httpd/conf/httpd.conf” and edit it. Locate the section beginning:

# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride None

and change the AllowOverride value from 'None' to 'All'. Save the file and copy it back to the server, overwriting the original.

The default PHP memory limit should also be increased. To do this, locate the file /etc/php.ini
Edit the “Resource Limits” section and increase the PHP Memory Limit. 128M should be sufficient:

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60	; Maximum amount of time each script may spend parsing request data
memory_limit = 128M      ; Maximum amount of memory a script may consume

Save the file.

Now reboot the server.

Once rebooted, log back in as the root user.

Set the web server and MySQL services to start automatically when the server is booted:

chkconfig httpd on
chkconfig mysqld on

Now start both services:

service httpd start
service mysqld start

Create a MySQL Database

For ease of administration, you may find it useful to install the free Webmin tool onto the linux server. Webmin is available as an RPM installer package from www.webmin.com
Download the RPM package and copy it to a location on the Linux server. Log into the server as root and browse to the location where you saved the file.

Launch the installer with the command:

rpm –i (filename)

Installing Drupal 6

Once installed, open a web browser on your desktop and connect to the Linux server’s IP address on port 10000 (http://192.168.0.11:10000) and log in as the root user:

Installing Drupal 6

Expand the Servers section and select the MySQL Database Server:

Installing Drupal 6

Select the option to Create a new database:

Installing Drupal 6

Enter a name for the new database, such as “Drupal” and click Create.

Click on User Permissions:

Installing Drupal 6

Create a new user:

Installing Drupal 6

Enter a name for the user account, such as “drupal” and enter a password. Set the host to “localhost” and assign all rights to the user account. Click Create.

You are now ready to install Drupal.

Install Drupal

The latest version of the Drupal software can be downloaded from http://www.drupal.org

The package will download as a TAR file. Copy it to a location on the Linux server.
Log into the server as root and browse to the location where you saved the TAR file. Extract the contents of the file with the following command:

tar xvfz drupal_6.tar.gz

(substituting the name of the file as required)

Now move the extracted files to the default root directory of the web server with the following command:

mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html

Now navigate to directory /var/www/html/sites/default

Make a copy of the file “default.settings.php” with the following command:

cp default.settings.php settings.php

Now make the file writable:

chmod 777 settings.php

Create a directory called “files”

mkdir files

Make the directory writable:

chmod 777 files

You are now ready to install Drupal. Launch a web browser and navigate to http://(server)/install.php

Installing Drupal 6

Select the option to Install in English:

Installing Drupal 6

Select MySQL as the database type. Enter the name of the database and the database user account you created earlier.
Click Save and Continue:

Installing Drupal 6

The “settings.php” file no longer needs to be writable, back at the command line in directory /var/www/html/sites/default issue command:

chmod 755 settings.php

Back in the web browser enter a name and email address for the Drupal site. The email address field will need to be completed but is not necessarily used so don’t worry about allowing the server access to mail infrastructure at this stage.

Installing Drupal 6

Enter details of an administrative account that will be used to manage the Drupal web site.

Installing Drupal 6

Configure the appropriate time zone. Ensure that Clean URLs are enabled.
Checking for updates is optional.
Click Save and Continue.

Installing Drupal 6

Drupal is now installed. Click on the link to visit the new site:

Installing Drupal 6

Your Drupal site is now built.

Configure the core Drupal installation

Browse to http://(server)/admin

Installing Drupal 6

Click on Modules

Enable the following modules which won’t be enabled by default:

Save the changes.

Install additional required Drupal modules

Additional modules can be downloaded from the Drupal web site. Packages will typically be downloaded as archive files, extract the contents and upload the whole folder to /var/www/html/sites/all/modules on the Drupal server.
Once uploaded, the new modules will be listed in the Admin ? Modules section of the Druap web site, where they can be enabled, and then configured as required.

Additional modules to download include: