Installing Drupal 7

Exclusive offer: get 50% off this eBook here
Drupal 7 First Look

Drupal 7 First Look — Save 50%

Learn the new features of Drupal 7, how they work and how they will impact you

$23.99    $12.00
by Mark Noble | November 2010 | Content Management Drupal Open Source

Drupal is a popular Open Source content management system.

In this article by Mark Noble, author of the book Drupal 7 First Look, we will take a look at installing Drupal 7.

Drupal 7 First Look

Drupal 7 First Look

Learn the new features of Drupal 7, how they work and how they will impact you

  • Get to grips with all of the new features in Drupal 7
  • Upgrade your Drupal 6 site, themes, and modules to Drupal 7
  • Explore the new Drupal 7 administration interface and map your Drupal 6 administration interface to the new Drupal 7 structure
  • Complete coverage of the DBTNG database layer with usage examples and all API changes for both Themes and Modules
        Read more about this book      

(For more resources on Drupal, see here.)

Drupal's installation process has always been very easy to use, and the Drupal 7 installation makes things even easier.

Before beginning to install Drupal 7, you will need a web server running the Apache HTTPD web server. You can also use IIS on Microsoft Windows, but the Apache server is preferred and you will be able to obtain support from the community more easily if you use the Apache server.

Want to easily install Apache onto a Microsoft Windows machine? Try XAMPP, which is published by Apache Friends. This package includes Apache, MySQL, and PHP with a standard Microsoft Windows installer. You can download XAMPP from http://www.apachefriends. org/en/xampp.html. Other options include WAMP (http://www. wampserver.com/en/) and MoWeS Portable (http://www. chsoftware.net/en/mowes/mowesportable/mowes.htm).

Your server will also need PHP installed on it. Drupal requires at least PHP version 5.2.0. As of this writing, there are some hosts that still do not have PHP 5.2.0 or later installed on their shared hosting accounts, and Red Hat does not include PHP 5.2.0 or later in its default distribution. Check with your host or system administrator before installing Drupal to make sure that the correct version is available.

In addition to the web server and PHP, you will also need a database. MySQL and PostgreSQL are the databases that are most frequently used with Drupal, and of the two, MySQL is much more widely used. That being said, you can use Drupal with many different databases and the new DBTNG database abstraction layer will make it easier to deploy to any database. If you are using MySQL, you will need version 5.0.15 or later installed. If you are using PostgreSQL, you will need PostgreSQL 8.3.0 or later. SQLite is also officially supported for use with Drupal and you will need version 3.4.2 or later.

After you have a server set up with the proper software, you can download Drupal and begin the installation process.

Obtaining Drupal

If you have used previous versions of Drupal, the process for downloading Drupal is the same as always. If you are new to Drupal, you will use the following process:

  1. Go to the Drupal project page on Drupal.org: http://drupal.org/project/ drupal.
  2. Find the latest official release of Drupal 7 and click on the Download link. The release will be named 7.0 or similar.
  3. Your browser will ask whether you want to download or Open the file. Make sure to download it to your computer.
  4. The file you downloaded is a .tar.gz file, which is a compressed archive similar to a .zip file. You will need to extract the files from this archive onto your computer.

    If your computer doesn't already have a program that can open .tar.gz files, try 7-Zip, an open source application that easily handles these files. You can download 7-Zip from http://www.7-zip.org.

  5. After you have extracted the files, you will need to copy them to your web server's document root.
  6. You are now ready to start the installation process. Simply navigate to http://yoursite.com/install.php.

Let's step through the installation process in detail now.

Selecting an installation profile

The first step in the installation process is selecting an installation profile. Drupal prompts you with a screen asking for which installation profile you want to use during the installation:

Installing Drupal 7

By default, Drupal comes with two installation profiles, the Standard profile and the Minimal profile. Custom distributions may come with additional profiles.

Minimal profile

The Minimal profile installs a basic configuration of Drupal with only the required functionality enabled. This profile is even more minimal than the base Drupal 6 installation.

This profile should be used if you are very familiar with setting up Drupal and don't want some of the additional features activated in the Standard profile.

Standard profile

