How to Install Drupal Tutorial

Matt West Tue, 02/05/2008 - 02:41 22 Comments
Tagged:

Installing Drupal has gotten easier and easier throughout the years. It can be broken down into these steps.

1. Downloading and preparing the Drupal installation files

2. Setting up the mySQL database

3. Running the drupal install program

Downloading and preparing the Drupal install files

You can download the latest drupal installation files from drupal.org. Drupal compresses all of its install files in a tar and gzip format. To extract these on a windows machine you need a special program. There are many of them out there, but one of the easiest (and free open-source) ones to use is 7-Zip. Once you install 7Zip you can right click on the drupal.tar.gz file and click 7-Zip->Extract Here. Then you will have a drupal.tar file in the current folder. Right click and click 7-Zip->Extract Here again and you will have a drupal folder. Copy this folder to your web site folder. If you are using WAMP in the default location it will be c:\wamp\www.

I like to setup my sites under sub folders in the www folder. For example this site is located under the c:\wamp\www\drupal on my local computer. Another site I have that is for Visual Basic tutorials is located under c:\wamp\www\vb6. I highly recommend you do this as well. If you are only administering one site you probably can just copy all of the folders you extracted from the drupal install folder into your root web folder (c:\wamp\www) but than you can only have one drupal installation at a time.

If you do put the files in a sub directory under your main web folder here's what you can do to set things up so that it acts like its own web site (instead of a subdirectory of a web site). If you don't understand what I'm saying follow along and it will make sense. Say that you copied all of the drupal data into a sub folder of your www folder called mysite. Now your web site would be located at (c:\wamp\www\mysite). If you want to go to your web site through a web browser you would type in http://localhost/mysite. The problem is if you upload your new site to (www.mysite.com) anything images or files that are referenced through /mysite/ will be broke. Because of this we need to set up an alias so that you can type http://mysite.localhost into your web browser instead of http://localhost/mysite.

To do this we need to change a couple of files. The first is your apache configuration file (httpd.conf). If you are using the default WAMP install it will be located at c:\wamp\bin\apache\apache2.2.6\conf\http.conf. Open this file in a text editor and find the line that reads:

ServerName localhost:80 

Now we are going to add our new sites virtual host information. Add these lines below the ServerName line.

NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot "c:/wamp/www/"
  ServerName localhost
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "c:/wamp/www/mysite"
  ServerName mysite.localhost
  ServerAlias mysite
</VirtualHost>

This tells apache that anytime someone requests a server through http://localhost it should serve pages located at c:/wamp/www/ where as any time someone requests a server through http://mysite.localhost it should serve pages located at c:/wamp/www/mysite. Now if localhost was actually a domain we owned and registered than we would be done. However, localhost is a unique name that maps to our computer using the loop back ip (127.0.0.1) if you don't know what that means that's ok but basically you need to understand that anytime you type http://localhost Windows looks in a local file finds an entry for localhost and knows to route everything back to this computer. That file is is called the hosts file and it is located at C:\Windows\System32\drivers\etc\hosts. If you open this file in notepad you will see an entry that looks like this:

127.0.0.1       localhost 

This tells Windows to reroute any requests to http://localhost back to our computer (127.0.0.1). Below this line we need to add a line that looks like this:

127.0.0.1       mysite.localhost 

This will then tell windows to also route any requests to mysite.localhost to our computer. Than apache will see that we are requesting mysite.localhost instead of just localhost and will use the alias we set up in the httpd.conf to serve the files in c:\wamp\www\mysite. Few - that's a lot of explanation for just a few steps, but by understanding all this you are way ahead of the game if you ever want to host your own server down the road. Plus its just good to know.

Setting up the mySQL database

Now that our server settings are all set up and we have the drupal files copied over lets set up our mySQL database. In the past you had to install all of the SQL data using a script. Now, however, all you need to do is set up a blank database and know your username and password. We are going to use phpMyAdmin to do this. If you installed WAMP you can go to http://localhost/phpmyadmin. Once there type in the name for your database (i.e. mysite) under the Create new database field. Then click the Create button. That is it. You can also add a custom user that has access to your database by clicking the Privileges link. If you do this make sure you give that user full access to everything in your mysite database.

Now that you have the database set up you need to remember (or write down) the following information. The name of your database, the username, and the password to access the database.

Running the drupal install program

Installing Drupal is one of the easiest parts of this Drupal tutorial. All you have to do is go to http://mysite.localhost and you should see a screen that looks like this:

