How to install Laravel on Linux

How to install laravel on linux

We’ll show you how to install Laravel on Linux. 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 community and clean and classy code. Installing Laravel on Linux is fairly easy task, just carefully follow the steps bellow and you should have Laravel installed on your Linux machine in less then 10 minutes.

1. Prerequisites

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.

2. Go to the web server’s root directory


cd /var/www


cd /var/www/html

3. Download Laravel

wget -O

4. Extract the archive contents

mv laravel-laravel-* laravelsite

5. Change ownership


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


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

6. Create new apache or nginx virtual host


server {
  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

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.

7. Restart Your Webserver

Finaly, restart your web server and open your newly created Laravel installation in a web browser. For further documentation please visit

You don’t have to Install Laravel on Linux, if you use one of our Managed Laravel Hosting services, in which case you can simply ask our expert Linux admins to install and set up Laravel for you. They are available 24×7 and will take care of your request immediately.

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

3 thoughts on “How to install Laravel on Linux”

  1. 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 | 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


Leave a Comment

To prove you are human please solve the following *