How To Install Laravel on Ubuntu 16.04

laravel

In this tutorial we will show you how to install Laravel on ubuntu 16.04 server. For you don’t know, Laravel is a web application framework with expressive, elegant syntax. Laravel is widely used for websites now days, almost huge traffict site used Laravel as their framework.

Prerequisites

This article assumes you have at least basic knowledge of linux, know how to use the shell, root user or non-root user account with sudo privileges set up on your server.

Install Laravel on Ubuntu 16.04

Step 1 – Updating package list

First we need to update package list by running these following apt-get commands in the terminal.

Step 2 – Install LAMP (Linux, Apache, Mysql, PHP) server.

To run Laravel we need LAMP server installed, first you need to follow this guide to install LAMP on ubuntu 16.04. Also install all required PHP modules:

Step 3 –  Install Composer

Install Composer which is the tool for dependency management in PHP:

In this tutorial we will put the composer in our /usr/local/bin/ directory.  We will also rename the composer name from composer.phar to composer. Run all these following command.

Step 4 – Installing Laravel

Download latest version of Laravel, you can  clone master repo of laravel from github, At the moment of writing this article it is version 5:

Git clone command above will create directory with name laravel, after that move to the laravel  directory and use composer to install all dependencies required for Laravel framework:

This will take a while according to the network speed. After than set proper permissions on files, in this example we will use www-data user permission

Now set the 32 bit long random number encrypption key, which used by the Illuminate encrypter service:

Sample output :

Now edit config/app.php configuration file and update above generated application key as followings. Also make sure cipher is set properly:

Step 5 – Configuring Apache web server for Laravel

Create a new virtual host directive in Apache. For example, create a new Apache configuration file named ‘laravel.conf’ on your virtual server:

Add the following lines, configure based on your laravel folder:

Now, we can restart Apache web server so that the changes take place:

Step 6 – Accessing Laravel

Simple Invoices will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://example.com or http://server-ip and complete the required the steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

 

Congratulations,  you have successfully installed Laravel on Ubuntu 16.04 server

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *