13 min read

(For more resources related to this topic, see here.)

Assumptions

To get Drupal up and running, you will need all of the following:

  • A domain

  • A web host

  • Access to the web host’s filesystem

    or

  • You need a local testing environment, which takes care of the first three things

For building sites, either a web host or a local testing environment will meet your needs. A site built on a web-accessible domain can be shared via the Internet, whereas sites built on local test machines will need to be moved to a web host before they can be used for your course. 

In these instructions, we are assuming the use of phpMyAdmin, an open source, browser-based tool, for administering your database. A broad range of similar tools exist, and these general instructions can be used with most of these other tools. Information on phpMyAdmin is available at http://www.phpmyadmin.net; information on other browser-based database administration tools can be found at http://en.wikipedia.org/wiki/PhpMyAdmin#Similar_products.

The domain

The domain is the address on the Web from where people can access your site. If you are building this site as part of your work, you will probably be using the domain associated with your school or organization. If you are hosting this on your own server, you can buy a domain for under US $10.00 a year. Enter purchase domain name in Google, and you will have a plethora of options.

The web host

Your web host provides you with the server space on which to run your site. Within many schools, your website will be hosted by your school. In other environments, you might need to arrange for your own web host by using a hosting company.

In selecting a web host, you need to be sure that they run software that meets or exceeds the recommended software versions.

Web server

Drupal is developed and tested extensively in an Apache environment. Drupal also runs on other web servers, including Microsoft IIS and Nginx.

PHP version

Drupal 7 will run on PHP 5.2.5 or higher; however, PHP 5.3 is recommended. The Drupal 8 release will require PHP 5.3.10.

MySQL version

Drupal 7 will run on MySQL 5.0.15 or higher, and requires the PHP Data Objects ( PDO ) extension for PHP. Drupal 7 has also been tested with MariaDB as a drop-in replacement, and Version 5.1.44 or greater is recommended.

PDO is a consistent way for programmers to write code that interacts with the database. You can find out more about PDO and how to install it at http://drupal.org/requirements/pdo.

Drupal can technically use any database that PDO supports, but MySQL is by far the most tested and best supported. Third-party modules are required to use Drupal with other database systems. You can find these modules listed at http://drupal.org/project/modules/?f[0]=im_vid_3%3A13158&f[1]=drupal_core%3A103&f[2]=bs_project_sandbox%3A0.

FTP and shell access to your web host

Your web host should also offer FTP access to your web server. You will need FTP (or SFTP) access in order to upload the Drupal codebase to your web space. Shell access, or SSH access, is not essential for basic site maintenance. However, SSH access can simplify maintaining your site, so contracting with a web host that provides SSH access is recommended.

A local testing environment

Alternatively, you can set up a local testing environment for your site. This allows you to set up Drupal and other applications on your computer. A local testing environment can be a great tool for learning a piece of software. Fortunately, open source tools can automate the process of setting up your testing environment.

