Ubuntu Server 12.04 / Drupal Install Modules and themes

Easy LAMP server installation

The easiest method is to use a single command from the command-line terminal, which installs the entire LAMP stack in an integrated package:

sudo tasksel install lamp-server

If your system doesn’t provide the tasksel command, then install it:

sudo apt-get install tasksel

I also (optionally) recommend enabling the rewrite functions of Apache2, which helps with many modules in Drupal and with the correct redirection of web-pages on your Apache server:

Edit the file “/etc/apache2/sites-available/default” and replace every occurrence of “AllowOverride none” with “AllowOverride All“, then run:

sudo nano /etc/apache2/sites-available/default


sudo a2enmod rewrite
sudo service apache2 restart

You have an Intranet Drupal. If you want to upload modules and themes from internet, you must give the right permissions and DNS server when you have a fiwed ip in internal network

Things to check :

You’ve got nameservers defined in /etc/resolv.conf and put your internal DNS name server instead default below :

/etc/resolv.conf :


You’ve got a default gateway (proxy ip) in your routing table:

ip route

tom.oconnor@charcoal-black:~$ ip route dev virbr0  proto kernel  scope link  src dev eth0  scope link  metric 1000 dev eth0  proto kernel  scope link  src 
default via dev eth0  metric 100 

Default route is the one that starts “default via"

Clean URLs

Have Clean URL activated in Drupal :

The rewrite_module must be loaded in Apache.

in file ‘default’ (etc/apache2/sites-available/default)
change for the Directory /var/www
AllowOverride None
to AllowOverride All

Clean URLs

To get Clean URLs working, you need to uncomment and change the value of RewriteBase in the htaccess file in your drupal folder to ‘/drupal’:

Modify the RewriteBase if you are using Drupal in a subdirectory or in a VirtualDocumentRoot and the rewrite rules are not working properly. For example if your site is at http://example.com/drupal uncomment and modify the following line:

sudo nano /var/www/drupal/.htaccess
  # RewriteBase /drupal


    RewriteBase /drupal

Giving the right to Apache on www folders for installing remote modules :

For Manual installation by ftp transfer, It is required to create a files subdirectory in your drupal default site installation directory. It will be used for files such as custom logos, user avatars, and other media associated with your new site.

sudo mkdir /var/www/drupal/sites/default/files
sudo chown www-data:www-data /var/www/drupal/sites/default/files

It is also required to create the initial configuration file for the default site.

sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php
sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php

Write Access

If you not to worried about security then changing write access is the quick method

When the user is www-data:

sudo chown www-data:www-data -R /var/www/drupal/sites

Add an existing user to www-data group

Type the following command to add an existing user called mimas to the www-data group, enter:

sudo usermod -a -G www-data  mimas
id mimas
groups mimas

Making www-data user and group drupal folder owner

 sudo chown www-data:www-data -R /var/www/drupal


Adjust PHP memory limit

You should increase the default PHP memory limit value (the amount of memory dedicated to running scripts), since the default 8 MB is not sufficient. Use 96 MB (or even 160M) if you intend to use graphics (although for simple uses 32 MB may be sufficient).

In newer versions of Drupal6, you can simply edit the settings.php file and add the line:

ini_set('memory_limit', '96M');

It is also possible to increase the amount of PHP memory using this method:

Edit the /etc/php5/apache2/php.ini file and increase the memory_limit value to 96M (or another value of your choice).

If using PostgreSQL, you can also edit the /etc/php5/apache2/php.ini file to accommodate PostgreSQL options by adding the line:



Adjust PHP Error Reporting

An adjustment to the error reporting is required for the install.php page to come up properly. Edit your settings.php file (e.g., /etc/drupal/6/sites/default/settings.php) and add the following ini_set line after the existing ini_set lines:

ini_set('error_reporting',          4096);


Since 20 years I work on Database Architecture and data migration protocols. I am also a consultant in Web content management solutions. I am an experienced web-developer with over 10 years developing PHP/MySQL, C#, VB.Net applications ranging from simple web sites to extensive web-based business applications. When not writing code, I like to dance salsa and swing and have fun with my little family.

You may also like...