How to install Laravel on Linux

This tutorial will show you how to install Laravel on your Linux VPS. Laravel is an open source web application framework written in PHP which follows the model-view-controller (MVC) paradigm. Laravel is a young framework, but it quickly gained popularity thanks to the extensive documentation, friendly comunity and clean and classy code.

This tutorial assumes that you have :
-Web server (apache or nginx)
-PHP 5.3 or newer
* Please refer to the following articles about how to set up a LAMP or LNMP server.

Go to the web server’s root directory


cd /var/www


cd /var/www/html

Download Laravel

wget -O laravel.zip http://laravel.com/download

Extract the archive contents and rename the extracted directory to “laravelsite” or whatever you like.

unzip laravel.zip
mv laravel-laravel-* laravelsite

Change ownership


chown -R www-data: /var/www/laravelsite


chown -R apache: /var/www/html/laravelsite

Create new apache or nginx virtual host


server {
  server_name laravelsite.dev;
  listen 80;
  root /var/www/laravelsite/public;
  # Uncomment the following line for Centos/Fedora
  # root /var/www/html/laravelsite/public
  index index.php;
  location / {
    try_files $uri $uri/ @rewrites;
  location @rewrites {
    rewrite ^ /index.php last;
  location ~ \.php {
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include /etc/nginx/fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


<VirtualHost *:80>
    DocumentRoot /var/www/laravelsite/public
    # Uncomment the following line for Centos/Fedora
    # DocumentRoot /var/www/html/laravelsite/public
    ServerName laravelsite.dev

If you want to use “Cleaner URLs”, add the following code in the .htaccess file.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

As you noticed the DocumentRoot points to the ‘public’ directory.

Finaly, restart your web server and open your newly created Laravel installation in a web browser. For further documentation please visit http://laravel.com/docs/

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories Tutorials
admin :

View Comments (3)

  • can you guide me how to install laravel in Centos server we are using Cpanel too .. also we don't install sofclus

    • The installation is simple, login to your server via SSH and:

      1. Install composer as root
      root@vps~# curl -sS https://getcomposer.org/installer | php
      root@vps~# mv composer.phar /usr/local/bin/composer

      2. Install Laravel 4.2 as user
      user@vps~# cd /home/user/
      user@vps~# composer create-project laravel/laravel --prefer-dist
      user@vps~# rm -rf public_html
      user@vps~# ln -s laravel/public/ public_html

      Please note Laravel requires: PHP >= 5.4 and MCrypt PHP Extension

    • You can install Laravel in CentOS using this tutorial.

      Do you get any errors during the installation procedure?