So I recently created a VMware application with Ubuntu to test some of my Drupal sites offline. You can easily install Ubuntu by downloading one of their Images, I recommend 8.04.4 LTS (Hardy Heron) as it comes with Php 5.2. Anything after Hardy Heron comes with PHP 5.3 which causes issues with Drupal 6. If you are using Drupal 7 or newer than it probably won’t matter. But as most of us are probably on Drupal 6, I thought I would mention this.
So just download the server version and run through the installation. It’s pretty straightforward and at one point it will ask if you want to install optional services. Install the LAMP, OpenSSH, and anything else you will want. Now you should have a running server with a basic LAMP install running. You will want to edit a few things so that it plays nicely with Drupal.
Drupal uses a bit of memory, so let’s increase this first. Edit your php.ini and my.cnf files.
# nano /etc/mysql/my.cnf
Search for max_allowed_packet, there will be two occurrences, increase the limit to whatever you see fit, I push mine to 128M.
# nano /etc/php5/apache2/php.ini
Search this file for memory_limit and increase it to let’s say 128M as well.
Now, since we probably use clean URLs, we will want to enable this as well.
First, enable the rewrite module:
# sudo a2enmod rewrite
Check to see if it’s enabled (It should be in the list):
# apache2ctl -M
Next, we are assuming you are running a single site, but if not just follow the same process substituting the correct filename.
# sudo nano /etc/apache2/sites-available/default
Look for this: <Directory /var/www>), and immediately below this code find and change this line:
AllowOverride None to AllowOverride All
What this does is it allows us to use our Drupal .htaccess file located in the root of our Drupal site. Now save this file and reload Apache
# sudo /etc/init.d/apache2 reload
after you copy your web files and import your database into MySQL you should be able to load your website and everything will work as it does on your live site.