ONLamp.com
oreilly.comSafari Books Online.Conferences.

advertisement


Drupal 6.0: Installation and Basic Usage

by Michael J. Ross
03/18/2008

Organizations of all sizes face the challenge of creating professional-looking web sites with minimal expenditure of time and money. Each organization can have a unique set of desired features for their site, but most of them share some core functionality. This typically includes the capacity for user publication of content on the site, to avoid the problem seen frequently in the early days of corporate Internet and intranet sites, namely, an organization's IT group acting as a bottleneck to site development, by forcing others within the organization to go through the group in order to add or modify the site's contents.

Web sites developed from scratch, using server-side technologies, can provide a custom solution — one that supports user content and any other needed functionality. But such projects typically end up less powerful and secure than planned, and requiring more time and money than anticipated, especially after months or years of debugging.

Overview of CMSs and Drupal

In answer to this need, independent developers and software companies created content management systems (CMSs), which the uninitiated can think of as web site frameworks without the site content. In other words, a CMS is like an empty web site, with all of the scaffolding in place for the site's administrators and (optionally) visitors to fill in with content, such as blog postings, perhaps with accompanying images. The scaffolding typically includes a database for storing content, user sign-up and authentication capabilities, a web feed, a calendar for events, etc. The primary advantage is that the scaffolding does not need to be developed by the administrators. Instead, those individuals can focus on styling the site to match the organization's branding and polishing its contents.

The benefits of using a quality CMS are substantial. As noted earlier, an IT department can quickly roll out a new web site, without reinventing the wheel. Users can contribute web content without any knowledge of HTML, by using a built-in WYSIWYG ("what you see is what you get") editor. Content access can be restricted using multiple levels of user permissions. The user management and security capabilities have usually received years of scrutiny by administrators, security experts, and hackers. Database design and optimization issues have already been worked out, oftentimes by specialists with more knowledge and experience than what a modest organization may have on hand or can afford to bring in house. The look of an entire site can be changed instantly by choosing a different "theme" (the most common term), and all the major CMSs have some built-in themes to choose from, as well as the ability to add third-party themes. These are just some of the many advantages of utilizing a CMS for a new site.

Most of the early CMSs, however, were proprietary, and some were remarkably expensive. Fortunately, the current best-of-breed open source CMSs provide most, if not all, of the functionality of their closed-source brethren. In addition, they are supported by growing communities of enthusiastic developers, who are happy to create and share with others the custom templates and extensions that add new functionality to their respective CMSs, including e-commerce operations for online stores.

Drupal is one of the most popular CMSs and is gaining greater recognition all the time, partly because it encompasses all of the aforementioned features, and partly because programmers adept with PHP (the language in which Drupal was written) can customize the functioning and appearance of seemingly every aspect of Drupal. With the recent release of version 6, Drupal has achieved a noteworthy milestone in its development history and the capabilities that it offers to web site creators. This latest version offers improvements and even brand-new features in a wide range of areas: installation, administration, human language support, theme management, security, performance, and many more.

In this article, we will discuss how to install and configure a brand-new Drupal web site, from scratch. We will also explore the fundamentals of adding content to a Drupal installation.

System Requirements

In order to run Drupal on your computer, several components are needed: 1) a web server, 2) a database server, and 3) a web scripting language, namely, PHP. All three of these components should be installed and verified prior to installing Drupal:

  • Because Drupal dynamically generates web pages, it requires a web server to create them. Even though Drupal will work with Microsoft IIS (versions 5 or, preferably, version 6), the web server of choice is Apache (version 1.3 or later).
  • Drupal needs to store user postings and other content in a relational database. Even though Drupal will work with PostgreSQL (version 7.4 or later), the database server of choice is MySQL (version 4.1 or later). Version 5.0 is strongly recommended.

  • As noted earlier, Drupal is written in PHP and requires version 4.3.5 or later. Version 5.2 is preferred.

In this article, we will be using the most recent versions of these components, as of this writing: Apache 2.2.8, MySQL 5.0, and PHP 5.2.5 — all on a Windows XP system. The corresponding installation procedures will be the same for other versions of Windows (2000 and Vista) and, to a lesser extent, other operating systems supported by Drupal, including Linux. The procedures for earlier supported versions of Apache, MySQL, and PHP, will likewise be similar if not identical.

Specific instructions for installing and configuring Apache, MySQL, and PHP are available with those products, as well as in developer tutorials that can be found on the Internet. More detailed information on required and recommended PHP configuration settings, can be found on the Drupal system requirements page. It notes that a minimum of 16 megabytes of system memory are required, but most likely your planned Drupal platform has far more available RAM.

Downloading Drupal

The first step in installing Drupal is to download the latest version of the program, which is Drupal 6.0. Click on the "Download Drupal 6.0" link and save the archive file, drupal-6.0.tar.gz, somewhere on your computer. If you have a broadband connection to the Internet, the download process should take just a second or two, because the Drupal installation file is only a bit larger than 1 MB — lean compared to the installation files of some other popular CMSs.

Drupal 6.0 download page
Figure 1. Drupal 6.0 download page

The previous stable release of Drupal, version 5.7, is available, but not recommended.

Installing Drupal

Open the saved installation file on your computer, which will undoubtedly launch whatever file archiving program you have associated with Gzip files. (If you do not have such a program, there are many excellent ones available, including 7-Zip.)

Installation file contents
Figure 2. Installation file contents

Extract all the contents of the archive file into a new Drupal directory somewhere within your web server's root directory. The contents comprise 465 files in 57 directories, which may seem like a lot to those unfamiliar with CMSs, but is actually a fraction of those found in the installation files of other leading CMSs. Drupal is equally lean in disk space usage compared to its counterparts, filling only 3,295 KB.

Before running the Drupal installation script, create a database on your MySQL server. This can be accomplished using any MySQL database management tool, whether a graphical program such as phpMyAdmin or MySQL's built-in monitor program, as we will do here, at a command line:

mysql --password --user=root

After entering your MySQL server's password, you should see a welcome banner and a command prompt:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.51a-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>

At the prompt, enter the commands to create the database (in this example, imaginatively named "drupal_db") and a user of the database ("drupal_user"), with a password and all privileges within the database:

CREATE DATABASE drupal_db;
GRANT ALL ON drupal_db.* TO drupal_user@localhost IDENTIFIED BY 'password';

(Naturally, the unsecure password used in this example is for illustrative purposes only and should never be used for any Drupal installation on the Internet.)

Within your web browser, go to your Drupal homepage, index.php. For instance, if your chosen Drupal root directory is /_w/Drupal on your D: drive (as I have done), and you have defined within your Apache configuration file an alias /m_d/ pointing to D:/, then your Drupal's URL would be http://localhost/m_d/_w/Drupal/. The index.php detects that Drupal has not been installed, and automatically forwards you to the install page, at http://localhost/m_d/_w/Drupal/install.php?profile=default, shown in the figure below.

Choose language
Figure 3. Choose language

In this Drupal installation, we will elect to use English, after which the installation script presents us with the database configuration options.

Database configuration
Figure 4. Database configuration

Pages: 1, 2, 3

Next Pagearrow





Sponsored by: