Install Apache-PHP-MySQL-Drupal on Ubuntu 8.0.4(Hardy)

I recently installed Drupal on my Ubuntu 8.0.4 desktop. Below are my step-by-step instructions.

1. Install Apache HTTP Server

sudo apt-get install apache2

2. Install MySQL Database Server
sudo apt-get install mysql-server-5.0

3. Install PHP5 and Apache PHP5 module
sudo apt-get install php5 libapache2-mod-php5

4. Install phpMyAdmin (Optional)
sudo apt-get install phpmyadmin

5. Install MySQL Administrator (Optional)
sudo apt-get install mysql-admin

6. Open php.ini
gksudo gedit /etc/php5/apache2/php.ini

7. Add the following line in the php.ini

8. Open apache2.conf
gksudo gedit /etc/apache2/apache2.conf

9.Add the following line of code inside apache2.conf to setup phpmyadmin under Apache
Include /etc/phpmyadmin/apache.conf

10. Now restart Apache
sudo /etc/init.d/apache2 restart

11. Go To http://localhost/phpmyadmin
Login using your MySQL user name and password that you have set when installing MySQL server.Create a database for drupal.  In my case I created a database named “drupaldb”.

12. Install GD module for php5
sudo apt-get install php5-gd

13. Download the latest stable Drupal from here.
In my case I am using drupal-6.9.  Change to your default download directory.

14. Extract the drupal-6.9.tar.gz to your default web directory.

sudo tar -xvf drupal-6.9.tar.gz  -C /var/www/

15. Change to drupal sites default directory
cd  /var/www/drupal-6.9/sites/default

16. Make a copy of default.settings.php file as settings.php
sudo cp default.settings.php settings.php

17. Make the settings.php as writable
sudo chmod a+w settings.php

18. Make the sites/default directory as writable
sudo chmod a+w /var/www/drupal-6.9/sites/default

19. Now restart Apache
sudo /etc/init.d/apache2 restart.

20. Go to . You will see drupal install page.

Install Page.

Install Page.

21. Enter database information. Save and Continue.

Enter database info.

Enter database info.

Install Progess

Install Progess

22.  Enter site name and admin email address.

Enter site name and admin email address.

Enter site name and admin email address.

23. Enter site admin name and password.

Enter admin user name and password.

Enter admin user name and password.

24. Drupal install is complete. Click your new site to go to new site.

Install Complete

Install Complete

Note: After installing Drupal, remove the write permissions from settings.php file to avoid security risks.

sudo chmod a-w /var/www/drupal-6.9/sites/default/settings.php

14 Responses

  1. stan says:

    thank you so much for this great tutorial!

    only one thing:
    ’15. Change to drupal sites default directory
    sudo cd /var/www/drupal-6.9/sites/default’

    ‘sudo’ is not needed here!

  2. tims says:

    Thanks for the step by step instructions. I needed this, since I am not a system admin sort of person. I just followed your instructions verbatim with few exceptions (eg. Drupal 6.10 was the available download instead of 6.9)

    A couple of issues that I had:

    On step 14, I had to change directories to my desktop, the default download location for my Ubuntu OS.

    For people like me, explicitly stating how to remove write permissions would be helpful (sudo chmod a-w settings.php)(sudo chmod a-w /var/www/drupal-6.10/sites/default).

    After I removed write permissions, I still had an error on the status report. “The GD library for PHP is missing or outdated….” I’ll have to see what I can do to fix that.

    Thanks again!

  3. codemechanic says:

    You are right stan. I will update the post.

  4. codemechanic says:

    Thanks for your feedback tims. I will update the post. Try to install php-gd5 from the synaptic. That might solve ur issue.

  5. Nam says:

    Thanks man ! i was done ! 😀
    I’m a new guy to ubuntu . I’m using Ubuntu 8.04 LST .
    When using MS Windows , I using CS Dreamveaver CS 4 and Wampp Server to Code , debug and buiding website (I’m using PHP) ! But now , I will using PHP PDT and Apache2 that you was guide me ! Sorry for my English mistake if i had !
    Have a nice day !
    Nam !

  6. Ed says:

    HUGE help! thanks so much.

  7. JJ says:

    Do I need to do the following:

    7. Add the following line in the php.ini

    My current php.ini does not have it and it still works – Just trying to understand what it does. I googled but nothing came up.

    Thanks for guide.

  8. chapman says:

    Thanks a lot for this it really helped me. it would be great if you could keep it updated. Oh and maybe someone could add instructions for cvs

  9. psampaz says:

    Great article. Thanks for sharing.

  10. David says:

    Thank you very much from Spain codemechanic!!! It is great to find people so generous. Thanks again.

  11. UKC says:

    Thanks for the step by step tutorial. Its really helpful. Thanks again

  12. jack says:

    Followed the instructions above to setup my drupal on ubuntu -virtual box. Worked smoothly. Thanks very much.


  13. Shiv says:

    I was wondering about how to install Drupal but your tutorial make it so simple. It’s fabulous. But please add two more things:

    step-12. Install GD module for php5 — Some blog posts mention that we have to enable gd extension from php.ini file. It wasted so much of time. So i dont’t want the same with other people. Please mention that there is not any need of such change in php.ini file regarding extensions.

    Please add the step to extend the default memory limit from 16M to $40M at least and if possible 128M in php.ini

    Thank you so much for such a great tutorial
    Thanks one again.

  14. Jancuk says:

    Thanks, it’s a big help when drupal’s website itself doesnt have a good instruction..

Leave a Reply