Laravel is an open source PHP framework, designed for the faster development of MVC web applications in PHP.it utilizes Composer to manage its dependencies,before the installation of laravel we need to install its dependencies.there are three simple steps to install the laravel.
1. Composer Installation
2. Install Laravel
3. Database Configuration
Step 1 :
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Composer requires PHP 5.3.2+ to run.
Composer offers a convenient installer that you can execute directly from the command line.There are in short, two ways to install Composer. Locally as part of your project, or globally as a system wide executable.
Installing Composer locally is a matter of just running the installer in your project directory:
curl -sS https://getcomposer.org/installer | php
Note: If the above fails for some reason, you can download the installer with php instead:
php -r “readfile(‘https://getcomposer.org/installer’);” | php
If php is not installed, you can run the below command to install the php in your system
sudo apt-get install php5-cli
Now just run php composer.phar in order to run Composer.
You can install Composer to a specific directory by using the –install-dir option and additionally (re)name it as well using the –filename option:
curl -sS https://getcomposer.org/installer | php — –install-dir=bin –filename=composer
You can place the Composer PHAR anywhere you wish. If you put it in a directory that is part of your PATH, you can access it globally.
Run these commands to globally install composer on your system:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
Note: If the above fails due to permissions, run the mv line again with sudo.
A quick copy-paste version including sudo:
curl -sS https://getcomposer.org/installer | sudo -H php — –install-dir=/usr/local/bin –filename=composer
Now just run composer in order to run Composer instead of php composer.phar
Step 2 :
Install Laravel :
To download latest version of Laravel, Use below command to clone of laravel from github.
First step : Go to the directory you want to install using the cd (eg: cd /Laravel-path) command,then run the below command
git clone https://github.com/laravel/laravel.git
Then go to Laravel code directory and use composer to install all dependencies required for Laravel framework.
sudo composer install
Note: if you installed in Locally,the above command is not working,you need to move the composer to Globally. Go to the relevant folder where you have installed the composer then move the composer by running below command
sudo mv composer.phar /usr/local/bin/composer
Its take some time to install, after the installation set proper permissions on files.
1.Get the .env hidden file from the larvel folder using the key cntl + H ( control + H ), then open the file you can see the below coding.
2.Then set your proper host,databse name, username and password. finally you have successfully intalled the laravel in your system