Sunday, May 22, 2011

Installing LAMP and Drupal on Ubuntu 10.10

I recently wanted to start a personal Drupal site that I can use for information about video games that I play.  I would be the only person administrating the site, and in all probability, I would be the only person viewing the site.  I am also interested in Drupal because we use it at work and I think it would be a good idea to know more about it.

I installed LAMP first.  LAMP is an open source web development platform and consists of Apache, MySQL Database, and PHP.  The L stands for "Linux", and something similar exists for Windows called WAMP.  I found this site that explains how to install LAMP on Ubuntu 10.10 and 11.04.  Most of the information for this post comes from this site.  See the link below:

First, I installed a software installation package called taskselTasksel groups software by tasks, and it allows you to install packages for a specific task with one command.  So to install tasksel, I used the following command:

sudo apt-get install tasksel

Begin the installation of LAMP by running the tasksel program we just installed:

sudo tasksel

I moved the cursor down to "LAMP server" using the arrow keys, selected "LAMP server" using the space bar, and then hit tab to "Ok" and pressed enter.

The installation asked me to enter a root password for the MySQL database.  Other than that the installation of LAMP did not require any interaction on my part.

After installing LAMP your Ubuntu box will be a functioning web server.  You can verify that the installation configured PHP correctly by creating an info.php file:
  • sudo vi /var/www/info.php 
and adding this brief php program to display the results of phpinfo()
  • <?php
  • phpinfo();
  • ?>
Save and exit vi and restart apache2:

  • sudo /etc/init.d/apache2 restart
At this point you should be able to navigate to the page http://localhost/info.php and see PHP info.  You can see screen shots of this page at the link I mentioned above.


Next, the page mentions installing something called phpmyadminPhpmyadmin allows you to manage your MySQL Database through a web browser.  I love this idea!  So I installed phpmyadmin with the following command:
  • sudo apt-get install phpmyadmin
After installing you should be able to go to http://localhost/phpmyadmin and login using root as the username and the password you specified during the installation of LAMP.  After logging in, you can administrate the local MySQL database.  You will have to create a database here when installing Drupal.

Now we can install Drupal!

I followed this guide for the most part and I did not encounter too many problems.  I wrote a brief synopsis of my experience below.

I mentioned that a database had to be created for Drupal.  If you haven't already, log on as root to http://localhost/phpmyadmin.  The place where you create a database should be on the initial screen you see after logging in.  Type the name of the database and click "Create".  You can leave both of the options at their default settings.  Remember the name of this database because you will have to use it when configuring Drupal.

Next you will need to download the files for Drupal.  These files can be found here.  After downloading the correct version (I choose 6.9 so the file name was drupal-6.9.tar.gz) move the file to the document root of the web server( in my case this was /var/www).  Unpack the file using the following command:
  • tar xvzf drupal-6.9.tar.gz
This will create a directory called /var/www/drupal-6.9.  Consider this the Drupal root.  I changed the name to "site" for simplicity sake. 

Navigate to the site http://localhost/site/ to begin the Drupal installation process.  I didn't have a problem with the installation.  I had to change the permissions on a directory and copy a file.  You will have to enter the name of the database you created in the first step.  After completing installation you should be able to navigate to http://localhost/site/ and log in as administrator for further configuration.

Any site that I mention in this post with localhost in it may be different in your case.  In my case I was loading the page from the server itself.  I can also view these pages on a different computer by using the host name or ip address of the web server instead of localhost.

I completed this process in about two hours.  I have been playing around with it but I have not had much luck yet.  I'll post with more info at a later point.

Until next time...

No comments:

Post a Comment