Installing Drupal

3434

If you’ve spent any time on the internet then you have come across a Drupal-driven site. In theory, Drupal is a Content Management System (CMS). But in practice, Drupal is much more than that. Drupal can power:

  • Blog sites.

  • Ecommerce sites.

  • Corporate sties.

  • Resource directories.

  • Collaboration tools.

  • Peer-to-peer.

  • Newsletters.

  • Podcasting.

  • Image galleries.

And much more. Drupal is an open source software CMW (released under the GPL) and can be installed on LAMP (Linux, Apache, MySQL, PHP) servers as well as WAMP (Windows, Apache, MySQL, PHP) servers. Believe it or not, the installation is simple. And once you have your Drupal site up and running, you can make it do more than you might think. 

In this tutorial, you will learn how to get a Drupal site up and running on a LAMP server. The distribution in question will be Ubuntu 9.10. I will assume you already have your LAMP server up and running, so we’ll skip past that section. You might also want to have a mail server up and running. For this, you can use either Sendmail or Postfix.

The Steps Required

From start to finish, the steps involved in this process are:

  1. Downloading Drupal

  2. Creating your database.

  3. Running the web-based install process.

  4. Configuring your website.

That’s it. The section you might have the most difficulty with is the database section. Fortunately, there are plenty of tools to keep you from having to use the MySQL command line tools. The tool you use will depend upon what type of server you are running. If you are running a GUI-less server, you will want to use a tool like PhpMyAdmin. If you have a server with a GUI, you can use the outstanding MySQL Administrator. Either tool will work just fine. For the sake of this tutorial, I will illustrate creating the database with MySQL Administrator. NOTE: This installation will install the Drupal site into the directory /drupal on your LAMP server. You can change this to whatever you like, but you will have to alter the installation steps below slightly.

Downloading Drupal

The first step is to download the latest version of Drupal. Once you have that downloaded to your server (if using a GUI-less server you can download this file with the wget tool), move the file to the /var/www directory. The next steps are:

  1. Untar the Drupal file with the command tar xvzf drupal-XXX.tar.gz (where XXX is the release number).

  2. Change the name of the newly created directory with the command mv drupal-XXX drupal (Where XXX  is the release number).

Now you are ready to move on to the next step.

Creating the Database

As I mentioned earlier, the MySQL Administrator tool is an outstanding means of creating (and managing) databases. I will assume you already have MySQL up and running (and know the MySQL administrators’ password). You can install MySQL Administrator from the Ubuntu Software Center or from Synaptic. Do a search for “mysql” (No quotes) and you will find it listed.

To start up the MySQL Administrator go the Programming sub-menu of the Applications menu. When you fire this tool up you will have to connect to your database server. Figure 1 shows the connection window.

You can connect to either the local machine or to a remote MySQL server. I will assume the server is localhost. To make the connection you will have to enter the following information:

  • Server Hostname: localhost.

  • Port: 3306.

  • Username: Enter the MySQL administrator name.

  • Password: Enter MySQL administrator password

Once you enter the proper information click the Connect button to make the connection.

When the connection is made you will be in the MySQL Administrator Main Window (see Figure 2). What you need to do to create the new database (Schema) is to click on the Catalogs link to expand the current database Schemata. 

In the lower right section (the Schemata) all you have to do is right click an empty spot and select Create Schema.  For the sake of the Drupal installation, we’ll call the database to be created “DRUPAL” (no quotes). So create this database by following these steps:

  1. Right click an empty spot in the Schemata listing.

  2. Select Create Scheme.

  3. Name the schema DRUPAL.

  4. Click OK.

  5. Exit the MySQL Administrator.

You are now down managing the database for your Drupal installation. You are ready to fire up your web browser and start the web-based installation process.

The Web-Based Installer

From a web browser that can reach the address of your Drupal server enter the following:

http://ADDRESS_TO_SERVER/drupal

and the installation will begin. 

The first screen you see is mostly just a Welcome screen that allows you to select the language for your installation. To start your installation in English click the Install Drupal in English link. From this same page you can see the installation steps are:

  1. Verify requirements.

  2. Set up database.

  3. Install site.

  4. Configure site.

When you click the Install Drupal in English link you will automatically be taken to the first page in which you have to actually do any work with.

Verify Requirements

In this step you will be given any information regarding problems you have for your installation. Figure 2 shows the most common issues for installing Drupal on a LAMP server.

In order to solve these issues you will need to take the following steps.

From within the console on the LAMP server issue the following commands:

  1. cd /var/www/drupal/sites/default

  2. sudo cp default.settings.php settings.php

  3. sudo chmod 777 settings.php

  4. sudo mkdir files

  5. sudo chmod 777 files

After you issue the above commands click the “try again” link to make sure everything was taken care of. If so you will be taken to the next screen.

Setup Database

Remember the database you created earlier? You will now use it.  Enter the details of your database that you created for your Drupal site here. 

You may also notice the Advanced options section. If you click on that link you will find the following options that can be configured:

Database host: In case you need to use a remote database server.

Database port: If you use a non-standard port for databases.

Table prefix: If you need to share this database with more than one application add a prefix so that drupal will have its own tables to use.

After you have everything configured, click Save and continue to move on to the next step.

Install Site

When you click the Save and continue from the database page, Drupal will install the site, automatically, based on your settings. When this is complete your browser will stop at the Configure site page (which is the next step).

Configure Site

The first thing you will notice on the Configure site page is a warning that the permissions need to be changed on the settings.php file.To solve this, issue the following command:

chmod ugo-w /var/www/drupal/sites/default/settings.php

Now your settings are now longer writable.

In the upper half of the Configure site page (see Figure  5) you will need to enter the following:

  • Site name: The name of your site. By default the name will be the IP address of your LAMP server.
  • Siet email address: This is the email address that will be used for all automated emails sent from your site.

In the bottom half of the Configure site page (see Figure 6) you will need to enter the following information:

Username: Username for the site administrator.

E-mail address: E-mail address for the site administrator.

Password: Password for the site administrator.

Default time zone: The time zone for your server.

Clean URLS: Do you want to use clean URLs? This is only available if you have mod_rewrite installed and working on your LAMP server.

Update notifications: Check if you want to have your site automatically check for updates.

Once you have finished these configurations click the Save button and you are now ready to begin building your Drupal-driven web site. Congratulations.

Final Thoughts

Drupal is an extremely flexible, reliable, and useful web-based tool. Once you have gotten the hang of installing Drupal you will find it one of the most easily set up and managed CMS tools available. But don’t forget, once you have your basic site up and running, to visit the Drupal Modules Repository to find countless, useful modules to add various services and greater flexibility to your site.