In this tutorial , we will discuss how to install or build in Laravel 5 on Ubuntu from scratch. Before starting, let’s have short intro about Laravel : –
Laravel 5
Laravel is a framework build in PHP with easy to learn syntax. It is derive from the combination of multiple frameworks. But Laravel 5 is build from scratch. Still there is some dependency on other frameworks. It is open source and very secure framework build in PHP.
It has make web application development very easy and fast. Just few steps of installation and you are ready to develop.
Install Laravel 5 on Ubuntu OS
There are two ways to do installation on Ubuntu OS.
- Using Ubuntu Package Manager.
- Manual download package.
Manual download include package import then install it on server. This is not a secure method then installing using package manager
Using Ubuntu Package Manager
Open your terminal as shown below and then follow below steps

As Laravel is a PHP framework then it require server to execute PHP. We need to install Apache or any other server then we can run laravel.
If you already have server install then you can scroll down to next steps.
For Installing Apache copy command and then hit enter.
sudo apt-get install apache2

Once you are done, you need to restart your system.
Also you need PHP to run Laravel.
For Installing PHP
sudo apt-get install php7.2

For installing Laravel, you need 3 more packages that are mention below
- Composer
- PHP Dom
- PHP Ext-zip
- mbstring
Copy the given commands and then run it one by one.
Composer
sudo apt-get install composer
PHP Dom
sudo apt-get install php7.2-dom
PHP ext-zip
sudo apt-get install php7.2-zip
mbstring
sudo apt-get install php7.2-mbstring
Final Steps
After all installation mention above, follow below steps to install laravel.
Now you need Laravel Installer to install your first application then you are done with all steps.
Simply type below command on terminal and then hit Enter
compose global require laravel/installer
Wait for the process to complete then browse to directory in which you want your application.
For me, it is /var/www/html/mylaravel
cd /var/www/html/mylaravelApp
Now copy/paste below command and then hit Enter
alias laravel='~/.config/composer/vendor/laravel/installer/laravel'
This command is not mandatory to run because composer do it automatically. If you face any error after running below command only then run it.
laravel
Copy above command and then hit enter to test laravel is working or not.

Now you ready to create your first application in laravel 5 and then host it.
Copy below command and then hit enter.
laravel new mylaravelApp

You don’t need to create folder mylaravelApp. Installer will automatically create it. It will take less then 2 min to install all packages and dependency.
Once Installation is complete then you will see as shown beloow

Run Application
Go to your application folder in terminal
cd /var/www/html/mylaravelApp
Copy below command and hit enter then open browser
php artisan serve

In browser open link http://127.0.0.1:8000 then you will see page as shown below

Now you can start developing your application as per your requirement. For any type of query, contact me.