If I were you I would probably select english (unless of course you understand another language or want to have some fun). After that it should skip by the verifying requirements sections unless you have an error in your setup. If this is the case follow the onscreen instructions to solve your error.

Next you will enter the database information I told you to remember earlier. Enter the database info, the username, and the password. I would leave the advanced settings alone for now. Click the Save and Continue button.

You should now see a status screen as drupal is installed. It usually only takes a minute or two. Next the Drupal install program will ask you to set up your new site! Type in the info it asks. Make sure you remember the administrator username and password (this is different than your database username and password). You will use this to log in to your drupal site and administer all the different settings and to add content. Also if you have the option I suggest you turn on clean URL's. If you don't do this your web page addresses will look like this http://mysite.localhost/index.php?q='mypage'. If you do turn on clean URL's the same page will have the address http://mysite.localhost/mypage. Also this makes your Drupal site much more likely to be indexed and ranked well by search engines. This is called making your site Search Engine Friendly.

Once you are done setting you will have a full fledged drupal web site up and running. Check it out at mysite.localhost. Have a look around, start changing the default settings. Read on this site more tutorials and have a great time. Once you get your site online somewhere post a comment below letting me know or send me an email. I love to see what people are doing with these tutorials.

Comments:

Posted by Arun (not verified) on Mon, 06/29/2009 - 05:56

hi,
i've a domainp pointing to my server, i've installed drupal successfully, but when i send any mail or add user. i'll get an error. SMTP port error, what i need to do to configure mail for my site. please help .

Arun,
toarunkumaras@gmail.com

Posted by Anonymous (not verified) on Sat, 06/20/2009 - 19:34

THANK YOU !! for your tutorial. I am running this WAMP site on my flash drive and the only thing I had to alter (aside from your suggestions) was the Apache php.ini file and max_execution_time setting.

Now for the fun.

Posted by Subhrajit (not verified) on Sat, 05/23/2009 - 11:15

I'm new to Drupal and well... that can be said from the fact that I can't seem to be able to even install it for starters. Am also new to PHP-Apache-mySQL thingy...

So I can't go beyond the language selection link which says "Install Drupal in English". Soon as I click it, I get a brilliantly white page with nothing on it.

I have already copied "default.settings.php" to "settings.php" in the appropriate folder, so now both the files are there.

I was earlier able to get to the screen where I entered the database name ("drupal" - this was a schema that I have created in mySQL earlier) followed by the username ("root") and password that I have got set for "root" user.

Would have been realllly nice if I could even get an error message... atleast then I'd know what I have to fix!!!

Please help... anybody...?

Thanks

Posted by Shibani (not verified) on Mon, 05/04/2009 - 20:51

I keep entering my Database name and Username but nothing happens. The page doesn't move forward. Nor do I get any error message. What should I do? I am new to drupal :(

SOS!

ps: Using Windows XP, if that helps..

Posted by Martin (not verified) on Sun, 05/17/2009 - 22:32

If you followed the step that the Drupal installer told you to do about the default.settings.php, make sure you didn't just rename the file... as it requires both of them. i.e. one file called 'default.settings.php' and another (just copy and rename it in same folder) called 'settings.php'. I had the same problem and after I did this, it fixed it. I'd also like to add that the person who created this tutorial never took into account any problems that might have occurred. I had to look up several problems I suffered from external forums etc.

Anyways, hope this helps.

Posted by Sriram (not verified) on Tue, 06/30/2009 - 20:40

Thanks a lot Martin. I was searching for this answer since many days. Nice find.

Posted by Anonymous (not verified) on Tue, 04/28/2009 - 08:40

I have installed drupal but I am unable to navigate through it.
When I click http://localhost/index.php I can see the login screen, but after that when I press antthing (ant link), I am unable to navigate through the site. I am getting: "The requested URL / was not found on this server." and my browser's url changes to "http://localhost/?q=node&destination=node".

Posted by Anonymous (not verified) on Wed, 04/01/2009 - 10:44

When i check in command promt for httpd.exe I get the following syntax error
Expected "VirtualHost*:8080" (In TAGS)

but saw "VirtualHost"(In TAGS)

Posted by Anonymous (not verified) on Wed, 04/01/2009 - 10:42

When i check in command promt for httpd.exe I get the following syntax error

Expected ""
but saw ""

Posted by Anonymous (not verified) on Wed, 04/01/2009 - 10:40

httpd file has a syntax error.
it says:
Expected
but saw

Posted by Jane (not verified) on Tue, 02/24/2009 - 15:47

