0.9 C
New York
Friday, February 3, 2023

Install Laravel on Ubuntu 22.04 LTS Jammy JellyFish Linux – Linux Shout

Tutorial to learn the steps for installing PHP Laravel framework on Ubuntu 22.04 LTS Jammy JellyFish using the command terminal for developing web apps.
PHP doesn’t need an introduction, it has been around for many years powering web applications that need a dynamic programming language to work but one thing it is not (anymore): modern.
Programming languages ​​such as Ruby and Python have become increasingly popular, especially in recent years. They are “cool” and appeal better to the next generation of coders. Whereas it is unfortunate PHP is getting a bit old and you can tell. This is exactly where Laravel comes into play. We can consider it as a new generation PHP framework and that’s what makes it so popular. Inspired by Ruby on Rails and .NET, Taylor Otwell created Laravel to get the most out of PHP and to prove that more is possible. Also, he wasn’t satisfied with the other PHP frameworks. They are no longer contemporary. He doesn’t only want to help developers be more productive but also to show that clean programming with PHP can also be fun again.
In this article, let’s discuss the initial phase to work with Laravel is to install it on Ubuntu-based Linux systems.
The steps given here to set up the Laravel framework on Ubuntu 22.04 will be the same for other versions of Ubuntu such as 18.04 or 20.04 as well.
First of all, update your system so that it could have the latest updates for security and the installed packages. This will also refresh the APT package manager index cache.
Also, install git:
Laravel framework needs PHP to work. However, here we are also installing Apache, and MySQL on your Ubuntu Linux to serve pages of the app, generated on this framework using the Apache whereas to save the data, we have MySQL. Hence, let’s first install the LAMP stack using the command given below.
Once the installation is completed, you can check the services of Apache and MySQL are working without any errors or not.
For Apache:
check Apache service status
MySQL Service status
We need a Database to store the data generated by your Laravel app project, hence here we are using a MySQL Database server for that.
However, before creating a database, let’s secure our MySQL server.
Login to MySQL first:
Set root password:
Note: Change [email protected] with some strong password, you want to set.
Run the Secure Installation script again.
The script will ask these questions.
Enter the password for user root: type your set password and then press ENTER.
Change the password for root? Press N, then ENTER.
Remove anonymous users? Press Y, then ENTER.
Disallow root login remotely? Press Y, then ENTER.
Remove the test database and access to it? Press Y, then ENTER.
Reload privilege tables now? Press Y, then ENTER.
Once done create Database for Laravel:
Login to Database, if you are not already:
Now, use the given commands, one by one:
Note: Replace yourdb with whatever name you want to give your Database, whereas youruser is the user you want to create while the password is the secret key to protect your created user account.
To install Laravel and the dependencies required by it to work properly, we need to use Composer. It is a library manager for PHP projects. Well, we can install Composer using the default package manager of our Ubuntu 22.04, however, the version provided by it will not be the latest one. Therefore, here we are going for an installer script, officially provided by the developers of this PHP library management tool.
Install composer php on Ubuntu 22.04
Let’s clone the Laravel from its Github repository directly into our web root directory.
Switch to web directory:
Clone Laravel
Once you have downloaded the Laravel on your system, switch to its directory and use the Composer to start the installation process.
Use the Composer
Once the installation is completed the change permission to files :
—–From here onwards we will show how to set it up for accessing Laravel app using Apache——
We already have an example environment file, let’s use it to create one for our Laravel app.
While inside the Laravel directory, run:
Generate an encryption key for your app:
Add the Database details:
Go to the database section and change the values:
Add Database details Laravel app
Save the file using Ctrl+O, hit the Enter key, and then exit the file using Ctrl+X.
Edit the default Apache configuration file and change the web root document directory path. This will point it to serve the files provided by the Laravel instead of the default Apache page.
Edit :
Save the file and restart the Apache.
We have configured the Laravel PHP framework to access through the Apache web server over port 80. Hence, simply open your system’s browser that can access the ip-address of the Ubuntu 22.04 where you have installed the Laravel and point it to it.
For example:
Install Laravel PHP framework on Ubuntu 22.04 Jammy
If you want to know how to use the Laravel command line to create and work on various projects without using the Apache web server then here is the tutorial for that. Use Laravel command line 
Other Articles:
How to Install phpMyAdmin with Apache on Ubuntu 22.04 LTS
Install Composer on Ubuntu 22.04 | 20.04 LTS
How To install Flarum Forum software on Ubuntu 22.04 | 20.04
Linux, Ubuntu



Kali Linux

This site uses Akismet to reduce spam. Learn how your comment data is processed.
Linux Shout crafted as a part of our main portal H2S Media to publish Linux related tutorials and open source Software.


Related Articles


Please enter your comment!
Please enter your name here

Latest Articles