How To Install PHP Laravel on Almalinux | Rocky linux 8

Tutorial to learn the steps for installing PHP Larvel framework on Rocky Linux or Almalinux 8 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 informative article, let’s touch on the initial phase to work with Laravel is to install it on RedHat-based Linux systems.

Install Laravel on Almalinux 8 | Rocky Linux 8

The steps given here to set up Laravel will be applicable for all popular Redhat-based systems such as Oracle Linux, Rocky, CentOS 9 Stream, and others.

1. Requirements

RedHat Linux such as Rocky or AlmaLinux
A non-root sudo user PHP >= 7.2.5
Internet connection

2. Install PHP 8. x

Well, being PHP based framework, PHP language must be on your system. Follow the given commands to get the latest PHP 8. x on your system:

sudo dnf install -y
sudo dnf update
sudo dnf module reset php
sudo dnf module enable php:remi-8.0
sudo apt install php

Also, install unzip and curl, if you don’t have already:

sudo dnf install unzip curl


3. Installing PHP Composer

The easiest way to set up a Laravel project is to use the Composer. It is an application-level package manager to download, manage and install the dependencies of PHP software and required libraries.

curl -sS | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

To check the version:

composer -v

Install PHP Composer Rocky Linux or AlmaLinux


4. Installing the Laravel on AlmaLinux 8 | Rocky Linux 8

Laravel is not like PHP to install via the default base repository of Almalinux or Rocky, therefore, here Composer comes into the picture to install the libraries and dependencies required by Laravel.

composer global require "laravel/installer"

Add the composer bin folder to your system path so that we can use easily run the Laravel command tool anywhere in the terminal regardless of the current directory in which we are.

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

Reload bash

source ~/.bashrc

5. Check the Laravel

Once the installation is completed we can check this PHP framework is working on our system.


install Laravel on AlmaLinux 8 Rocky Linux 8


6. Create a New Laravel Project

laravel new command will create a fresh Laravel installation in the directory you specify after the command. Inside which you can start developing and saving your project files.

laravel new myfirstapp

myfirstapp is a directory name you can give whatever you want

Switch to the created directory:

cd myfirstapp
php artisan serve

To run in the development server in the background to free Terminal, you can use:

php artisan serve &

This will start the targeted Laravel development server, open your browser and point it at:

Laravel installation AlmaLinux or Rocky Linux 8

Alternatively, if you don’t want to install Laravel globally, you can simply use the composer and create the project directory with the Laravel files required to develop the project.

composer create-project laravel/laravel my-app
cd my-app
php artisan serve


To know more, you can refer to the official documentation of Laravel

Other Articles:

How to install Apache, MySQL, and PHP on AlmaLinux 8
How To install Flarum Forum software on Ubuntu 22.04 | 20.04


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.