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

Creating a Drupal site

Hey Folks

Get your own Drupal site within few minutes and few clicks 🙂

First install xampp

Go to this link and download xampp according to your operating system -> http://www.apachefriends.org/en/xampp-linux.html\

Then follow these codes –

cd /home/[Username]/Downloads
ls

Now to make installable file execute

chmod +x xampp-linux-1.8.2-0-installer.run

Your file is ready to execute, now to run this file

sudo -s -H
./xampp-linux-1.8.2-0-installer.run

Now you will get a dialogue box to install it, do install

and then type the following command to get started with xampp

sudo /opt/lampp/lampp restart

Here you installed xampp server

Now go to your browser and type the following on address bar

http://localhost/

and you will be redirected to xampp server. Scroll down and check for Drupal in the following list. Click on Drupal to Download.

Now do the following commands

cd 
cd Downloads/
ls
chmod +x <name of the drupal file you downloaded>
./ <name of the drupal file you downloaded>

This will show you another dialogue box to install Drupal. install it and get into your own Drupal site 🙂

 

Hope this worked for you