How to install laravel on ubuntu lamp

Rakesh Sharma      22 Comments  

How to install laravel on ubuntu lamp (via laravel installer, composer)

Now time of frameworks in php like laravel, codeigniter etc and easy to install php frameworks on local server like lamp, xampp etc. Below we will see installation steps of a php framework laravel on ubuntu lamp. Let’s see How to install laravel on ubuntu lamp via laravel installer and via composer. for this we need some server requirements, some of software installation. Really a fast and handy installation of this new php framework. you will get this in few minutes. In this article (How to install laravel on ubuntu lamp) we are discussing all laravel installation different method need to give some hands and got installed.
We need some system requirements to install laravel framework :

PHP >= 5.4
Mcrypt PHP Extension
OpenSSL PHP Extension
Mbstring PHP Extension

Below are the steps of installing laravel on ubuntu lamp using composer and laravel installer :- first we need to install latest update and upgrade of unbuntu server. so for this run below command at your terminal

sudo apt-get update
sudo apt-get upgrade

After update we need to install php, apche, mysql (if not already installed)

Install php mysql and apache

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
sudo apt-get install php5-mysql

Now we need to install some of require extension (json, curl, mcrypt etc.) to run and download laravel framework. and then restart apache server to setup all extension.

#installing json extension
sudo apt-get install php5-json
#installing unzip extension
sudo apt-get install unzip
#installing curl extension
sudo apt-get install curl
#installing openssl extension
sudo apt-get install openssl
#installing mcrypt extension
sudo apt-get install php5-mcrypt
#enable mcrypt extension
sudo php5enmod mcrypt
#installing git
sudo apt-get install -y git-core
#enable mod rewrite extension
sudo a2enmod rewrite
#restarting apache
sudo service apache2 restart

After successfully configure all php setup and require extension we need to install composer to download laravel from remote server. for this first command will be for download composer using curl then second one move composer to local user directory for make composer globally use.

# installing composer
curl -sS | php
# move composer globally
sudo mv composer.phar /usr/local/bin/composer
# check composer working

How to install laravel on ubuntu lamp

Now we composer installed successfully on our ubuntu. and then there are two method to install laravel on ubuntu lamp.

1. Via Laravel Installer

2. Via composer

a. create project command.
b. manually download and install(via commands)

I am sharing steps below with terminal command run screenshots that how to install laravel on unbuntu lamp.

1. Via Laravel Installer :-

laravel installer is a new method to install added for laravel 5. it’s much faster method than installing via Composer.

# download installer
composer global require "laravel/installer=~1.1"
#setting up path
export PATH="~/.composer/vendor/bin:$PATH" 
# change dir where to install
cd /var/www/html/
# download and installing
laravel new laravelnew
# giving permission
chmod -R 777 laravelnew


2. Via Composer :-

A. create project command :-

after install composer you can directly install laravel by create-project command and give your destination path where you want to install laravel.

# checking composer is successfully installed
# downloading and install via composer
#composer create-project laravel/laravel --prefer-dist
sudo composer create-project laravel/laravel /var/www/html/laravel3
# setting up writable permission
sudo chmod -R 777 /var/www/html/laravel3


B. manually download and install(via commands) :-

this is a long method to install laravel in this method we need to download laravel files then extract then move then apply permission and then we need composer install command.

# change directory to /var/www/html/(where i want to create laravel project)
cd /var/www/html/ 
# downloading from github
# unzip downloaded zip
# giving a new name to extract directrory
mv /var/www/html/laravel-master /var/www/html/laravel2
# giving writable permission
sudo chmod -R 777 laravel2
# removing zip file
# getting project directory where i need to install project
cd laravel2
# installing using composer
composer install



Now you are done with how to install laravel on ubuntu lamp. and open url on http://localhost/yourlaravel and bam. Now you can enjoy today’s fast php framework. you can get more about this on official site of laravel and see how fast and how many features you are getting. you will really enjoy this php framework.


  • Johnny Bleu

    Hey!!!! I’m so really grateful. Your tutorial have been the only one that helped me to install Laravel.

    • Nestor Ramos Arteaga

      you are in the correct !!

      Great job RS

  • sanji

    Many thanks !!

  • Cute Sama

    Thank you <3

  • Kemal

    Thank you, you’re are awesome

  • Igor Matheus

    Many Thanks!!!

  • hibikix

    Hi, thanks for the tutorial after instal laravel in var/www/html/laravelnew, when open localhost/laravelnew only display the list of files, whats wrong????, thanks

  • Megha Khakhkhar

    Hello, thanks for the tutorial..
    I followd B. method, ie manually download and install. All the steps run fine. but last if I open localhost/laravel2, it only shows directory structure. What’s wrong with it? Please help.

  • Mark Dean Raymundo

    hi i got errors like this..what should i do?

    The following packages have unmet dependencies:
    php5-mcrypt : Depends: phpapi-20121212
    Depends: php5-common (= but 5.6.4+dfsg-4ubuntu6.2 is to be installed
    E: Unable to correct problems, you have held broken packages.

    • rakesh sharma

      Looks like you have missing require php config

  • maneesh patel

    Thanks for such nice tutorial. It helped me a lot. I have one doubt about folder permission.
    chmod 777
    Is it safe or it should be 751?

    • rakesh sharma

      No need to 777 you can change permission according you. Thanks

      • maneesh patel

        Thanks. BTW What will be safe permissions for web directory?

  • Nestor Ramos Arteaga

    hello, thanks for the tutorial
    I installed Laravel following the method A. Everything OK.
    You should check if it run in the path http://localhost/mylaravel/public

  • Timothy Mbogo

    Thanks alot…. am sorted.

  • Sharafedini

    Man you are distributing scareware like hotcakes

  • Jasper Lankhorst

    Thanks for the easy installation tutorial! this helped me install laravel on linux.

  • SoUrAv Dey

    If we install in user dir eg: then we are not able to view the public folder and instead we have to access via the server.php (

    Index of /~ex3web/laravel

    NameLast modifiedSizeDescription

    Parent Directory –
    app/2016-03-24 22:37 –
    artisan2016-03-24 22:37 1.6K
    bootstrap/2016-03-24 22:37 –
    composer.json2016-03-24 22:37 1.2K
    composer.lock2016-03-24 22:43 105K
    config/2016-03-24 22:55 –
    database/2016-03-24 22:37 –
    gulpfile.js2016-03-24 22:37 503
    package.json2016-03-24 22:37 159
    phpunit.xml2016-03-24 22:37 870
    readme.md2016-03-24 22:37 1.9K
    resources/2016-03-24 22:37 –
    server.php2016-03-24 22:37 567
    storage/2016-03-24 22:37 –
    tests/2016-03-24 22:37 –
    vendor/2016-03-24 22:43 –

    Apache/2.4.7 (Ubuntu) Server at Port 80

  • smaugtheswaggers

    Nice tutorial for Ubuntu LAMP, but if you are wondering how you can Install Laravel on Debian, then you can try out Cloudways platform. Using their platform you can install Laravel on Debian in just one click. There won’t be any need for manual installation and configuration of Debian and stack.

  • Neeraj Soni

    Thank for provide such information
    Installed successfully,
    It’s showing directory structure http://localhost/laravel3/