Install Laravel on Ubuntu


Laravel is a free, open source PHP web application framework, designed for the development of MVC web applications.


1. Latest version of PHP,MySQL and Apache Web Server must be installed on your system.

2. You need to ensure that you have mod_rewrite enabled on your web server.

$ sudo a2enmod rewrite

3. Install the PHP JSON extension.

$ sudo apt-get install php5-json.


1. Download the latest version of laravel framework and extract its contents into a directory on your server. Don’t forget to give permissions to it.
2. Laravel utilizes Composer to manage its dependencies,we need to install Composer (again, this means downloading it into your project)

$ curl -sS | php

Note: If the above fails for some reason, you can download the installer with php instead.

$ php -r "readfile('');" | php

4. Next, run below given command to install all of the framework’s dependencies and the framework dependencies as mentioned in composer.json file.

$ php composer.phar install

Note : Run this command from the root of your application.

5. Lastly, we’ll need to setup a virtual host for Laravel. Add the domain,, to our hosts files i.e /etc/hosts

Note: we are not buying an actual .com domain, but just making one at local installation.

This will inform our machine that the domain will resolve to, which is the local computer.

6. In the Laravel files you should see a directory, called public, which is where all publically accessible files should go. In addition to that, we need to make sure that our domain, only points to the public folder and nowhere else. Edit /etc/apache2/sites-available. Add following lines to it.
(i) Copy deafult file as a new file.

$ cp default laravel

(ii) Edit /etc/apache2/sites-available/laravel. Add below given lines to it.

<VirtualHost *:80>
DocumentRoot "/var/www/laravel-master/public"
<Directory "/var/www/laravel-master/public">

(iii) Run below given command after it.

$ sudo a2ensite laravel

7. Reload apache Server.

$ sudo service apache2 reload

8. Run on your browser. It display “You have arrived”. That’s all.