Drupal is an open source software maintained and developed by a community of 721,200+ users and developers across the globe. Its written in PHP and a backend database, such as MySQL. Thousands of add-on modules and designs let you build any site you can imagine. As It is Free And Open Source, Drupal is flexible, robust and constantly being improved by hundreds of thousands of passionate people from all over the world.
In this tutorial we will provide you basic step on how to setup Drupal in Ubuntu Server 14.04 LTS (Trusty). Here are the steps you need to follow to get your Drupal installed in your Ubuntu Server.
Step 1: Setup LAMP Stack
Before installing Drupal 7.x you need to have a LAMP (Linux, Apache2, MySQL5, and PHP5) stack installed on your Ubuntu Server 14.04. If you don’t have these components already installed and configured, you can use this tutorial to learn how to setup LAMP stack.
You can simply install the bundle now using the command below:
$ sudo apt-get install apache2 apache2-utils PHP5 $ sudo apt-get install php5 php5-mysql php-pear php5-gd php5-mcrypt php5-curl MYSQL Server $ sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
Step 2: Create Database and User for Drupal
Log in to mysql server as root user by typing the following command
mysql -u root -p
Once Successful login to the Mysql Server, we'll use these command to create database for drupal. In this case I will give the name of the drupal database as drupaldb, You can call this whatever you would like.
CREATE DATABASE drupaldb;
Next, we are going to create a separate MySQL user account and give this user a password. On this case we will call the new account “linoxideuser” and password for new account “drupaLinoxide1“, you should definitely change the password for your installation and can name the user whatever you’d like but make sure you don't forget the database name,username and password. You can do this by typing the following command:
CREATE USER linoxideuser@localhost IDENTIFIED BY 'drupaLinoxide1';
Next, grant all privileges on the database you just created to the new user by running the commands below
GRANT ALL PRIVILEGES ON drupaldb.* TO linoxideuser@localhost;
We need to flush the privileges so that the current instance of MySQL knows about the recent privilege changes we’ve made:
And finally we exit the MySQL terminal by entering:
Step 3: Download Drupal 7.x
Enter to directory Web root of Apache ie /var/www/html by default:
Download drupal 7.x from the drupal project’s website with the following command, I'm gonna download our latest version 7.34:
Extract the files “drupal-7.34.tar.gz” to rebuild the drupal directory with these command:
sudo tar -zxvf drupal-7.34.tar.gz
This will create a directory called drupal-7.34 in directory /var/www/html
Copy all file on drupal-7.34 directory in to Apache‘s document root , we recommend to use rsync command for preserves permissions and data integrity:
sudo rsync -avP drupal-7.34/ /var/www/html
Or, you can doing it without mentioning Apache’s document root:
sudo rsync -avP drupal-7.34/ .
Once copying all file on drupal directory is complete. Remove directory drupal-7.34 and file latest.tar.gz by typing the following command:
sudo rm -rf drupal-7.34/ drupal-7.34.tar.gz
Give permissions to user and group (www-data) over everything under directory /var/www/html
sudo chown -R www-data:www-data /var/www/html
Step 4: Install Drupal 7.x from the Web Browser
Complete the drupal 7.x installation through the web browser, in your web browser if you installed in your local server, you can browse using http://127.0.0.1/ or navigate to your server’s domain name or public IP address [http://ip_public] or [http://domain]
In this case I would choose profile : standard option.
Choose language : Default english
Select database type : default mysql, enter the database name, database username, and database password
Drupal installation is complete, click “visit your new site” to show homepage of drupal site
Hurray, we have successfully setup Drupal in our Ubuntu 14.04 LTS (Trusty) but yes, it should work fine in all the versions of Ubuntu.