(For more resources on Drupal 7, see here.)
There are a number of different ways to install Drupal on a web server, but in this recipe we will focus on the standard, most common installation, which is to say, Drupal running on an Apache server, which runs PHP with a MySQL database. In order to do this we will download the latest Drupal release, and walk you through all of the steps required to get it up and running.
Before beginning, you need to ensure that you meet the following minimal requirements:
- Web hosting with FTP access (or file access through a control panel).
- A server running PHP 5.2.5+ (5.3+ recommended).
- A blank MySQL database and the login credentials to access it.
- Ensure that register globals is set to off in the PHP.ini file. You may need to contact your hosting provider to do this.
How to do it…
- The first step is to download the latest Drupal 7 release from the Drupal download page, which is located at http://drupal.org/project/drupal :
This page displays the most recent and recommended releases for both Drupal 6 and 7. It also displays the most recent development versions, but be sure to download the recommended release (development versions are for developers who want to stay on the cutting edge).
- When the file is downloaded, extract it and upload the files to your chosen web server document root directory on the server. This may take some time.
- Configure your web server document root and server name (usually through a vhost directive).
- When the upload is complete, open your browser and in the address bar, type in the server name configured in the previous step to begin the installation wizard.
- Select Standard option and then select Save and continue:
- The next screen that you will see is the language selection screen; there should only be one language available at this point. Ensure that English is selected before proceeding:
- Following a requirements check, you will arrive at the database settings page. Enter your database name, username, and password in the required fields. Unless your database details have been supplied with a specific host name and port, you should leave the advanced options as they are and continue.
- You will now see the Site configuration page. Under Site information enter the name you would like to appear as the site’s name.
- For Site e-mail address enter an e-mail address.
- Under the SITE MAINTENANCE ACCOUNT box, enter a username for the admin user (also known as user 1), followed by an e-mail address and password:
- In the Server settings box, select your country from the drop-down, followed by your local time zone.
- Finally, in the Update notification box, ensure that both options are selected. Click on Save and continue to complete the installation. You will be presented with the congratulations page with a link to your new site.
(Move the mouse over the image to enlarge.)
How it works…
On the server requirements page, Drupal will carry out a number of tests. It is a requirement that PHP “register globals” is set to off or disabled.
Register globals is a feature of PHP which allows global variables to be set from the contents of the Environment, GET, POST, Cookie, and Server variables. It can be a major security risk, as it enables potential hackers to overwrite important variables and gain unauthorized access.
The Configure site page is where you specify the site name and e-mail addresses for the site and the admin user. The admin e-mail address will be used to contact the administrator with notifications from the site, and the site e-mail address is used as the originating e-mail address when the site sends e-mails to users. You can change these settings later on in the Site information page in the Configuration section.
It’s important to select the options to receive the site notifications so that you are aware when software updates are available for your site core and contrib modules; important security updates are available from time to time.
In this recipe we have seen a regular Drupal installation procedure. There are various different ways to install and configure Drupal. We will explore some of these alternatives in the following sections. We will also cover some of the potential pitfalls you may come across with the requirements page.
Uploading through a control panel
If your web-hosting provider provides web access to your files through a control panel such as CPanel, you can save time by uploading the compressed Drupal installation package and running the unzip function on the file, if that functionality is provided. This will dramatically reduce the amount of time taken to perform the installation.
There are other ways in which Drupal can be installed. Your hosting may come with an auto- installer such as Fantastico De Luxe or Softaculous. Both of these services provide a simple way to achieve the same results without the need to use FTP or to configure a database.
Database table prefixes
At the database setup screen there is an option to use a table prefix. Any prefix entered into the field would be added to the start of all table names in the database. This means that you could run multiple installations of Drupal, or possibly other CMSs from the same database by setting a different prefix. This method, however, will have implications for performance and maintenance.
Installing on a Windows environment
This recipe deals with installing Drupal on a Linux server. However, Drupal runs perfectly well on an IIS (Windows) server. Using Microsoft’s WebMatrix software, it’s easy to set up a Drupal site: http://www.microsoft.com/web/drupal
Drupal supports many different languages. You can view and download the language packs at http://localize.drupal.org/download.
You then need to upload the file to Drupal root/profiles/standard/translations. You will then see the option for that new language in the language selection page of the installation.
Verifying the requirements page
If all goes to plan, and the server is already configured correctly, then step 3, the server requirements page, will be skipped. However, you may come across problems in a few areas:
- Register Globals: This should be set to off in the php.ini file. This is very important in securing your site. If you find that register globals is turned on, then you will need to consult your hosting provider’s documentation on this feature in order to switch it off.
- Drupal will attempt to create the following folder: Drupal root/sites/default/ files. If it fails, you may have to manually create this file on the server and give it the permission 755.
- Drupal will attempt to create a settings.php file by copying the default.settings.php file.
- If Drupal has trouble doing this, copy the default.settings.php file in the following directory: Drupal root/sites/default/default.settings.php and rename the copied file as settings.php.
- Give settings.php full write access CHMODD 777. After Drupal finishes the installation process, it will try to set the permission of this file to 444; you must check that this has been done, and manually set the file to 444, if it has not.
See Installing Drupal distributions for more installation options using a preconfigured Drupal distribution.
For more information about installing Drupal, see the installation guide at Drupal.org: http://drupal.org/documentation/install