Verified and Tested 02/27/15
In this How-To, we will walk you through the install and configuration of Drupal with Apache. Drupal is a free content management system that will facilitate the way your content is organized and managed. It has a user-friendly interface that makes customizing your content easy and simple with little effort.
A cloud server with Ubuntu 14.04 and Apache already installed.
You will also need to have a Server with LAMP(Linux, Apache, MySQL, PHP) configured. See our “How To Install LAMP on Ubuntu 14.04“.
Installing Drupal on Ubuntu Server with Apache
Log into your MySQL:
mysql -u root -p
Create the database for your Drupal installation. (I will use “mydrupal” as the database name)
CREATE DATABASE mydrupal;
Create your Drupal user and password for the database. (I will use mydrupaluser as my user and strong password as a password)
CREATE USER [email protected] IDENTIFIED BY 'strongpassword';
Grant the following permissions to the Drupal user
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES ON drupal.* TO [email protected];
Refresh the privileges information:
Update your local package and install them by typing:
sudo apt-get update
sudo apt-get install php5-gd php5-curl libssh2-php
Type the following command to Open the Apache PHP configuration file to make some changes.
sudo nano /etc/php5/apache2/php.ini
Change the expose_php line and the allow_ur l_fopen line to “Off”:
Save and close the file when you are finished.
Enable the rewrite functionality so URLS are edited by Drupal when needed:
sudo a2enmod rewrite
Update your VirtualHost configuration to use an .htaccess file:
sudo nano /etc/apache2/sites-enabled/000-default.conf
In the “VirtualHost” block, add a directory block that points to your web root/ Set the AllowOverride to “All”/ Add a ServerName and have it point to your domain name/ update the ServerAdmin to a valid email address as follows:
. . .
ServerAdmin [email protected]
. . .
when you’re done, Save and close the file.
sudo service apache2 restart
Download and Install the Drupal by going to https://www.drupal.org/project/drupal. Right click on the tar.gz link of the latest recommended version or the one that you prefer and “copy link address”
Extract the application:
tar xzvf drupal*
Use the rsync utility to safely copy all of the files into the web root directory of your server:
sudo rsync -avz . /var/www/mydrupal
Note if you get an error message “sudo: rsync: command not found” simply install rsync with the following command then run the above:
apt-get install rsync
Change directory into the web root to customize our installation:
To simplify our installation make a new directory under the sub-tree sites/default called files:
Grant permissions to this file:
chmod 664 /var/www/mydrupal/sites/default/files
Copy the default settings file to the filename that Drupal uses for its active configuration:
cp /var/www/mydrupal/sites/default/default.settings.php /var/www/mydrupal/sites/default/settings.php
Allow write permissions to the PHP group owner:
chmod 664 /var/www/mydrupal/sites/default/settings.php
Grant the entire Drupal installation the following ownership properties:
sudo chown -R :www-data /var/www/mydrupal/*
Your server is now configured correctly to run the web-based installation:
You will see the Drupal installation procedure’s initial page. You will then finish the install by inputting the requested information.
Congratulations! You have just installed and configured Drupal with Apache on your Ubuntu 14.4 Virtual Private Server. Thank you for following along in this How-To and check back with us for any new updates.