Preparing Ubuntu Server for Drupal
In light of my recent experiences with moving Drupal onto a backup server, it seems like a good time to do a short write up of the things that are required to get Drupal up and running on Ubuntu Server - not the actually installation of Drupal on that server though (that will likely wait until I have a need to install from scratch again). Note that all commands require root access to run - generally just prefixing sudo
to each will be sufficient.
First ensure that you have a LAMP (Linux Apache Mysql PHP) server set up; the easiest way to do this is to run the command to install the system, tasksel install lamp-server
, which will install all the basic components of a web server.
Following that is a bit of Apache configuration. Start by running the command a2enmod rewrite
to turn on URL rewriting for Apache (crucial for Drupal). The next bit is optional - but required if you want to use clean URLS (a feature in Drupal that removes the random symbols that otherwise are in the URL of every node). Open the file /etc/apache2/sites-available/default
for editing, then in the section headed Directory /var/www
change the line that reads AllowOverride None
to read AllowOverride All
. Restart Apache, /etc/init.d/apache2 restart
, and you have finished the configuration of Apache.
At this point, you will be able to set up Drupal and its mysql database, but if you plan to use images in your site, you will need to do a little bit more.
First, you need to install the GD library for PHP, apt-get install php5-gd
. Following this, Apache will need to be restarted again for the module to function. The final step, necessary only if you want Drupal to be able to automatically resize images and make thumbnails, is the installation of ImageMagick, a set of command line programs for dealing with images (which also allows you to use the very useful convert
command). Installing this is as simple as any other package in the Ubuntu repositories, apt-get install imagemagick
.
Having done all this you should be able to install and configure Drupal on your server with relative ease.