How To Install PHP Laravel on Almalinux | Rocky linux 8

Tutorial to learn steps to install PHP Larvel framework on Rocky Linux or Almalinux 8 using command terminal for web application development.

PHP needs no introduction, it’s been around for many years to power web applications that need a dynamic programming language to run, but there’s one thing it definitely isn’t 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. Considering it’s unfortunate that PHP is getting a bit old and you can tell. This is exactly where Laravel comes in. It can be considered a next generation PHP framework and that is what makes it so popular. Inspired by Ruby on Rails and .NET, Taylor Otwell created Laravel to get the most out of PHP and prove that more is possible. Also, he was unhappy with other PHP frameworks. They are no longer contemporary. He not only wants to help developers be more productive, but also shows that clean programming with PHP can be fun again too.

In this informative article, let’s discuss the initial phase for working with Laravel is to install it on RedHat-based Linux systems.

Install Laravel on Almalinux 8 | Rocky linux 8

The steps given here to configure Laravel will be applicable to 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 a PHP-based framework, the PHP language must be on your system. Follow the given commands to get the latest version of PHP 8.x on your system:

sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
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. Install PHP Composer

The easiest way to set up a Laravel project is to use Composer. It is an application-level package manager for downloading, managing and installing PHP software dependencies and required libraries.

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

To check the version:

composer -v

4. Install Laravel on AlmaLinux 8 | Rocky Linux 8

Laravel is not like PHP to be installed through the default base repository of Almalinux or Rocky, therefore, here Composer comes into play 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 easily use the Laravel command tool anywhere in the terminal, regardless of the current directory we are in.

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

Reload bash

source ~/.bashrc

Check the Laravel

Once the installation is complete, we can verify that this PHP framework works on our system.

laravel

install Laravel on AlmaLinux 8 Rocky Linux 8

Create a new Laravel project

new The command will create a new 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 to which you can give whatever you want

Switch to the created directory:

cd myfirstapp
php artisan serve

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

php artisan serve &

This will start to start the Laravel development server, open your browser and point it to: http://127.0.0.1:8000

Installing Laravel AlmaLinux or Rocky Linux 8

AlternatelyIf you don’t want to install Laravel globally, you can just use 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

For more information, you can consult the official documentation by Laravel

Other Items:

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

Comments are closed.