WELCOME TO OUR BLOGGER

Friday, December 23, 2011

How to Install Drupal Tutorial

 
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.

No comments:

Post a Comment

Search

Blogroll