How to install Drupal 7 on Ubuntu 14.04

Drupal 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:

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.drush.org
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>
   ServerAdmin admin@your-domain.com
   DocumentRoot /var/www/html/drupal/
   ServerName your-domain.com
   ServerAlias www.your-domain.com
      <Directory /var/www/html/drupal/>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
	 Order allow,deny
         allow from all
   ErrorLog /var/log/apache2/your-domain.com-error_log
   CustomLog /var/log/apache2/your-domain.com-access_log 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 http://your-domain.com 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.


Categories: Tutorials

View Comments

Leave a Comment