I recently set up an Ubuntu server inside VMware to test several Drupal sites offline. Installing Ubuntu is straightforward. Simply download one of the available images and run through the setup process. If you are working with older Drupal sites, especially Drupal 6, I recommend using Ubuntu 8.04.4 LTS (Hardy Heron). It includes PHP 5.2 by default, while later versions ship with PHP 5.3, which can cause compatibility issues for Drupal 6. If you are using Drupal 7 or newer, this is less of a concern.

During installation, Ubuntu will ask whether you want to include optional services. Make sure to install:

  • LAMP Server
  • OpenSSH Server
  • Any additional packages you require

This provides a basic working environment that you can fine tune for Drupal.


Step 1: Increase PHP and MySQL Memory Settings

Drupal benefits from higher memory settings. Update your configuration files as follows:

Edit MySQL settings

sudo nano /etc/mysql/my.cnf

Search for max_allowed_packet. It appears twice. Increase both values to something higher, such as 128M.

Edit PHP settings

sudo nano /etc/php5/apache2/php.ini

Find memory_limit and increase it to 128M or more, depending on your needs.


Step 2: Enable Clean URLs (Apache Rewrite Module)

Drupal relies on the Apache rewrite module to support clean URLs. Enable it with:

sudo a2enmod rewrite

Confirm it is enabled:

apache2ctl -M

You should see rewrite_module in the list.


Step 3: Update Apache Virtual Host Settings

Assuming you are using the default site, modify the Apache configuration file:

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

Locate this section:

<Directory /var/www/>

Inside that block, update:

AllowOverride None

to:

AllowOverride All

This allows Drupal’s .htaccess file to function properly.

Save the file and reload Apache:

sudo /etc/init.d/apache2 reload

Step 4: Deploy Your Drupal Site

At this point you can:

  • Copy your web files into /var/www/
  • Import your MySQL database
  • Update your settings.php file as needed

Once everything is in place, load your site in a browser and it should behave exactly like your live environment.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.