How to install Laravel 5.6 on Ubuntu 16.04

In this post we will provide detailed how to instructions to install Laravel 5.6 on a Ubuntu 16.04 desktop computer, in order to quickly start developing PHP Web Applications using Laravel 5.6.

These instructions do not include having to install any virtual machine managers in order to run Laravel 5.6 on your ubuntu development workstation.

Install PHP 7.1

The first requirement is the PHP and and a few additional PHP components. In order to do this open a terminal window ctrl + alt + t

It’s always good practice to update you repositories and carry carry out any upgrades

We want ti go ahead and install the latest version of PHP, which at the time of writing this post is PHP 7.1, which is not included in the default Official Ubuntu repositories. PHP 7.1 will be included in Ubuntu 17.10, but for ubuntu 16.04 we will need to add a link to an alternate repository.

First in order to do so we will also need to install a package that will allow you to easily manage your distribution and independent software vendor sources.

Once installed we can add a link to the new repository and update

We can now go ahead and install PHP7.1 with all the additional components we need to install Laravel.

To ensure we have everything installed and PHP is working lets quickly check the version using php -v

php version check

Install MySQL

You can install whichever database server you wish but in my case I needed to use mysql

Once installed just you’ll want to run the included security script. This changes some of the less secure default options for things like remote root logins and sample users.

Install curl

Typically on fresh installs of ubuntu cURL is not installed. cURL is a computer software project providing a library and command-line tool for transferring data using various protocols.

Install composer

The Laravel uses the composer to manage your dependencies, so the next step is install Composer.

Change permissions on composer so youu can run it without sudo

Install Symfony

laravel leverages another PHP framework, Symfony, quite intensively so it worth while installing symfony on your development machine too.

We’ll use Composer to install the Skeleton and create a testproj

Afer installing and creating the test projects lets run it to check we have everything working as expected.

Symfony install

Lets quickly run the project to test all is working. Change into the directory cd testproj and execute php -S 127.0.0.1:8000 -t public

We can now open our browser and navigate to http://localhost:8000/ .

We should see the test page which confirms all is up and running
Symfony test page

Install Laravel

We’re now ready to install Laravel using composer

All that is left to do now is ensure Laravel is added to you PATH

To do simply execute

All we now need to do is refresh the bash profile because we have made changes

Start project

We’re all set now to create project using Laravel. We can use either method of starting a project i.e. using Laravel commands of composer based. For the purpose of this guide we’ll be using Laravel.

To start a new project create a directory you would like to store your projects i.e. mkdir projects

change in to the directory cd projects and then we can use the Laravel command to create a new project which in this instance is a simple To Do List web application we’ll name notepad, but you can name it whatever you choose.

Once the application is generated we can cd notepad the php artisan serve and the we then open a browser and visit http://localhost:8000 we’ll see the laravel sample page

laravel test page

Summary

I have to admit that it is porbably not the most friction free experience I have had configuring the various software development frameworks, but Laravel more than makes up for it as you start working with it.

Hope this guide helps you on your way to becoming an efficient Laravel developer and save you time and frustration on your journey.

Follow Me

Gary Woodfine

Helps businesses by improving their technical proficiencies and eliminating waste from the software development pipelines.

A unique background as business owner, marketing, software development and business development ensures that he can offer the optimum business consultancy services across a wide spectrum of business challenges.
Follow Me

Latest posts by Gary Woodfine (see all)

π
%d bloggers like this: