Last updated 6 March 2010. Created on 7 November 2009.
Edited by YetAnotherJen, doka. Log in to edit this page.

Ubuntu's Drupal Package

There is a Drupal package in Ubuntu, so Drupal install on Ubuntu is just this line
sudo apt-get install drupal6

For the actual state of the Drupal packages in Ubuntu repository, check this site:
The Debian repository is:

The Drupal libraries are placed in the file system, as used to be in Linux:

  1. /usr/share/drupal6
  2. Most of the Drupal staff is here, the rest are symlinked to this directory, so it's the Drupal root directory

  3. /var/lib/drupal6
  4. The /files directory

  5. /etc/drupal/6
  6. The .htacces, /sites and /profiles directories

  7. /var/www
  8. A symlink is here, pointing to Drupal root (/usr/share/drupal6)

As this directory layout structure is not the recommended one from the Drupal community, use this install scenario just for testing Drupal, but please note: any updates will be difficult. See:

Or use Drupal in virtual machines, and it's a quick way to get Drupal up and running.

Then - at the time of writing this post - some more steps are necessary to get Drupal running:

  1. enable the rewrite module and restart Apache:
  2. sudo a2enmod rewrite
    sudo /etc/init.d/apache2 restart
  3. change the rewrite base in /etc/drupal/6/htaccess
  4. from this one:
    # RewriteBase /drupal
    to this:
    RewriteBase /drupal6
    sudo sed -i 's/# RewriteBase \/drupal/ RewriteBase \/drupal6/' /etc/drupal/6/htaccess

  5. optional: increase PHP memory:
  6. sudo sed -i 's/memory_limit = 16M/memory_limit = 64M/' /etc/php5/apache2/php.ini

  7. optional: if you want to access Drupal over the network, then edit your DNS settings or add this line to /etc/hosts on your client:
  8. sudo su
    echo "" >> /etc/hosts 

    where change to the IP address of your Drupal machine

  9. open your browser and start the install process of Drupal:
  10. if you are on the same host then:
    if you have done the previous point then:

XAMPP in Ubuntu

As an alternative to Ubuntu's Drupal package, you can also use XAMPP to run Drupal locally (which should allow you to do Drupal updates in the normal way).

  1. Download the latest XAMPP for Linux version from the XAMPP website.
  2. Follow the Ubuntu forum's directions on setting up XAMPP in Ubuntu for installing, starting, testing, file location, stopping, and closing the security holes.
  3. Download the latest version of Drupal from Place it into the /public_html directory that you created with the Ubuntu forum directions.
  4. From Ubuntu, open up the terminal (Applications>Accessories>Terminal). Go to the /public_html directory in the terminal:
    cd ~/public_html
  5. Unpack the Drupal archive:
    tar xvfz drupal-6.15.tar.gz
    Open up the /public_html folder in Ubuntu's graphic interface (Places>Home Folder, and browse to /public_html). Rename the unpacked “drupal-6.15” folder to “drupal”.
  6. If XAMPP is not already running, start it in terminal:
    sudo /opt/lampp/lampp start
  7. Open up your web browser and go to http://localhost/yourusername/drupal. An install screen should appear.
    Note: At the time of writing, the PHP 5.3 in XAMPP was not compatible with Drupal 6 (although Drupal 7 will be), and this creates an error here, "Deprecated: Function ereg() is deprecated in /home/username/public_html/drupal/includes/ on line 902". If you have this problem, solutions are listed in the Drupal forums here and here.
    As per these comments, you can fix this error by navigating to /public_html/drupal/ and editing Drupal's .htaccess file (you may have to select View>Show Hidden Files in Nautilus to see .htaccess if you are doing this graphically). Add in the line php_value error_reporting 4096 and save the file. Navigate into the public_html/drupal/sites/default folder and open default.settings.php.
    Add ini_set('error_reporting', 4096); underneath all the other ini_set entries in default.settings.php. Save, and navigate to http://localhost/yourusername/drupal again—it should now bring up the install screen.
  8. Click install, and follow the directions that Drupal gives you (copying /sites/default/settings.default.php to /sites/default/settings.php, then changing its Properties->Settings to allow read & write by others; and adding a /sites/default/files/ folder, also with read & write permissions for others).
  9. When the Drupal installer asks you for information on your database, create a database as per the directions in the basic install. If you prefer a graphical user interface, you can use phpmyadmin for the database creation instead.
    Enter the details of the database into the Drupal installer, then continue with the installer's directions. Once the installer is done, you should be ready to use your Drupal site.
    Note: If you find you cannot access phpmyadmin (http://localhost/phpmyadmin) with your mysql root password after patching XAMPP's security, try logging in with your XAMPP pages username (lampp) and password first, and then entering your phpmyadmin username (root) and password (mysql root password) after that.

Additional post-installation note if you are creating a copy of a live site and putting it onto your local XAMPP install: After you create an export and import the live site's database into your local Drupal installation's database, you will need to run update.php (http://localhost/yourusername/drupal/update.php) in order to make the local site work with the new database (plus transfer the modules, themes, and files too).

Looking for support? Visit the forums, or join #drupal-support in IRC.


ThomasIsabelle’s picture


I successfully installed Drupal 6.12 via the above instructions. It was a piece of cake!

Now installed, I have an issue. When I go to the "Administer" section, the message comes up:

- - -
* One or more problems were detected with your Drupal installation. Check the status report for more information.
* There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information.
- - -

Following the links, it appears the issue is that I need to upgrade the Drupal core to version 6.14, but I am not clear on how this works. I can download and unpack "drupal-6.14.tar.gz". According to step # 7 in the "UPGRADE.txt" file (in the unpacked "drupal-6.14" folder), I am supposed to "Unpack the new files and directories into the Drupal installation directory." From your instruction, I am guessing this would be the "/usr/share/drupal6" folder.

This does not work as suggested, because (though I am the original administrator user on my Ubuntu desktop) I have no way of copying the files as the "/usr/share/drupal6" folder is locked. If this is where they go, I need to know how to allow them by changing the permissions. If I am supposed to do something entirely different, please advise as well.

Thank you much!

spookypld’s picture

You can copy using Terminal. Here's the code.
sudo cp -r /home/username/path/drupal-6-15 /usr/share/drupal6 Remember to provide exact username and path to newest Drupal folder

mcgarcia’s picture


There is also another possibility which is enabling a virtual host for Drupal. This is useful if we have several development sites running in the same localhost machine. I am not an expert in Ubuntu by far, but, in my case, I have a Mahara, Drupal and Moodle site running in the same laptop and I don't use Xampp.

I wrote the instructions to do so at and maybe they will be useful for people who try to do the same with Drupa:

I am not trying to sell anything, I have just installed Drupal as a new virtual host and I would like to share that.


Mari Cruz Garc'ia