How to Install latest laravel version on Ubuntu 18.04 | 20.04

  • Share this:

Welcome ! guys today In this tutorial we will show you how to install Laravel on an Ubuntu 20.* or 20.*+ system. The same instructions apply
for Ubuntu 20.04.3 LTS and any Ubuntu based distribution

Introduction Of Laravel 

There are a variety of tools and frameworks available to you when building a web application. Laravel is an open-source PHP web application framework with expressive, elegant syntax. Laravel allows you to easily build scalable and flexible web applications,restful APIs and eCommerce solutions.we believe Laravel is the best choice for building modern, full-stack web applications.


Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges . or root access  

Update the system packages to the latest versions:

sudo apt update && sudo apt upgrade

Installing PHP

PHP 7.4 Or 8.* plus which is the default PHP version in Ubuntu 20.04.3 is fully supported and recommended for Laravel 8.

Run the following command to install PHP 7.4 and all required PHP modules:

sudo apt install php7.4-common php7.4-cli php7.4-gd php7.4-mysql php7.4-curl php7.4-intl php7.4-mbstring php7.4-bcmath php7.4-imap php7.4-xml php7.4-zip

Installing Composer

Composer is a dependency manager for PHP and we will be using it to download the Laravel core and install all necessary Laravel components. and PHP other components. To install composer globally, download the Composer installer with curl and move the file to the /usr/local/bin directory:

curl -sS | sudo php -- --install-dir=/usr/local/bin --filename=composer

Verify the installation by printing the composer version:

composer --version
Installing Laravel

At the time of writing this article, the latest stable version of Laravel is version 8.X

Run the Composer create-project command to install Laravel in the laravel-first-app directory:

composer create-project --prefer-dist laravel/laravel laravel-first-app

The command above will fetch all required PHP packages. The process may take a few minutes and if it is successful the 
end of the output should look like the following:

Out Put

When installed via Composer, Laravel will automatically create a file named .env. This files includes custom configuration variables including the database credentials and app name and base_url etc.. You can read more about how to configure Laravel

You can start the development server by navigating to the Laravel project directory and executing the artisan serve command:

cd ~/laravel-first-app
php artisan serve

Verifying the Installation

Open your browser, type and assuming the installation is successful, a screen similar to the following will appear