Many of the Drupal distributions I've seen are made for earlier versions of Ubuntu: drubuntu only works in 10.10; the Acquia .debs are for <10.x, and I've been told the versions in the repos are out-of-date. What's the easiest way to set up a local testing server for Drupal?
Drupal is a free and open-source content-management system, and it’s surprisingly flexible. You can use it for everything from a small blog to a major business or government site. It’s a mildly tricky setup, since you basically have to build a LAMP server from scratch, but here’s a step-by-step guide on how to do it.
First, install Ubuntu into your machine of choice. Once Ubuntu is installed and updated, you will need to install and configure four pieces of software to create a LAMP server to support Drupal: the Apache web server, the MySQL database server, PHP , and the MySQL module for PHP.
Begin with the Apache web server. To install Apache, open up a Terminal window (Applications, Accessories, Terminal), and type the following command (note that all Terminal commands are shown here in bold, and that all Terminal commands are case-sensitive):
Follow the prompts to install Apache. Once the installation is finished, you can test that Apache is working by opening up Firefox and navigating to
Next, you’ll need to install MySQL. Return to the Terminal and type this command:
During the installation you be will asked to provide a root password for MySQL. Be sure to pick a strong password (a combination of lowercase, punctuation, and uppercase letters), since the root user has full access to all tables on all databases. For obvious reasons, you’ll want to remember this password, not least because we need it again in the following steps. MySQL is a big package, and depending on your connection and computer speed, it might take a while to install.
Next, install PHP version 5:
Then install the MySQL module for PHP:
Install gd module for PHP:
Finally, download the Drupal software to your Downloads folder. You can obtain it from this address:
Now that we’ve got our software installed and downloaded, we’ll need to configure it.
First, you’ll probably need to add a line to your
(Note that it’s a good idea to back up any system configuration file before editing it. You can do so quickly by using sudo cp /etc/apache2/apache2.conf ~/Desktop to save a copy to your Desktop. You can of course use vi or emacs or the editor of your choice, but most new users seem to prefer gedit’s GUI.)
Once you are in gedit, add the following line to the end of the file:
Save the file and exit gedit. Restart Apache with this command, so it re-reads its configuration file:
Now we’ll need to prepare MySQL for use with Drupal. First, you’ll need to run MySQL’s install script:
And then this command, to properly secure MySQL. Follow the default prompts to remove the testing database in MySQL:
Once this is completed, log into the MySQL command-line client:
Enter your MySQL root user password from above, and you’ll find yourself at the MySQL> local client prompt. First, create a database for Drupal to use:
(Note that all commands entered in the MySQL local client must end with a semicolon to denote the end of the statement.)
Once the database is created, you’ll need to create a database user for Drupal to use. While still in the MySQL command line client, type this:
Then create a password for your new user (note that your password will actually go within the quotation marks, and is case-sensitive):
Now that you’ve got your Drupal database and your Drupal database user, you’ll need to grant the user all permissions on the database (again, the password goes within the quotation marks, and is case sensitive):
(Make sure to append “@localhost” to drupaluser; otherwise you’ll get a database error when you try to start Drupal for the first time.)
Go ahead and exit MySQL:
Next, make a directory for Drupal with this command:
Next, you’ll need to unpack the Drupal files and move them to the /var/www/drupal directory. Once the files have been unpacked and copied, you’ll need to make a few changes. First, you’ll have to create a settings.php file for Drupal to use during the installation:
Next, make the file writable:
Then create a files directory for Drupal to use:
Mark the files directory as writable:
Now you’re ready to install Drupal. Open up a web browser on your Ubuntu system and navigate to
Restart apache to register the changes:
Go back to the web browser and navigate to
On the next page, you’ll be asked for the database name, username, and password you created earlier. Enter those names and continue. On the next page, you’ll be asked to set an admin username and password and a few other settings.
After that, your basical Drupal installation is finished, and you can choose how to further customize the site. One last thing you should do; use this command to change the settings.php file so it is no longer writable:
There is a far more easier way. Use Drubuntu from Drubuntu.info. This sets up Drupal for you right from the start and you could create your Ubuntu Environemnt arround it. Install your favorite desktop and so on