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:
- 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.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> FLUSH PRIVILEGES; 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 </Directory> ErrorLog /var/log/apache2/your-domain.com-error_log CustomLog /var/log/apache2/your-domain.com-access_log common </VirtualHost>
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.