How to install Drupal 7 on Ubuntu 14.04

drupal vpsDrupal is very popular and easy to use open-source CMS (content management system ) written in PHP and distributed under the GNU General Public License.
To install Drupal 7 on an Ubuntu VPS follow the very easy steps described below.

This install guide assumes that Apache, MySQL and PHP are already installed and configured on your Ubuntu based virtual server.
At the time of writing this tutorial, Drupal 7.28 is the latest stable version available and it requires:

  • PHP >= 5.2.4 with the following PHP extensions enabled: XML (Expat), GD Graphics Library version 2.0.x+ and mbstring;
  • Apache Web Server >= 2.0 compiled with mod_rewrite module;
  • MySQL >= 5.0.15 installed on your Linux virtual server (MySQL 5.5 or later is recommended). Also, Drupal 7 supports MariaDB, Percona Server, PostgreSQL, SQLite for its main database out of the box.

Make sure your virtual server is up-to-date:

sudo apt-get update
sudo apt-get upgrade

Install Drush:

apt-get install drush php-console-table

Ubuntu 14.04 comes with Drush version 5.10.0. If you like to install and use the latest release of Drush, it can be installed via the custom PEAR channel using the following commands:

pear channel-discover
pear install drush/drush

Check if the update has been successful by executing:

drush version
 Drush Version   :  6.2.0

Download the latest stable version of Drupal to the ‘/var/www/html/’ directory on your server:

cd /var/www/html/ 
drush dl drupal
mv /var/www/html/drupal-7.28 /var/www/html/drupal

Create a new MySQL database for Drupal on your server:

mysql -u root -p
mysql> CREATE DATABASE drupaldb;
mysql> GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost' IDENTIFIED BY 'your-password' WITH GRANT OPTION;
mysql> quit

Create a new virtual host directive in Apache. For example, create a new Apache configuration file ‘drupal.conf’:

vi /etc/apache2/sites-available/drupal.conf
ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf

then, add the following lines:

<VirtualHost *:80>
   DocumentRoot /var/www/html/drupal/
      <Directory /var/www/html/drupal/>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
 Order allow,deny
         allow from all
   ErrorLog /var/log/apache2/
   CustomLog /var/log/apache2/ common

Restart the Apache web server for the changes to take effect:

service apache2 restart

Make the document root and the Drupal files and directories in it writable by the Apache service which is running as user ‘www-data’ and group ‘www-data’ by executing the following command:

chown www-data:www-data -R /var/www/html/drupal/

Open your favorite web browser, navigate to and follow the easy instructions. That is it. The Drupal 7 installation is now complete.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Drupal 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.


3 thoughts on “How to install Drupal 7 on Ubuntu 14.04”

  1. Thanks – I found this very helpful indeed. A few things to consider adding to make the guide more comprehensive…

    Installation also necessitates using ‘chmod’ to make the necessary directories and files writeable, and then copying ‘your-domain/sites/default/default.settings.php’ to ‘your-domain/sites/default/settings.php’ as set out in Step 3 of the Drupal Installation Guide ( before pointing your browser at ‘your-domain/install.php’ to complete the installation.

  2. [root@s1 ~]# pear channel-discover
    Discovering channel over http:// failed with message: channel-add: Cannot open “” (Connection to `′ failed: php_network_getaddresses: getaddrinfo failed: Name or service not known)
    Trying to discover channel over https:// instead
    Discovery of channel “” failed (channel-add: Cannot open “” (Connection to `′ failed: php_network_getaddresses: getaddrinfo failed: Name or service not known))

    This pear drush installation is not working on Ubuntu 14.04 for quite some times now.


Leave a Comment

To prove you are human please solve the following *