The Laravel comes with a powerful command-line utility known as Artisan. Which is useful to perform multiple command-line operations. This guide will help you to set up a new Laravel application on a Ubuntu Desktop system.

Step 1 – Set Up LAMP Stack

First of all, you need to set up the LAMP stack on your Ubuntu system. Laravel required PHP 7.2.5 or higher version to be installed. Follow the below instructions to install all required packages and services on your system. Install PHP Apache2 Install MySQL You also need to to MySQL post installation instructions. Use this tutorial to find more details about MySQL installation.

Step 2 – Installing Composer

PHP Composer is used to installing required dependencies for the PHP application. Execute the following commands to install and configure Composer on your system.

Step 3 – Download and Install Laravel

The latest Laravel version is available under the Github repository. Use the below command to clone the master branch of the Laravel from the GitHub repository. Switch to the laravel directory and use the composer to install all dependencies required for the Laravel framework. The dependencies installation may take some time as per your network speed. After successfully installing all dependencies, set the proper permissions on all files.

Step 4 – Create Environment Settings

Next, create the Laravel environment confiugration file. You can do it by renaming the .evn.example file to .env. This will use to setup application environment for the project. Now generate base64 random number encryption key, which used by the Illuminate encrypter service. Edit the .env configuration file and update the required settings. Also, make sure APP_KEY is properly set as generated in the above command. You can also change the APP_NAME with the name of your application and APP_URL to the URL you need to access your Laravel application.

Step 5 – Create MySQL User and Database

Next, create a MySQL database for your Laravel application. Also, create a MySQL user to connect the database from the Laravel application. Login to your MySQL server and create MySQL database and user by running the following commands.

Now edit the .env file and update database settings.

Step 6 – Apache Configuration

Next, edit Apache default virtual host configuration file (ie: 000-default.conf) and update Document Root to the Laravel public directory as below: Update the configuration like below: Reload Apache configuration changes by restarting the service using the below command

Step 7 – Access Laravel Application

You have successfully configured the Laravel 8 PHP framework on your system. Access Laravel application in your favorite web browser

Let’s start building an awesome application using the latest Laravel PHP Framework.

Conclusion

This tutorial explained to you to create a new Laravel application. Also provided you with steps to configure the Laravel application with Apache webserver.

How To Set Up Laravel on Ubuntu 21 04   20 10   TecAdmin - 22