The Standard Drupal profile installs and activates several commonly-used features to make your Drupal site more useful immediately. These additional features include:

  • Search form installed on the left sidebar.
  • Powered by Drupal block enabled in the footer.
  • A basic page content type is automatically created to store static content on your site.
  • An article content type is automatically created to store time-specific content. The article content type replaces the story content type from Drupal 6.
  • Both content types are set up with RDF capabilities.
  • User profiles have pictures enabled by default. Profile pictures can have a maximum size of 1024x1024 pixels and be up to 800 KB when they are uploaded. They will be displayed using the thumbnail image style.
  • A taxonomy called Tags is created to allow easy categorization of content on your site.
  • The article content type is enhanced by adding an image field, which allows PNG, GIF, and JPG files to be attached to the article.
  • An administrator role is created that has all permissions activated for it. As new modules are activated, the administrator role will automatically be updated with the permissions for the new module.
  • The Seven theme is activated for the administration section of the site.

In most cases, you will want to start with the Standard installation profile, especially if you are setting up an entirely new site or if you are new to Drupal.

Language selection

The next step in the installation is choosing the language with which you want to install Drupal. By default, Drupal only includes an English installer. If you want to want to install Drupal in another language, you will need to download a translation from Drupal.org. A complete list of translations is available at http://drupal.org/ project/translations. After you download the translation you want to use, you will need to unpack the translation and copy it to your document folder. The process to unpack and copy the files is similar to the process we used when we unpacked and copied the core Drupal files to your server.

For now, we will continue with the English installation.

Requirements check

Drupal will now check the requirements of your server to ensure that it meets the minimum requirements to run Drupal and to ensure that everything is ready for the installation to proceed.

The requirements check will appear similar to the following:

Installing Drupal 7

If Drupal does discover any problems, it will give you information about how to correct the problem. In our case, it looks like we forgot to set up our settings file. The settings file tells Drupal which database to connect to as well as the connection information. To create a settings file, navigate to your document root and then navigate to the sites/default folder. Copy the default.settings.php file to settings.php. You do not need to change any of the information within the file.

After you have corrected any problems, click on the proceed with the installation link. Drupal will re-evaluate the requirements and let you know if anything else needs to be changed.

This screen has been enhanced in Drupal 7 to provide much more information about your current server settings.

Database configuration

The next step in installing Drupal is configuring the database where Drupal will store the content and configuration information for your site. The functionality of this screen has also been enhanced in Drupal 7.

Installing Drupal 7

The key difference is that Drupal 7 will automatically check which types of databases are available to you based on your server setup. Then, it will only allow you to select a database which will work.

If you want to run Drupal using a different database server than your web server, you can use the ADVANCED OPTIONS link to configure the database server and port. You can also use ADVANCED OPTIONS if you are setting up multiple sites within a single database.

For a Standard installation, enter the name of your database as well as the username and password for the database. This functionality remains the same as in Drupal 6.

You will need to create a database outside of the Drupal installation. The actual steps for creating a new database vary depending on your website host. Many hosts have installed phpMyAdmin, which allows you to manage your databases with an easy-to-use web-based interface.

If you use phpMyAdmin to create your database, you will need to log in to phpMyAdmin and create a database. You can create a new database from the home page, which should appear similar to the following screenshot depending on the version of phpMyAdmin you are using:

Installing Drupal 7

You can create a new user for the database in the Privileges tab.

After you have entered your database settings, click on the Save and continue button. Drupal will now configure the database and set up your site.

As the installation proceeds, Drupal will display its progress.

Installing Drupal 7

The installation may take several minutes to complete.

In the unlikely event that you have problems during the installation, try emptying the database, increasing the amount of memory available to Drupal, and increasing the maximum execution time for a PHP script. You can increase the available memory and execution time in your php.ini file.

The relevant sections in php.ini to control memory and execution time are shown in the following screenshot:

Installing Drupal 7

Drupal 7 First Look Learn the new features of Drupal 7, how they work and how they will impact you
Published: November 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:
        Read more about this book      

(For more resources on Drupal, see here.)

Configure site

After the Standard installation has completed, you will need to configure your site.

The basic configuration starts by asking you for the SITE INFORMATION and SITE MAINTENANCE ACCOUNT details. The site maintenance account has the ability to change all settings within the site. You should make sure that the Password is difficult to guess and that it is stored securely.

Installing Drupal 7

These options are identical to the Drupal 6 settings.

The next set of configuration options allow you to determine which country your site is located in as well as the Default time zone for the site:

Installing Drupal 7

The Default country setting is new to Drupal 7 and the Default time zone setting has been made easier to understand by adding the name of the time zone.

The final set of configuration options are related to updating your site:

Installing Drupal 7

