FedoraRHEL Based

How To Install Laravel on Fedora 38

Install Laravel on Fedora 38

In this tutorial, we will show you how to install Laravel on Fedora 38. Laravel is a popular PHP web framework that is designed for building web applications with a simple and elegant syntax. If you’re a PHP developer or planning to build web applications using PHP, Laravel is a great choice.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Laravel PHP web application framework on a Fedora 38.

Prerequisites

  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Laravel.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Laravel on Fedora 38

Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:

sudo dnf upgrade
sudo dnf update

Step 2. Installing PHP and Required Extensions.

To run Laravel on Fedora Linux, we need to install PHP and some of its required extensions. You can install them by running the following command:

sudo dnf install php php-cli php-common php-json php-mbstring php-mysqlnd php-xml php-zip

For additional resources on installing PHP, read the post below:

Step 3. Installing Composer.

Composer is a dependency manager for PHP that manages and installs packages required by your application. Now run the following command to Composer:

curl -sS https://getcomposer.org/installer | php

Move the Composer binary file to the /usr/local/bin directory to make it globally available:

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

Verify the installation by running the following command:

composer --version

Step 4. Installing Laravel on Fedora 38.

Now that we have installed PHP and Composer, we can install Laravel using Composer. First, navigate to the webroot directory using the following command:

cd /var/www/html/

Next, install Laravel using Composer:

sudo composer create-project laravel/laravel idroot-app

This will create a new Laravel application in the “idroot-app” directory.

Step 5. Configure Laravel.

After installing Laravel, you need to configure it to work with your web server. First, we need to make sure that  storage and bootstrap/cache directories are writable. To do this, run the following commands:

sudo chmod -R 777 storage/
sudo chmod -R 777 bootstrap/cache/

Next, we need to create a .env file in the root directory of our Laravel project. To do this, run the following command:

cp .env.example .env

Here are some of the important settings you may want to configure:

  • APP_URL: This should be set to the URL of your application.
  • DB_DATABASE: This is the name of the database you want to use for your application.
  • DB_USERNAME: This is the username that will be used to connect to the database.
  • DB_PASSWORD: This is the password that will be used to connect to the database.

After you have configured the .env file, save, and close it.

Finally, we can serve our Laravel application by running the following command in the terminal:

php artisan serve

Step 5. Accessing Laravel Web Interface.

Once successfully installed, open your web browser and access Laravel using the URL http://your-IP-address:8000. You will be redirected to the Laravel page:

Install Laravel on Fedora 38

Congratulations! You have successfully installed Laravel. Thanks for using this tutorial for installing the Laravel PHP web application framework on your Fedora 38 system. For additional help or useful information, we recommend you check the official Laravel website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button