September 23, 2010

Installing Drupal In Ubuntu 10.04

Drupal is a an Open Source Content Management System. Installation of Drupal on Ubuntu 10.04 is relatively easy. Just follow the simple steps below:

1. Open a terminal and type:

varsha@varsha-laptop:~$ sudo apt-get install drupal6

2. You'll be prompted to select the database. With your arrow keys select mysql and press enter.

3. Enter your MySQL password when you are asked to. This creates a database schema called drupal6 in your MySQL RDBMS.

This is also supposed to auto-create the necessary files in the /var/www/ directory. But it didn't in my case, so I had to go for manual creation of files. Continue with the following steps only if you do not have a drupal directory in /var/www/.

4. Download the drupal6 source from Extract and do the following.

5. Create the necessary directory in /var/www/.

varsha@varsha-laptop:~$ sudo mkdir /var/www/drupal

6. Copy the contents of the extracted directory into /var/www/drupal/.

varsha@varsha-laptop:~$ sudo mv drupal-6.15/* drupal-6.15/.htaccess /var/www/drupal

7. Create a directory files in drupal/sites/.

varsha@varsha-laptop:~$ sudo mkdir /var/www/drupal/sites/default/files

8. Change the owner of the directory.

varsha@varsha-laptop:~$ sudo chown www-data:www-data /var/www/drupal/sites/default/files

9. Create the initial configuration files.

varsha@varsha-laptop:~$ sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php

10. Change the owner of the file settings.php.

varsha@varsha-laptop:~$ sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php

11. Create a database drupal6 using phpMyAdmin.

varsha@varsha-laptop:~$ mysqladmin -u root -p create drupal6

12. Log in to MySQL if you already have lamp-server installed on your system.

varsha@varsha-laptop:~$ mysql -u root -p

13. Grant permissions to the root user (or the username you log into MySQL with) on all tables in drupal6 schema.


Here, 'username' is either root or any other username you use to log into MySQL and 'password' is the password of the username.

14. Open your browser and type http://localhost/drupal/. You'll get the following page if you haven't created a database for Drupal.

Enter the details and click on Save and continue.

15. Next you'll get a screen as follows.

Enter your email address under Site information. Under Administrator account, enter a username, email address and password. I used my phpMyAdmin username and password and my email address. Click Save and continue.

16. Then you get a page saying "Drupal installation complete". Go to your new site.

Installation complete!


  1. Nice writeup. I'm having a problem at step 14, though. Instead of seeing the drupal page the browser is downloading a php file. This is at the top of the file:

    // $Id: index.php,v 1.94 2007/12/26 08:46:48 dries Exp $

    * @file
    * The PHP page that serves all page requests on a Drupal installation.
    * The routines here dispatch control to the appropriate handler, which then
    * prints the appropriate page.
    * All Drupal code is released under the GNU General Public License.
    * See COPYRIGHT.txt and LICENSE.txt.


  2. @Phil: seems like there is some problem with your index file because these are the first few lines of the index file. Re-check if you are done with the previous steps correctly. Check the index.php file inside the drupal directory.

  3. Yes, this looks like the index.php file in the /var/www/drupal directory. If I go to http://localhost/drupal/index.php I get something that's starting to look my my app, but not quite...

  4. @varsha: this is what worked for me:

    Instead of doing steps 4 through 10 I did the following:

    $ cd /var/www
    $ sudo ln -s /usr/share/drupal6/ drupal

    and then I generally followed the second set of instructions on this page (the ones right after:
    "Then - at the time of writing this post - some more steps are necessary to get Drupal running:"):

    That worked for me.

  5. finally you got it working? Thanks for sharing.

  6. I have attempted to install Drupal 6 using apt-get, but I've encountered an error during the dbconfig-common process.

    Error 1045 (28000): Access denied for user 'root'@localhost password: YES)

    Then it goes on the to define my choices...retry, abort, ignore...however there ARE NO OPTIONs that I can choose from. The only option is OK...and when I attempt to click the enter does nothing. I am now stuck here. What can I do to get out of this and undo what's been done, and find some normal directions to install Drupal 6 without all this automatic packaging that always seems to fail. Thanks,

  7. Sorry, I answered my own questions. I found a way through the process, and was able to retry. But when I put in the password that was supposed to be the Administrative account used to create MySQL db and user, as was configured during MySQL wouldn't work. What it wanted was the Root password for MySQL. For PHPMyAdmin config also.

  8. Hello again. I am now attempting to get Drupal installed manually, via your instructions, and I have extracted the tar.gz file, but when I attempt to move everything in it...and use your line of code that mentions drupal-6.15/htaccess...I get a message that there is no such file or directory. And when I do an ls of the drupal-6.15 directory, it gives me no list, like there's nothing in it. What is up with that? WCW

  9. So, your password problem is solved.

    And while moving the extracted folder, I think you are missing aout the "." in .htaccess, as you have written here. Or better check the version of the drupal package you have downloaded, and likewise use it in your command.

  10. Failed to select your database on your MySQL database server, which means the connection username and password are valid, but there is a problem accessing your data. MySQL reports the following message: Access denied for user

  11. The db for Drupal may not have been created. As for the last line you have written, which command exactly is giving you the error? Make sure you use the same username for logging into MySQL that you used while configuring MySQL during installing Lamp-server.