These settings allow you to have Drupal automatically check if any updates are available for Drupal or any contributed modules you have installed. If there are any updates available, you can optionally have Drupal e-mail you so you don't have to constantly check for updates on your own. It is highly recommended that you activate both of these options.

Drupal 6 administrators may have noticed that there is no setting for clean URLs. By default, Drupal 7 will activate clean URLs if your site is capable of using them.

After you have entered the configuration options to your satisfaction, click on the Save and continue button to finalize your choices.

After all options have been saved to the database, you will be given a final status screen stating that the installation completed successfully.

Installing Drupal 7

Now that the installation is finished, we can finally navigate to our site by clicking on the Visit your new site link.

New home page

The default home page has also been changed from Drupal 6, as shown in the following screenshot:

Installing Drupal 7

The text on the front page has been modified to make it simpler to understand. The front page also contains different information if a user is not logged in.

Installing Drupal 7

This helps to ensure that unnecessary information is not displayed to site visitors.

Now that we have gone through the entire Standard installation, let's look at some of the more advanced things you can do with the Drupal installer.

Command-line installation

Administrators who manage lots of sites or who prefer to work from the command line will be thrilled with the change to make Drupal installable from the command line. If you want to run the installation from the command line, you will need to use the following procedure:

  1. Download Drupal from Drupal.org and copy the files to your server.
  2. Create a PHP script to run the Drupal command line using the following procedure:
    1. Create a file called install.site.php where site is the name of your site. This file should be located in the same directory where your install.php file is located (the root directory for your site).
    2. Open the install.site.php file in your favorite file editor.
    3. Enter the following script:

      <?php
      include_once 'install.php';
      $settings = array(
      'parameters' => array(
      'profile' => 'default',
      'locale' => 'en',
      ),
      'forms' => array(
      'install_settings_form' => array(
      'driver' => 'mysql',
      'database' => 'my_db_name',
      'username' => 'my_db_username',
      'password' => 'my_db_password',
      ),
      'install_configure_form' => array(
      'site_name' => 'My site',
      'site_mail' => 'admin@example.com',
      'account' => array(
      'name' => 'admin',
      'mail' => 'admin@example.com',
      'pass' => array(
      'pass1' => 'my_site_password',
      'pass2' => 'my_site_password',
      ),
      ),
      'update_status_module' => array(1 => TRUE),
      'clean_url' => TRUE,
      ),
      ),
      );
      install_drupal($settings);
      ?>

      This code is used to configure the installation so Drupal knows what values to use during the installation process to properly configure your site as it is created.

    4. Modify the values in the above code snippet to match the needs of the site you want to install. You will need to pay special attention to the database information including the database name, username, and password. You should also modify the administrator's password, site name, and so on to match the desired values for your site.
    5. Save the file with all of your changes.
  3. Run the install.site.php file from the command line using the syntax: php install.site.php
  4. After the installation completes, you can verify your site and begin configuring it as usual.
  5. After completing the installation, you should back up the install file and either remove it from your site completely or remove access to the file for all users since it contains the login information for User 1.

Although this setup is a little more complicated to run initially, it can be a big time saver if you are installing a large number of sites or want to run an unattended installation.

Summary

In this article we took a look at the installation process of Drupal 7.


Further resources on this subject:


Drupal 7 First Look Learn the new features of Drupal 7, how they work and how they will impact you
Published: November 2010
eBook Price: $23.99
Book Price: $39.99
See more
Select your format and quantity:

About the Author :


Mark Noble

Mark Noble has worked in software development and website design for over 13 years in a variety of capacities including development, quality assurance, and management. He takes pride in developing software and websites to make businesses run more effectively and delights in helping users to get their jobs done more easily.

Mark currently works developing websites to help libraries manage their books. He also does occasional contract work for clients in a variety of industries.

When he isn’t in front of a computer, Mark enjoys playing with his family, photography, and geocaching.

Books From Packt


Drupal 7
Drupal 7

Drupal 6 Attachment Views
Drupal 6 Attachment Views

Drupal 6 Search Engine Optimization
Drupal 6 Search Engine Optimization

Drupal 6 Performance Tips
Drupal 6 Performance Tips

Drupal 6 Panels Cookbook
Drupal 6 Panels Cookbook

Drupal E-commerce with Ubercart 2.x
Drupal E-commerce with Ubercart 2.x

Flash with Drupal
Flash with Drupal

Drupal 7 Module Development: RAW
Drupal 7 Module Development: RAW


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software