Install Laravel on Ubuntu 20.04 - Step by Step Process ?

Laravel is an open-source PHP framework that helps you develop web applications easily and efficiently. It basically follows the model-view-controller pattern and it is powered by the Symfony framework. Laravel provides an abundant command-line interface for developers.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related PHP framework queries.

In this context, we shall look into how to install Laravel on Ubuntu 20.04.

Steps to Set up Laravel on Ubuntu Linux System 

1. Install PHP

Laravel requires PHP 7.2.5 or newer to be installed. Start by Running the apt update command provided below:

$ sudo apt update

Then run the following command to install PHP:

$ sudo apt install php

To Install PHP extension, execute:

$ sudo apt install php7.4-mbstring php7.4-xml php7.4-zip

2. Install Composer

To install composer on Ubuntu, use the curl command below:

$ curl -s https://getcomposer.org/installer | php

Then move composer.phar to composer by mv command:

$ sudo mv composer.phar /usr/local/bin/composer

3. Install Laravel

Laravel on Ubuntu can be easily installed by running the following command:

$ composer global require laravel/installer

4. Configure the .bashrc file

Now, open the .bashrc file with the command:

$ nano .bashrc

Then write the following values in it:

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

Next, save this file and run the following command:

$ source ~/.bashrc

5. Create a new Laravel app

To create a Laravel application, simply run the command:

$ laravel new [name of app]

For example to create an application with name "newAPP", simply execute:

$ laravel new newAPP

Now, Go to application directory:

$ cd newAPP

Next, run the below command:

$ composer install

To generate an encryption key, run the command:

$ php artisan key:generate --ansi

Then run the following command to get localhost:

$ php artisan serve

Finally, you can use localhost to access the Laravel Application.

[Need help in fixing Laravel PHP errors? We can help you. ]


This article covers steps to Install and Set up Laravel Application on your Ubuntu Linux System. Laravel is a widely used open-source PHP framework for web application development. The MVC (Model-View-Controller) architectural pattern is implemented in Laravel.

How to Install  and Manage Apache Web Server on Ubuntu?

1. Update all available repositories on your system and install the Apache webserver using the apt command below:

$ sudo apt update
$ sudo apt install apache2

2. Start the Apache service and add it to the system boot:

$ systemctl start apache2
$ systemctl enable apache2

3. Now check the Apache service status using the following command:

$ systemctl status apache2