How to Install Laravel 9 on Ubuntu 20.04


Laravel 9 has been released with many new features added, including controller route groups, default Ignition error page, Laravel Scout database engine, Symfony mailer integration, Flysystem 3.x, improved Eloquent accessors/mutators, and many more.

Starting from Laravel 9, a major version of Laravel will be released every 12 months which was previously every 6 months. Laravel 9 is an LTS (Long Term Support) version that will get bug fixes support until 8 February 2024 and security fixes support until 8 February 2025.

For information on the Laravel 9 release read the Release Notes.

*Server Requirements*

Server requirements especially PHP that must be met to be able to run Laravel 9:

· PHP >= 8.0 · BCMath PHP Extension · Ctype PHP Extension · DOM PHP Extension · Fileinfo PHP Extension · JSON PHP Extension · Mbstring PHP Extension · OpenSSL PHP Extension · PCRE PHP Extension · PDO PHP Extension · Tokenizer PHP Extension · XML PHP Extension

*Install PHP*

The default repository for Ubuntu 20.04 only provides PHP v7.4. Therefore it requires an additional repository for the latest PHP.

Installing the *ppa:ondrej/php* repository.


1 sudo add-apt-repository ppa:ondrej/php

Install PHP 8.1 and its extensions.


1 sudo apt install php8.1 php8.1-cli php8.1-common php8.1-mbstring php8.1-gd php8.1-intl php8.1-xml php8.1-mysql php8.1-zip php8.1-xsl php8.1-curl

Verify the PHP installation.


1 2 3 4 5 musa@ubuntu:~$ php -v PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:33) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.2, Copyright (c) Zend Technologies     with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

*Install Composer*

Install Composer.


1 2 3 sudo apt install curl git unzip curl “€“sS | php sudo mv composer.phar /usr/local/bin/composer

Verify Composer installation.


1 2 musa@ubuntu:~$ composer -V Composer version 2.2.6 2022-02-04 17:00:38

*Install Laravel*

Install Laravel 9.0 using Composer and save it in the *webapp* folder.


1 composer create-project laravel/laravel webapp 9.0

Running Laravel development server.


1 2 cd webapp php artisan serve

The result of the above command.


1 2 3 musa@ubuntu:~/webapp$ php artisan serve Starting Laravel development server: [Wed Feb  9 07:13:27 2022] PHP 8.1.2 Development Server ( started

If using a VPS and want to access it via Public IP add *–host*.


1 php artisan serve –host

Laravel runs on the development server

Leave a Reply

Your email address will not be published.

scroll to top