PC users can use XAMPP (http://www.apachefriends.org) to set up a local testing environment; Mac users can use MAMP (http://www.mamp.info).

If you are working in a local testing environment set up via XAMPP or MAMP, you have all the pieces you need to start working with Drupal: your domain, your web host, the ability to move files into your web directory, and phpMyAdmin.

Setting up a local environment using MAMP (Mac only)

While Apple’s operating system includes most of the programs required to run Drupal, setting up a testing environment can be tricky for inexperienced users. Installing MAMP allows you to create a preconfigured local environment quickly and easily using the following steps:

  1. Download the latest version of MAMP from http://www.mamp.info/en/index.html. Note that the paid version of the program will download as well. Feel free to pay for the software if you wish, but the free version will be sufficient for our needs.

  2. Navigate to where you downloaded the .zip file, and double-click to unzip it. Once it is unzipped, double click on the .pkg file that was contained in the .zip file.

  3. Follow the directions in the wizard until you reach the Installation Type screen. If you want to use only the free version of the program, click on the Customize button:

  4. In the Custom Install on “Macintosh HD” window, uncheck the MAMP PRO option and click on the Install button to install the application:

  5. Navigate to /Applications/MAMP and open the MAMP application. The Apache and MySQL servers will start, and the start page will open in your default web browser. If the start page opens, MAMP is installed correctly.

Setting up a local environment using XAMPP (Windows only)

  1. Download the latest version of XAMPP from http://www.apachefriends.org/en/xampp-windows.html#641. Download the .zip version.

  2. Navigate to where you downloaded the file, right-click, and select Extract All… . Enter C: as the destination and click on Extract .

  3. Navigate to C:xampp and double-click the xampp-control application to start XAMPP Control Panel Application :

  4. Click on the Start buttons next to Apache and MySql .

  5. Open a web browser, and enter http://localhost or http://127.0.0.1 in the address bar, and you should see the following start page:

  6. Navigate to http://localhost/security/index.php, and enter a password for MySQL’s root user. Make sure to remember this password or write it down in your notebook because we will need it later.

Configuring your local environment for Drupal

Now that we have the programs required to run Drupal (Apache, MySQL, and PHP), we need to modify some of their settings to match Drupal’s system requirements.

PHP configuration

As mentioned before, Drupal 7 requires Version 5.2.5 or higher, and as of the writing of this book MAMP includes Version 5.4.4 (or you can switch to Version 5.2.17) and XAMPP includes Version 5.4.7. PHP configuration settings are found in the program’s php.ini file.

For MAMP, the php.ini file is located in /Applications/MAMP/bin/php/[php version number]/conf, where the php version number is either 5.4.4 or 5.2.17.

For XAMPP, the php.ini file is located in C:xamppphp.

Open the file in a text editor (not a word processor), find the Resource Limits section of the file and edit the values to match the following values:

max_execution_time = 60;
max_input_time = 120;
memory_limit = 128M;
error_reporting = E_ALL & ~E_NOTICE

The last line is optional and is used if you want to display error messages in the browser, instead of only in the logs.

MySQL configuration

As mentioned before, Drupal 7 requires MySQL Version 5.0.15 or higher. MAMP includes Version 5.5.25 and XAMPP includes Version 5.5.27. MySQL’s configuration settings are contained in a my.cnf or my.ini file.

MAMP does not use a my.cnf file by default, so we need to copy the my-medium.cnf file from the /Applications/MAMP/Library/support-files directory to the /Applications/MAMP/conf folder. After copying the file, rename it to my.cnf.

For XAMPP, the my.ini file is located in the C:xamppmysqlbin directory.

Open the my.cnf or my.ini file in a text editor, find the following settings and edit them to match the following values:

# * Fine Tuning
#
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 512K
thread_cache_size = 8
max_connections = 300
#
# * Query Cache Configuration
#
query_cache_type = 1
query_cache_limit = 15M
query_cache_size = 46M
join_buffer_size = 5M
# Sort buffer size for ORDER BY and GROUP BY queries, data
# gets spun out to disc if it does not fit
sort_buffer_size = 10M
innodb_flush_method = O_DIRECT
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 4M
innodb_additional_mem_pool_size = 20M
# num cpu's/cores *2 is a good base line for innodb_thread_concurrency
innodb_thread_concurrency = 4

After you have made the edits, you have to stop and restart the servers for the changes to take effect. Once you have restarted the servers, we are ready to install Drupal!

The most effective way versus the easy way

There are many different ways to install Drupal. People familiar with working via the command line can install Drupal very quickly without an FTP client or any web-based tools to create and administer databases.

The instructions in this book are geared towards people who would rather not use the command line. These instructions attempt to get you through the technical pieces as painlessly as possible, to speed up the process of building a site that supports teaching and learning.

Installing Drupal – the quick version

The following steps will get you up and running with your Drupal site. This quick-start version gives an overview of the steps required for most setups. A more detailed version follows immediately after this section.

Once you are familiar with the setup process, installing a Drupal site takes between five to ten minutes.

  1. Download the core Drupal codebase from http://drupal.org/project/drupal.

  2. Extract the codebase on your local machine.

  3. Using phpMyAdmin, create a database on your server. Write down the name of the database.

  4. Using phpMyAdmin, create a user on the database using the following SQL statement:

    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER
    ON databasename.*
    TO 'username'@'localhost' IDENTIFIED BY 'password';

  5. You will have created the databasename in step 3; write down the username and password values, as you will need them to complete the install.

  6. Upload the Drupal codebase to your web folder.

  7. Navigate to the URL of your site. Follow the instructions of the install wizard. You will need your databasename (created in step 3), as well as the username and password for your database user (created in step 4).

Installing Drupal – the detailed version

This version goes over each step in more detail and includes screenshots.

  1. Download the core Drupal codebase from http://drupal.org/project/drupal.

  2. Extract the codebase on your local machine.

    The Drupal codebase (and all modules and themes) are compressed into a tarball, or a file that is first tarred, and then gzipped. Such compressed files end in .tar.gz.

    On Macs and Linux machines, tar.gz files can be extracted automatically using tools that come preinstalled with the operating system. On PC’s, you can use 7-zip, an open source compression utility available at http://www.7-zip.org.

  3. In your web browser, navigate to your system’s URL for phpMyAdmin. If you are using a different tool for creating and managing your database, use that tool to create your database and database user.

  4. As shown in the following screenshot, create the database on your server. Click on the Create button to create your database.

    Store your database name in a safe place. You will need to know your database name to complete your installation.

  5. To create your database user, click on the SQL tab as shown in the following screenshot. In the text area, enter the following SQL statement:

    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER
    ON databasename.*
    TO 'username'@'localhost' IDENTIFIED BY 'password';

  6. For databasename, use the name of the database you created in step 4. Replace the username and password with a username and password of your choice. Once you have entered the correct values, click on the Go button to create the user with rights on your database:

    Store the username and the password of your database user in a safe place. You will need them to complete the installation.

  7. Create and/or locate the directory from where you want Drupal to run. In this example, we are running Drupal from within a folder named drupal7; this means that our site will be available at http://ourdomain.org/drupal7.

    Running Drupal in a subfolder can make things a little trickier. If at all possible, copy the Drupal files directly into your web root.

  8. Using your FTP client, upload the Drupal codebase to your web folder:

  9. Navigate to the URL of your site. The automatic install wizard will appear on your screen:

  10. Click the Save and continue button with the Standard option selected.

  11. Click the Save and continue button with the English (built-in) option selected.

  12. To complete the Set up database screen, you will need the database name (created in step 4) and the database username and password (created in step 6). Select MySQL, MariaDB, or equivalent as the Database type and then enter these values in their respective text boxes as seen in the following screenshot:

  13. Most installs will not need to use any of settings under ADVANCED OPTIONS . However, if your database is located on a server other than localhost, you will need to adjust the settings as shown in the next screenshot.

    In most basic hosting setups, your database is accessible at localhost .

    To verify the name or location of your database host, you can use phpMyAdmin (as shown in the screenshot under step 4) or contact an administrator for your web server. For the vast majority of installs, none of the advanced options will need to be adjusted.

  14. Click on the Save and continue button. You will see a progress meter as Drupal installs itself on your web server.

  15. On the Configure site screen, you can enter some general information about your site, and create the first user account. The first user account has full rights over every aspect of your site. When you have finished with the settings on this page, click on the Save and continue button.

  16. When the install is finished, you will see the following splash screen:

    Additional details on installing Drupal are available in the handbook at http://drupal.org/documentation/install.

Enabling core modules

For a full description of the modules included in Drupal core, see http://drupal.org/node/1283408.

To see the modules included in Drupal core, navigate to Modules or admin/modules.

As shown in the following screenshot, the Standard installation profile enables the most commonly used core modules. (For clarity, we have divided the screenshot of the single screen in two parts.)

Assigning rights to the authenticated user role

Within your Drupal site, you can use roles to assign specific permissions to groups of users. Anonymous users are all people visiting the site who are not site members; all site members (that is, all people with a username and password) belong to the authenticated user role.

To assign rights to specific roles, navigate to People | Permissions | Roles or admin/people/permissions/roles.

As shown in the preceding screenshot, click on the edit permissions link for authenticated users.

  • The Comment module: Authenticated users can see comments and post comments. These rights have the comments going into a moderation queue for approval, as we haven’t checked the Skip comment approval box.

  • The Node module: Authenticated users can see published content.

  • The Search module: Authenticated users can search the site.

  • The User module: Authenticated users can change their own username.

Once these options have been selected, click on the Save permissions button at the bottom of the page.

Summary

In this article, we installed the core Drupal codebase, enabled some core modules, and assigned rights to the authenticated user role. We are now ready to start building a feature-rich site that will help support teaching and learning. In the next article, we will take a look around your new site and begin to get familiar with how to make your site do what you want.

Resources for Article :


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here