/ OPENSOURCE, DRUPAL

Installing Drupal In Linux

Drupal Logo
Hello! This is my first technical blog. This blog would make you understand how to setup LAMP and build Drupal locally.

Contributing to Drupal:

To contribute to Drupal we need to first build it on our localhost. So now let us discuss how to build Drupal on our localhost.

STEP 0

Get into www.drupal.org and sign up for Drupal and then create an account in Drupal Ladder and complete the ladder simultaneously.

STEP 1

Installing Git. Install git using the given commands. For Linux users:
$ sudo apt-get update
$ sudo apt-get install git

STEP 2

Installing Composers Dependencies.

The composer is a dependency manager for PHP. The composer will manage the dependencies you require on a project by project basis. This means that Composer will pull in all the required libraries, dependencies and manage them all in one place.
$ sudo apt-get update
$ sudo apt-get install curl php-cli php-mbstring git unzip

Installing and configuring Composer

$ cd ~
$ curl -sS https://getcomposer.org/installer -o composer-setup.php
To install composer globally, use the following command :
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
The output should be something like this:
Output
All settings correct for using Composer
Downloading 1.1.1...

Composer successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer
To test whether the composer is working or not please enter :
$ composer
Then you should be getting something like this: Output
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.1.1 2016-05-17 12:25:44

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
. . .

STEP 3

Installing Drush

$ composer global require drush/drush:8.*
Navigate to the Drupal directory using the cd command and then type:
$ drush core-status
This should return the version of the Drush. Here comes the main part of our build.

STEP 4

Installing LAMP/WAMP

This is the major step of our build which involves installing lamp and configuring it.
LAMP is an open source Web development platform that uses
Linux as the operating system,
Apache as the Web server,
MySQL as the relational database management system and
PHP as the object-oriented scripting language.
download

Installing Apache

We can get started by typing these commands:
$ sudo apt-get update
$ sudo apt-get install apache2
Press Y and hit Enter to continue, and the installation will proceed. To check for errors please type:
$ apache2ctl configtest
You should be getting something like this if everything is working fine:
Output
Syntax OK
Restart Apache to implement your changes:
$ systemctl restart apache2
To check everything is working fine in your browser :
http://your_server_IP_address
You should get the Ubuntu start page which looks like this: Z5u2B.png If you see this page, then your web server is now correctly installed and accessible through your firewall.

Installing MySQL

Now we have to install MySQL-Structured Query Language by entering the command :
$ apt-get install mysql-server
To get our MySQL environment set up securely we need to tell MySQL to create its database directory structure where it will store its information. You can do this by typing:
$sudo mysql_install_db
Run a simple security script that will remove some dangerous defaults and lock down access to our database system. For that type:
$ sudo mysql_secure_installation
At this point, your database system is now set up and we can move on.

Installing PHP

This should install PHP without any problems.
$ sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Apache will first look for a file called index.html. We want to tell our web server to prefer PHP files, so we'll make Apache look for an index.php file first. To save all the changes we have done restart apache2:
$ sudo service apache2 restart
This is how you Install LAMP. If you face any errors then try the single line command to install Lamp along with phpmyadmin:
$ sudo apt-get  install lamp-server^ phpmyadmin
This will automatically configure lamp on your desktop.

STEP 5

Configuring phpmyadmin

After installing phpmyadmin with the command
$ sudo apt-get update
$ sudo apt-get install phpmyadmin
Which will open the below screen.... phpmyadmin-lamp Then select yes to continue configuring phpmyadmin phpmyadmin-apache-config Then set up a password for your root user phpmyadmin-ubuntu-16.04 Once this step is done, you will find that a new database named phpmyadmin is created. To save your changes reload apache2.
$ sudo systemctl reload apache2
To check phpmyadmin is working please open the given address in your browser.
phpmyadmin-ubuntu
Now log on to it using the root username with the same password you gave for MySQL.

STEP 6

Clone Drupal8

After logging in we have to clone the Drupal repository.
$ cd /var/www/html
$ git clone --branch 8.5.x http://git.drupal.org/project/drupal.git drupal8

STEP 7

Now as you have cloned the website into your localhost. Now create a database named Drupal in phpmyadmin. mdb-create-new-db Now open in your browser :
localhost/name_of_site
which should give you this page: Drupal-installation-requirements-review

STEP 8

The main requirements will be Screen_3 Solve the above error by copying the information from /sites/default/default.settings.php to /sites/default/settings.php You have to give read and write permissions to the files directory in sites/default folder. Now create a file named โ€˜filesโ€™. Then using the below command, give read and write permissions. For this, use:
 $ cd sites/default
 $ mkdir files
 $ chmod 777 files
These are the basic requirements and then click on continue anyway and then you get the next page as: drupal-8-install-process.png Complete the process as shown above and then do the next step to see your Drupal website on your localhost.

STEP 9

Now you have your website on your localhost. To check it please type:
localhost/site_name
installed_site.png Congratulations !!! You have successfully installed and built Drupal on your localhost. Please give your suggestions and comments below and post your doubts too.