What is Laravel

Laravel is an open-source PHP framework, which uses the Modal View Controller architecture. The benefit of using framework over a plain PHP is that it removes the effort in writing code for common tasks. In the case of the Laravel framework, it eases the process of routing, authentication, sessions, cookies, caching, etc. Using Laravel removes the headache for common tasks. It also supports APIs. So if you are going to make APIs (web services) then installing the Laravel framework is a good option for you.

installation of Laravel requires the composer to be installed on your server

So let’s start to install Laravel on the Linux server step by step.

Install Laravel on Linux server step-by-step guide
Install Laravel on Linux server step-by-step guide

Step 1: Install composer

For installation of the composer, you need to download the composer. Go to the https://getcomposer.org/download/

Here you can find relevant information on how to install Composer on Linux. Visit the following link:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos

Step 2: Install Laravel by Laravel installer

Once your composer is ready to use, type the following command to get the Laravel installer:
$ composer global require laravel/installer

It will start installing a Laravel installer for creating Laravel projects. Once this process is finished successfully you can create a new Laravel project by command:
$ laravel new your-project-name

This will create a new project in the current directory.

Step 3: Directory permissions

Now you need to give access/permission to some directories for Laravel to work properly.
Directories within the “storage” and “bootstrap/cache” directories should be read and writable by the web server. For this, you need to give permission 755 to these directories.

You can do so by the command:

(First, you need to be in the project directory for executing these commands)

$ chmod 755 -R storage
$ chmod 755 – R bootstrap/cache

Step 4: Set your Application Key

The next thing you should do after installing Laravel is set your application key to a random string.

To generate a new Laravel application key use:
$ php artisan key:generate

Now you are ready to start coding in Laravel.

Your feedback is highly appreciated!