Install the Laravel PHP Framework on Ubuntu 16.04

Leave your reply


PHP frameworks make web application development easier by providing an extensive collection of libraries and components. The ability to easily use this pre-existing architecture prevents developers from "reinventing the wheel," and increases work efficiency. Learn how to install and use the Laravel PHP framework, which is one of the most popular and widely-used frameworks available.


  • A Cloud Server with Ubuntu 16.04.
  • PHP installed and running, version 7.0 or later.
  • PHP Composer package management system installed. See our article Install and Use PHP Composer on Ubuntu 16.04 for step-by-step instructions to install Composer.

Use the command php -v to check your PHP version:

user@localhost:~# php -v
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend                                                                          Technologies

In this example, the server is running PHP version 7.0.22.


  • PHP is installed and running on a Standard Linux installation by default. If your server was created with a Minimal installation, you will need to install and configure PHP before you proceed.

  • Laravel requires PHP version 7.0 or better. To use Laravel on a CentOS 7 server, follow the steps in our article to Upgrade PHP From 5.4 to 7.0 on a CentOS 7 Cloud Server.

Install Laravel

Install Laravel's PHP dependencies with the command:

sudo apt-get install php7.0-zip php-mbstring php-xml

Enable the Apache module mod_rewrite:

sudo a2enmod rewrite

Restart Apache:

sudo service apache2 restart

Use Composer to download the Laravel installer:

composer global require "laravel/installer"

Note: Because Composer is never run as root, it is not necessary to use sudo for Composer commands.

Update Your PATH

You will want to update the PATH for your Composer user so that you can use the laravel command. To do this, go to your user's home directory:

cd ~/

Open the .profile file for editing:

nano .profile

Find the following lines:

# set PATH so it includes user's private bin directories

Add $HOME/.composer/vendor/bin: to the second line so that it reads:

# set PATH so it includes user's private bin directories

Save and exit the file. Then use source to update the PATH information:

source .profile

You can now use the laravel command to create a new project:

laravel new my-project