
When developing a drupal website, you'll often need to install a fresh version of Linux (in our example we'll use Ubuntu) on a local machine, or on a staging server, for development purposes.
Installing a LAMP stack can be a bit daunting at first, particularly when setting up the individual components of the server stack, and it can be time consuming. If you are inclined to want to get straight to the development stage, and get your Drupal website up and running, then you can use a great feature of Linux/Ubuntu called Tasksel.
Tasksel is a package manager for Debian distributions of Linux, including Ubuntu. As the name suggests, it is a list of tasks comprising one or more steps, which you can select for installation.
If you need to install Tasksel, you can do so by typing the following command in a terminal:
sudo apt-get install tasksel
... or by using the synaptic/software package manager on your system.
Once installed, simply type Tasksel in the terminal window and you will see the following menu:

From the Tasksel menu screen, use the arrow keys to navigate and press the spacebar to select the LAMP Server, tab to OK and hit enter. You will be guided through the installation of Apache, Mysql and PHP and will be prompted to set a root password for Mysql, which you should probably do for security reasons.
The installation will take a minute or two and that's it as far as installing the LAMP stack components are concerned. You can use Tasksel on a remote server as well as a local machine and there are a list of other packages including a mail server, print server etc. available to choose from.
If you don't fancy using the GUI screen within the terminal, you can install the packages using the command line as follows:
tasksel install lamp-server
You can see what the Tasksel package comprises, use the following command:
tasksel --task-packages lamp-server
This will normally produce a list of LAMP stack components and their dependencies similar to the following table:
libmysqlclient18 libwrap0 apache2 php5-cli libaprutil1-dbd-sqlite3 tcpd libapache2-mod-php5 apache2.2-common apache2-utils !>libswitch-perl php5-common libclass-isa-perl libaprutil1-ldap libaprutil1 php5-mysql libdbi-perl libplrpc-perl mysql-server apache2.2-bin mysql-client-5.5 mysql-server-5.5 libdbd-mysql-perl libcap2 libhtml-template-perl perl-modules libnet-daemon-perl libapr1 perl mysql-server-core-5.5 mysql-client-core-5.5 ssl-cert apache2-mpm-prefork mysql-common
It's clear from the above that by using Tasksel you are circumventing the need to check through the list of components in a LAMP server, many of which are now standard.
To see a list of the available "Tasks" within Tasksel, use the following command:
tasksel --list-task
While Tasksel won't provide very specific configuration options for various LAMP server setups, it does provide a very quick and simple setup of development servers, or servers running standard websites. Advanced setups using Memcache, APC or Varnish will need a bit of extra work. In addition, setting up a mailserver and web application firewall will also require specific attention, as would a Drupal multi-site environment. Nevertheless, its a great way to get started and it saves time.
Drupal can be downloaded from the repositories in Linux ditrubitions such as Ubuntu, however in order to get the latest release including bug fixes you should get it directly from Drupal Association
From the command line, use the following command, inserting the URL for the latest version of Drupal 7:
wget http://ftp.drupal.org/files/projects/drupal-7.15.tar.gzOr, if you are using CURL:
curl -O http://ftp.drupal.org/files/projects/drupal-7.15.tar.gzNext, unpack the archive using the TAR command, as follows:
tar -zxvf drupal-7.15.tar.gzFor simplicity, rename the folder to something relevant and all one word:
sudo mv drupal-7.15 mydevsiteAt this stage you should move the extracted folder to your server directory, normally located under /var/www/mydevsite. You can then set up a seperate server alias for this Drupal installation under /etc/apache2/sites-available or you can use it as a subfolder of the default localhost http://localhost/mydevsite setup by the Tasksel LAMP Server installation.
There are couple of ways to create your MYSQL database, whether through the PHPMyadmin interface (if you have installed this) or through the command line. Open a terminal and log into the MYSQL CLI as follows:
mysql -u root -p
When prompted, type your root user password (this is the one you input when installing MYSQL via Tasksel). You should see the MYSQL command line prompt. It's prudent security practice to create a new database user for the Drupal database, other than root. To do this type the following command:
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'password';
Then create the drupal database and grant the new user permissions to use it:
create database mydevsite_db;
... and then separately:
GRANT ALL ON mydevsite_db.* TO 'drupaluser'@'localhost' identified by 'password';
That's all you need to do in relation to setting up the database. Drupal will handle the rest of the database setup via the install script on first launch. To do this, simply navigate to your new installation at http://localhost/mydevsite and follow the instructions. The Drupal installer will need to have temporary write privileges to the settings.php file and you can learn how to do this in this blog post about how to change drupal file and folder permissions.
The use of Tasksel should speed up the process considerably, allowing you to concentrate on creating a stunning Drupal design.
Post new comment