Installing drupal on a local machine

Running drupal on your local machine will be easy to learn how to use drupal. Moreover, there is no expense to install it like we do in web hosting.

Pre-requisites

Git should be installed and configured on your machine. If not done, then follow these commands –

$ sudo apt-get install git #installing git
$ git config --global user.name "<username>"        
$ git config --global user.email <email>

Also, you need to install composer before going to the next step. For that follow this one line code –

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Some more things to install

sudo apt-get install php5-gd php5-curl libssh2-php

Now you need to install and setup lamp server on your local machine. For that follow my previous post -> Installing LAMP server on ubuntu

Also you need to do some configurations with your apache files and mysql.

First thing is to create a database

mysql -u root -p

CREATE DATABASE drupal;

CREATE USER drupaluser@localhost IDENTIFIED BY 'password';

GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES ON drupal.* TO drupaluser@localhost;

FLUSH PRIVILEGES;

exit

Now configure apache file –

sudo nano /etc/php5/apache2/php.ini

Check the below conditions are given correctly –

. . .
expose_php = Off
. . .
allow_url_fopen = Off
. . .
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-enabled/000-default.conf

Check whether the below codes match with the file you opened now

<VirtualHost *:80>
    . . .
    ServerName  example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /var/www/html

    <Directory /var/www/html>
        AllowOverride All
    </Directory>
    . . .
</VirtualHost>

Now restart your web server to execute the changes you have done in php and apache

$ sudo service apache2 restart

Now, if you have done till now without any issue then clone the desired version drupal repository to /var/www/html. Follow the given syntax –

git clone --branch 8.x http://git.drupal.org/project/drupal.git

Now, extract the file. Get into the drupal extracted folder ands do composer install.

$ composer install --no-dev

And search for the given address in your browser

http://localhost/"<name of the directory you cloned>"

Hope you gotcha. Just install with your valid database name, username & password.

drupal1

Advertisements

2 Comments

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s