Setting up Drupal locally

The first main difference between setting up a local test environment versus through the host is that when you decide to test locally, you will need to install PHP, a web server, MySQL, and PHPMyadmin. If you test through your host, you will not need to go through this process because they have it setup on their side. Please don’t be scared, though. Setting up these programs is not particularly difficult, plus I will walk you through them step by step.

As I mentioned in the Decide Where to Test Your Site section of How to Start Your Own Website, when you test locally you are basically creating a server on your own computer, which means you need to install a web server, MySQL, PHPMyAdmin, and PHP. If you test through your webhost, you will not need to set up these programs. Below are the 4 items you need to install. I know, it seems like a lot, but they are actually fairly easy setups that should not take too long.

1. Install a web server. The two main web servers are Apache and Microsoft IIS. I will be providing instructions for Installing Apache.

2. Install PHP. As a very basic definition, PHP is a server side language that is used to make sites “dynamic,” and it is necessary in order for Drupal to work. Click here for instructions for Installing PHP.

3. Install MySQL. Now, you need to install a database, and although you can use any database (Microsoft Access, for example), MySQL works the best with PHP. Click here for instructions for Installing MySQL.

4. Install PHPMyAdmin. PHP MyAdmin is a much more user friendly interface to use with MySQL. Although this is technically an optional step, you must be crazy if you don’t use it. Click here for instructions for Installing PHPMyAdmin.

Have any luck? Hopefully that wasn’t too bad. Now, you need to create a database table within MySQL for Drupal to install its information.

Create database table

If it’s not already open, launch phpMyAdmin in your browser. It should be located at http://localhost/phpMyAdmin/. The following instructions are based on phpMyAdmin version 3.1.1. Although your pages may look different if you have a different version, the steps should be basically the same. Since the database does not exist yet, we will need to create it. Under the MySQL localhost heading on the main page in the center of the screen, enter the title of your database. The name should be the name of your site or something very similar (i.e. buildyourownstory). Click the Create button and you will be taken to a new screen with comments at the top next to a checkmark indicating that the new database has been created. Drupal will create all of the tables and information for this database for you, so you don’t need to worry about that.

If this is the first database you set up, the only registered user for your MySQL account is the superuser account named “root,” which has complete control of everything. It’s generally a good idea to not use the superuser to access the database for security reasons, but we can take care of that later and it is fine for now to use the root user.

Begin Installation

You are now very close to having your Drupal site up and running and now you can finally go to the installation page (which Drupal calls running the install script). Believe it or not, this is one of the easier steps to follow. Open a browser and type http://localhost/drupal (if you did not use “drupal” as the name of your folder in the last step, replacing “drupal” with whatever you named your folder). If all goes well, you should be presented with a Drupal installation page and you have made it over the first hurdle. As you can see on the left side of the screen, Drupal will take you through several steps. First, choose Language should appear on the main screen. Beneath it, click Install Drupal in English. For the second step, Verify Requirements, Drupal will automatically check to make sure everything is OK, and if you followed the steps above, you should be taken to the Database configuration screen and the Set up database step should be highlighted on the left side of the screen (not sure why the screen titles don’t match the names on the left). Since we already set up the database, on this page you just need to provide Drupal with the information from the database you set up earlier so that it can add tables, etc. to the database. In the Database name field, enter the title of the database you just created in phpMyAdmin (i.e. buildyourownstory). In the Database username field, enter “root” if you followed my directions and in the Database password field, enter the password you set up for MySQL. It’s worthwhile to point out that with the all the accounts you need for your site you will have a lot of log-in account names and passwords, so you may want to write them down and keep them in a safe place. Just a thought.

Since we are using our own computer for testing and development, we can ignore the Advanced options at the bottom of the page because the default settings are fine. If you are using a database server that is not on your own computer, you can use these settings to enter this information. Once you are finished, click the Save and continue button at the bottom of the page.

Almost there! You are now ready to go to the Drupal Installation Page.

If you found this article to be helpful, please consider making a donation.


Posted on January 22, 2010 at 2:37 am by Scott Butler · Permalink
In: Drupal

Leave a Reply