Joshua is right, to get passed the database config screen drupal needs both default.settings.php and settings.php files. I used rename to create the new file which, of course, deleted the old one. Using copy instead ensures you end up with both files.

Thanks for the simple straightforward instructions, if I had found this site earlier it would have saved me hours.

Posted by dilip (not verified) on Tue, 02/10/2009 - 07:02

Only difference I found to these instructions was after clicking 'install in english' - I was then prompted to copy
./sites/default/default.settings.php
to
./sites/default/settings.php
iam not able go to nnext step of drupal installation can me help me outplease

Posted by Abhinav (not verified) on Tue, 04/28/2009 - 12:28

Just copy and paste "default.settings.php" and rename it to "settings.php"
just delete "default." from the file name.
or you can also create a new text (.txt) file and rename it with file extension to "settings.php"

Posted by Nasru Rozi (not verified) on Sat, 01/31/2009 - 07:40

You explained: "You Now that you have the database set up you need to remember (or write down) the following information. The name of your database, the username, and the password to access the database" This sounds easy, but as I try i couldnt find how to make a password, username. what I know from the screen is just making a database name, that's it. where can i set my password and username? is that on localhost/phpmyadmin, or on wordpad with .php extention? i just got everything blank. what i finally got is this message, "access is denied for user bla bla..bla..), sorry I'me a newbie. help me pls...

Posted by nardsurfer (not verified) on Thu, 06/04/2009 - 17:52

try the username 'root' (its the default) and your password will be blank unless you have set it up. If you need to set it up then google 'setting up mySql password'. Its done in the mySql console through your wamp server set up.

Posted by davina on Thu, 01/15/2009 - 15:32

wanting to set-up as scratch patch on localhost.
Followed install instructions & installed Wampserver 2.0c on XP sp2

Error message on http://localhost/phpmyadmin/:
phpMyAdmin 2.11.6
Error
MySQL said:
#2003 - Can't connect to MySQL server on 'localhost' (10061)

The wampserver speedometer icon is mostly yellow.

mysql log says:
Log file:
090114 7:58:44 InnoDB: Error: unable to create temporary file; errno: 22
090114 7:58:44 [ERROR] Default storage engine (InnoDB) is not available
090114 7:58:44 [ERROR] Aborting

090114 7:58:44 [Note] wampmysqld: Shutdown complete

please advise, needing help desperately?
Thanks in advance
Cheers D.

Posted by Priya (not verified) on Fri, 12/19/2008 - 05:36

I ve created two different folders as mentioned like above details

c:\wamp\www\drupal and
c:\wamp\www\mysite

C:\Program Files\xampp\htdocs\drupal and
C:\Program Files\xampp\htdocs\mysite

when i installing /localhost/drupal/

How the webpage will change to localhost/mysite/

whether i ve to give any URL's for connecting these drupal and mysite

What is the difference bwt of these two??

Oh confusing!!

Regards,
APR

Posted by Joshua Carter (not verified) on Mon, 11/17/2008 - 21:09

Appreciate the help, and as an encouragement, I think your howto would go from great to awesome if you include something regarding the potential for some not to get past the database config install script. There are issues if you delete the default.settings.php file after creating settings.php. Apparently Drupal looks for both files during the installation process.

Posted by DorjeM (not verified) on Tue, 10/28/2008 - 08:21

Only difference I found to these instructions was after clicking 'install in english' - I was then prompted to copy
./sites/default/default.settings.php
to
./sites/default/settings.php

Everything else (except a PORT 25 not enabled notification - I don't have email enabled in my wamp install) worked great and I'm up and running.

PS - write down sql username and password as well as admin username and password - makes life much easier.

Many thanks for the howto - great stuff.

DorjeM

Posted by Bill Scheurer on Sat, 06/14/2008 - 03:24

i am unable to save the file in notepad after adding this:

127.0.0.1 localhost This tells Windows to reroute any requests to http://localhost back to our computer (127.0.0.1). Below this line we need to add a line that looks like this:
127.0.0.1 mysite.localhost

so, what will happen if i cannot change this file?

Posted by Anonymous (not verified) on Sun, 05/24/2009 - 02:34

Go to start --> programmes --> accessories and right click notepad and use open as administrator. Open the file through notepad and you will be able to alter the file. :D

Posted by Anonymous (not verified) on Sat, 08/23/2008 - 05:32

I'm using Vista and had the same error but got around it by copying the file to the desktop, modified it, then dragged the file back to the "etc" folder. At this point it asked me for administrative permission a couple of times and it's all good!

Post new comment
The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options