Installing Drupal in Ubuntu

Introduction :

           download.png

Drupal is a digital experience management system. it is one of the biggest free and open-source content management systems (CMS) that is used to make many websites. It follows flexibility and modularity. It is built on principles like collaboration, globalism, and innovation. The best part, Drupal is always free.

Prerequisites:-

As this Blog is for beginners please check if the following are installed or not. If installed already please ignore the procedure.

  • LAMP
  • Git
  • Composer

LAMP:-

Full form of the LAMP is Linux, Apache, MySQL, and PHP. The LAMP is the substantial flexibility for different database, web server, and scripting languages. It is often used for web development and internal testing.

Installation:-

We are using Ubuntu 16.04 LTS. Please do “sudo” before giving the commands if there is an error mentioning “permission denied” or “root access required”. we are going to use “apt” the package manager of Ubuntu which installs various applications from ubuntu repositories.

Apache2:

Let’s get started by typing these commands in terminal.

$ sudo apt-get update
$ sudo apt-get install apache2

Since we are using “sudo”, the operation might ask you your regular password. Once the password is given the ‘apt’ will start installing the packages. we will be adding a single line to the/etc/apache2/apache2.conf file to avoid a warning message.

Open up the main configuration file with your text editor or nano :

$ sudo nano /etc/apache2/apache2.conf

now we need to add a line at the bottom of this file.

/etc/apache2/apache2.conf
. . . 
ServerName <server_domain or server_ip>

If you know your server_domain then its great. but if you don’t know you can even give your local server_ip.

To get your local server_ip you can use curl:

$ sudo apt-get install curl
$ curl http://icanhazip.com

By the above commands, you can get your server_ip.

MySQL:

MySQL can be installed by typing one command in the terminal.

$ sudo apt-get install mysql-server mysql-client

You can test the MySQL by typing the following code in terminal:

$ mysql -uroot -p<password_you_created>

PHP:

The following command installs 3 packages of PHP:

$ sudo apt-get install php5 libapache2-mod-php5 php5-mysql

Now, as we made some changes, we need to restart the Apache

$ sudo service apache2 restart

To test the working of PHP, create a text file as ‘file.php’

&lt;?php
phpinfo();
?&gt;

Go to your browser and navigate to your file

http://localhost/file.php

This shows the PHP version of the system.

At this point, you should have successfully installed LAMP on your machine.

Installing Git:

git is a version control system(VCS). you can install it using ‘apt’

$ sudo apt update
$ sudo apt install git

now, you can use git on your machine.

Installing Composer:

now, we install composer locally and then move it to/usr/local/bin/composer for making it global.

$ php composer-setup.php --install-dir=bin --filename=composer
$ mv composer.phar /usr/local/bin/composer

Now, even the composer is ready.

Creating a Database:

You can create a database using the following SQL commands in the terminal.

creat database <name>;
grant all privileges on <name>.* to '<username>'@'localhost' identified by '<password>';
flush privileges;

For the final part to do is the installation of Drupal.

Installing Drupal:

you need to install Drupal incd /var/www  and then move it to html in www.

follow the commands to install Drupal

$ cd /var/www
$ wget https://ftp.drupal.org/files/projects/drupal-8.3.7.tar.gz 
$ tar xvzf drupal-8.3.7.tar.gz 
$ cd drupal-8.3.7
$ mv ./* /var/www/html

Now, we need to set Apache as the owner of Drupal

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

That’s it now you are all set with the Drupal.

Now, go to your browser and  search for

localhost/drupal-8.3.7

you should see the following page.

dpinstallation.png

If you see this page congrats you are all set done.

Happy Hacking!!!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s