How to install laravel on ubuntu 18.04

How to install laravel on ubuntu 18.04

This article is about installing the awesome laravel framework in ubuntu 18.04

Difficulty level

Difficulty for this job is - Easy / Intermediate.


What is Laravel

Laravel is an amazing framework for developing safe and secure websites. Laravel is a framework for php language. It uses composer.

Let us first install the required dependencies for laravel.

Install apache server if not installed already

Open terminal and type

 sudo apt-get install apache2

Install php if not installed already

Open terminal and type

 sudo apt-get install php

Install composer

Open terminal and type

 $sudo apt install composer  

Now let's Install laravel by creating a new project with composer

Step 1

Navigate to the directory where you want to create the new laravel project, I will use /var/www/html in this example

 cd /var/www/html

Step 2

Type below command to create a laravel project

 composer create-project --prefer-dist laravel/laravel YOUR_PROJECT_NAME

Note - replace YOUR_PROJECT_NAME to your projects name e.g. blog, shoppingcart etc.

Step 3

Now cd to YOUR_PROJECT_NAME directory. I will use project name as my_laravel_project

 cd my_laravel_project

Step 4

Now run this command

 php artisan serve

If everything goes as expected, you will see something like this in the output

Output
$ php artisan serve
Laravel development server started: <http://127.0.0.1:8000>
                    

Thats it, Congratulations!!! You have now successfully Installed and configured laravel in your ubuntu 18.04