Websites come in all shapes and sizes, but most of them share important functionality. For instance, site owners want to be able to:
- easily add custom content — such as a short article with an accompanying picture
- change the appearance of the site without modifying code
- set roles and permissions for registered users
Site visitors typically should be able to:
- register new accounts, and later change their profiles
- login to view restricted content
- post comments to existing articles, or even post original articles, depending upon their permissions
But if so many websites need to support an extensive amount of common capabilities, it would be terribly wasteful for business owners and their Web developers to create all of this functionality from scratch. In other words, why reinvent the Web wheel?
In response to this need, Web programmers and software organizations have developed content management systems (CMSs), which are like website frameworks, without the site content. To put it another way, a CMS can be thought of as an empty website, with everything in place for the site's administrators and perhaps visitors to fill in with content, such as blog postings. The framework usually includes a database for storing content, user sign-up and authentication capabilities, a Web feed, etc. The primary benefit of using a CMS is that the framework does not have to be created by the site administrators. This allows the administrators to focus on adding desired content and customizing its appearance, without worrying about the underlying technology.
One of the most popular CMSs is Drupal, partly because it offers all of the aforesaid features, and partly because developers familiar with PHP (the language used by Drupal) can modify the functioning and appearance of almost every aspect of Drupal. The latest series of Drupal, version 6.x, provides improvements and brand-new features in a variety of areas: installation, administration, human language support, theme management, security, performance, and more.
In this tutorial, we will discuss how to install and configure a brand-new Drupal website from scratch. We will also touch upon the basics of adding content to a Drupal installation.
To run Drupal, you will need several components: 1) a Web server, 2) a database server, and 3) a Web scripting language (PHP). It is advisable that all of these needed components be installed before installing Drupal itself:
- Drupal dynamically generates Web pages, and thus requires a Web server for doing so. Drupal will work with Microsoft IIS (versions 5 or, even better, version 6), but the preferred Web server is Apache (version 1.3 or later).
- Drupal has to save the site content in an RDBMS (relational database management system), and will work with MySQL (version 5.0 is strongly recommended) or PostgreSQL (version 7.4 or later).
- Drupal is written in PHP, and requires version 4.3.5 or later; version 5.2 is best.
In this tutorial, we will be utilizing the most recent versions (as of this writing): Apache 2.2.8, MySQL 5.0, and PHP 5.2.5. If you are setting up your development environment on a Windows server, then further information is available at DeveloperTutorials.com, with detailed instructions on how to install and configure Apache, MySQL, and PHP.
Your first step in installing Drupal is to download the latest version, which is currently Drupal 6.1. Click on the "Download Drupal 6.1" link, and save the archive file (drupal-6.1.tar.gz) somewhere on your computer. If you have a broadband connection, the download process should take just a few seconds; the installation file is just slightly bigger than 1 megabyte.
Earlier stable releases of Drupal, such as versions 5.7 and 6.0, are available, but not recommended.
Open the installation file that you saved, which should start up whatever file archive application is associated with Gzip files.
Extract the contents of the archive file into a new directory somewhere within your Web server's root directory. You can name it simply "Drupal". The contents consist of more than 400 files in more than 50 directories. This may seem like a lot, to anyone new to CMSs, but is actually a fraction of what is required by other leading CMSs. Drupal is also efficient in disk space usage compared to its rivals, using well under four megabytes.
Create a database for Drupal on your MySQL server. You can use any MySQL database management tool, such as phpMyAdmin. Alternatively, use MySQL's built-in monitor program, at the command line:
mysql --password --user=root
After you login, you will 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>
Enter the commands to create a database (in this example, named "drupal_db") and also create a database user ("drupal_user"), with a password and all privileges in the database:
CREATE DATABASE drupal_db; GRANT ALL ON drupal_db.* TO drupal_user@localhost IDENTIFIED BY 'password';
(Of course, the weak password used in this example is for illustrative purposes only, and should never be used for any non-development Drupal installation.)
Within your Web browser of choice, go to your new Drupal home page, index.php. For instance, if you placed the Drupal installation directory within your Apache root directory, then you would go to http://localhost/Drupal/index.php, or, if you have set your Apache server to search for index.php files as default files, then http://localhost/Drupal/ would be sufficient. The index.php file detects that Drupal has yet to be installed, and automatically forwards you to the installation page, at http://localhost/Drupal/install.php?profile=default (continuing with our example), shown below.
Most people will choose to use English, which is what we will do in this tutorial. Then the installation script shows you the database configuration options.
In the figure above, it is clear from the checklist on the left that we have gone from the first step (choosing a language) directly to the third. Drupal presumably verified that a MySQL server is running and is compatible with Drupal 6.1.
Type in the values you had chosen earlier for your database name, username, and password. If you want to change the server name from its default ("localhost"), or set a port number, or assign a table prefix, then click the "Advanced options" link. We will not be changing any of those default values in this tutorial.
Assuming that all of the prior steps have been completed successfully, then the installation of the Drupal files will continue until it is finished. The two figures above and below present screens that may be visible momentarily during this process.
After the file installation is completely done, you can begin the initial configuration of your new site.
Your site's Web server name will default to whatever value you specified earlier. The configuration screen notes that the site email address is the one that will be used to send automated administrative messages, e.g. sign-up confirmations to users. Hence, be sure to use an email address based upon your website's domain, to minimize the odds of any of those messages being flagged as spam. For Drupal installations on a local Web server only, this is not applicable.
For your administrator account, enter a name, an email address, and a password. The administrative address is not shown to site visitors. As you type in your new password, its security strength will be displayed dynamically. If you want to create a strong password, include mixed case characters and punctuation symbols. The Drupal time zone will default to that of your server. By default, clean URLs are not enabled, but can be enabled using configuration settings later.
As the administrator, you will be notified of updates to Drupal by default, which can reduce the chances of your site becoming a victim of recently uncovered security problems. But if your Drupal site is behind a firewall, then choosing to have Drupal constantly checking for product updates will cause it to load pages quite slowly. Thus it is advisable to disable automatic update checking, and simply perform manual updates as part of your administrative routine.
In our example, the installation process completed successful, despite the warning message shown in the figure above, which is caused by the local Web server not having an email server. If you are setting up Drupal on a local server only, you can ignore this.
After you click on the link "your new site", at the bottom of the installation text, you will be forwarded back to your new Drupal website's home page, index.php.
As seen in the figure above, Drupal advises you to login as the administrator. You can then make further configuration changes, enable additional functionality via modules, modify the appearance of your site using themes, and start adding some content.
In the navigation menu, located on the left-hand side of the page (in the default theme), choose "Administer". This will display the various sections of the administration account.
In this area, there are six subsections, which allow you to make any desired changes to the appearance and functionality of your Drupal site:
- Content management — View and edit comments, stories, content types, user postings, Web feed, and content "taxonomy" (how stories are named and organized).
- Site building — Manage blocks (regions of pages), menus, modules (into which is divided Drupal's functionality), and themes.
- Site configuration — Modify the administrative settings of your site, including date and time, input formats, and error reporting.
- User management — Define and manage users, their registration requirements, roles, permissions, and access rules.
- Reports — Examine log events, errors, and a detailed site status report.
- Help — Access links to an online Drupal handbook, and local information on many aspects of Drupal (from blocks to users).
In this tutorial, due to space limitations, we will not cover the details of all six subsections and their 31 subsections, but we will make some common modifications.
Basic Site Customization
The majority of the default site configuration values do not need to be altered. However, you should set a new name for your site, and maybe a site slogan. To do so, go to Administer > Site configuration > Site information, and change the values there. In our example, we changed the name of the site from "localhost" to "Drupal Sample Site", and made other simple changes. When you are done, click the "Save configuration" button at the bottom of the page, as is done for all administrative pages.
In order to confirm that your modifications were properly saved, go to your site's home page, by clicking on the site name, at the top of the page.
The appearance of a Drupal site is determined by the "theme" that is currently set as the default. To see this value, and possibly change it, go to Administer > Site building > Themes. There you will see the six initial themes packaged into Drupal 6.1.
By default, the "Garland" theme is the only one enabled, and is the current one. Let's change the theme to "Bluemarine", by enabling it and setting it as the default. As soon as you save your choice of Bluemarine, your administrative interface should change just as did the home page, because it inherited the home page's theme. You can always override this via Administer > Site configuration > Administration theme.
Let's now add some sample content, known within Drupal as "stories". Go to Create content > Story, and enter a name and some content for your first story. Underneath the large content text field, five expanding menus allow you to change the story's input format, revision information, comment settings, authoring information, and publishing options.
After adding the new content, go to the site's home page again, and you should see all of the customizations made earlier, including the new story, as well as the change to the site's theme. Also, the RSS feed icon will be visible, because now the site has some content that can be syndicated. Notice also that the welcome message seen earlier during installation, has been replaced by your new story.
Drupal has an encouraging amount of technical resources freely available to answer your questions, and assist you in increasing your understanding of how to administer and modify a Drupal site. A great place to begin is the Drupal Support page, which has links to their online documentation, as well as forums, where you can post questions.
As of this writing, there are at least seven books on Drupal, although none of them were written for the 6.x series of Drupal. In the future, there will certainly be more books written and published, as a growing number of Web developers begin to explore the capabilities of this excellent content management system, and how it can save them time and effort in building websites.