CentLinux | Learn How to Install CentOS/Rocky Linux Servers

Sunday, April 3, 2022

Install PHP Laravel Framework on Rocky Linux 8

Install PHP Laravel Framework on Rocky Linux 8

In this article, you will learn how to install PHP Laravel Framework on Rocky Linux 8 or other RPM based distros.

 

Table of Contents:

 

What is Laravel? :

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller (MVC) architectural pattern and based on Symfony. Some of the features of Laravel are a modular packaging system with a dedicated dependency manager, different ways for accessing relational databases, utilities that aid in application deployment and maintenance, and its orientation toward syntactic sugar. (Source: Wikipedia)

The source code of Laravel is hosted on GitHub and licensed under the terms of MIT License.

Install PHP Laravel Framework on Rocky Linux 8

 

Environment Specification:

We are using a minimal Rocky Linux 8 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Rocky Linux 8.5 (Green Obsidian)
  • Hostname – laravel-01.centlinux.com
  • IP Address - 192.168.116.131 /24

 

Updating Rocky Linux Operating System:

By using a SSH client, connect with laravel-01.centlinux.com machine as root user.

Rebuild yum cache of enabled repositories.

# dnf makecache
Rocky Linux 8 - AppStream                       2.2 kB/s | 4.8 kB     00:02
Rocky Linux 8 - AppStream                       448 kB/s | 9.7 MB     00:22
Rocky Linux 8 - BaseOS                          2.2 kB/s | 4.3 kB     00:01
Rocky Linux 8 - BaseOS                          693 kB/s | 6.8 MB     00:09
Rocky Linux 8 - Extras                          1.6 kB/s | 3.5 kB     00:02
Metadata cache created.

Execute following command to update already installed software packages on your Rocky Linux Operating System.

# dnf update -y

If the above command updates your Linux Kernel, then you should reboot your Linux Operating System before moving forward.

# reboot

After reboot, check Linux Operating System and Linux Kernel versions as follows.

# cat /etc/rocky-release && uname -r
Rocky Linux release 8.5 (Green Obsidian)
4.18.0-348.20.1.el8_5.x86_64

 

Installing PHP 8.1 on Rocky Linux:

PHP 8.1 is the latest release of the most popular server-side programming language at the time of this writing.

PHP 8.1 is currently not available in standard yum repositories.

Therefore, you have to install Remi yum repository to grab the latest version of PHP.

Execute following command to install Remi yum repository on Rocky Linux.

# dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Last metadata expiration check: 0:08:18 ago on Sat 02 Apr 2022 09:51:30 PM PKT.
remi-release-8.rpm                               15 kB/s |  29 kB     00:01
Dependencies resolved.
================================================================================
 Package            Architecture Version               Repository          Size
================================================================================
Installing:
 remi-release       noarch       8.5-3.el8.remi        @commandline        29 k
Installing dependencies:
 epel-release       noarch       8-13.el8              extras              23 k

Transaction Summary
================================================================================
Install  2 Packages

Total size: 52 k
Total download size: 23 k
Installed size: 59 k
Downloading Packages:
epel-release-8-13.el8.noarch.rpm                4.9 kB/s |  23 kB     00:04
--------------------------------------------------------------------------------
Total                                           3.3 kB/s |  23 kB     00:07
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : epel-release-8-13.el8.noarch                           1/2
  Installing       : remi-release-8.5-3.el8.remi.noarch                     2/2
  Running scriptlet: remi-release-8.5-3.el8.remi.noarch                     2/2
  Verifying        : epel-release-8-13.el8.noarch                           1/2
  Verifying        : remi-release-8.5-3.el8.remi.noarch                     2/2

Installed:
  epel-release-8-13.el8.noarch        remi-release-8.5-3.el8.remi.noarch

Complete!

Rebuild yum cache of newly installed repositories.

# dnf makecache
Rocky Linux 8 - AppStream                       2.4 kB/s | 4.8 kB     00:01
Rocky Linux 8 - BaseOS                          2.1 kB/s | 4.3 kB     00:02
Rocky Linux 8 - Extras                          994  B/s | 3.5 kB     00:03
Extra Packages for Enterprise Linux 8 - x86_64  675 kB/s |  11 MB     00:17
Extra Packages for Enterprise Linux Modular 8 -  62 kB/s | 1.0 MB     00:16
Remi's Modular repository for Enterprise Linux  421  B/s | 833  B     00:01
Remi's Modular repository for Enterprise Linux  3.0 MB/s | 3.1 kB     00:00
Importing GPG key 0x5F11735A:
 Userid     : "Remi's RPM repository <remi@remirepo.net>"
 Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Is this ok [y/N]: y
Remi's Modular repository for Enterprise Linux  225 kB/s | 973 kB     00:04
Safe Remi's RPM repository for Enterprise Linux 415  B/s | 833  B     00:02
Safe Remi's RPM repository for Enterprise Linux 3.0 MB/s | 3.1 kB     00:00
Importing GPG key 0x5F11735A:
 Userid     : "Remi's RPM repository <remi@remirepo.net>"
 Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Is this ok [y/N]: y
Safe Remi's RPM repository for Enterprise Linux 320 kB/s | 2.1 MB     00:06
Metadata cache created.

Get list of available PHP modules in installed yum repositories.

# dnf module list php
Last metadata expiration check: 0:00:31 ago on Sat 02 Apr 2022 10:01:23 PM PKT.
Rocky Linux 8 - AppStream
Name      Stream       Profiles                       Summary
php       7.2 [d]      common [d], devel, minimal     PHP scripting language
php       7.3          common [d], devel, minimal     PHP scripting language
php       7.4          common [d], devel, minimal     PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name      Stream       Profiles                       Summary
php       remi-7.2     common [d], devel, minimal     PHP scripting language
php       remi-7.3     common [d], devel, minimal     PHP scripting language
php       remi-7.4     common [d], devel, minimal     PHP scripting language
php       remi-8.0     common [d], devel, minimal     PHP scripting language
php       remi-8.1     common [d], devel, minimal     PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

You can now easily install PHP 8.1 by executing following command on Linux bash prompt.

# dnf module install -y php:remi-8.1
Last metadata expiration check: 0:02:02 ago on Sat 02 Apr 2022 10:01:23 PM PKT.
Dependencies resolved.
================================================================================
 Package          Arch   Version                             Repository    Size
================================================================================
Installing group/module packages:
 php-cli          x86_64 8.1.4-1.el8.remi                    remi-modular 5.3 M
 php-common       x86_64 8.1.4-1.el8.remi                    remi-modular 1.2 M
 php-fpm          x86_64 8.1.4-1.el8.remi                    remi-modular 1.8 M
 php-mbstring     x86_64 8.1.4-1.el8.remi                    remi-modular 520 k
 php-xml          x86_64 8.1.4-1.el8.remi                    remi-modular 251 k
Installing dependencies:
 httpd-filesystem noarch 2.4.37-43.module+el8.5.0+747+83fae388.3
                                                             appstream     39 k
 libxslt          x86_64 1.1.32-6.el8                        baseos       249 k
 oniguruma5php    x86_64 6.9.7.1-1.el8.remi                  remi-safe    210 k
Installing weak dependencies:
 nginx-filesystem noarch 1:1.14.1-9.module+el8.4.0+542+81547229
                                                             appstream     23 k
Installing module profiles:
 php/common
Enabling module streams:
 httpd                   2.4
 nginx                   1.14
 php                     remi-8.1

Transaction Summary
================================================================================
Install  9 Packages

Total download size: 9.6 M
Installed size: 45 M
Downloading Packages:
(1/9): nginx-filesystem-1.14.1-9.module+el8.4.0  12 kB/s |  23 kB     00:01
(2/9): libxslt-1.1.32-6.el8.x86_64.rpm           96 kB/s | 249 kB     00:02
(3/9): httpd-filesystem-2.4.37-43.module+el8.5. 7.8 kB/s |  39 kB     00:04
(4/9): php-common-8.1.4-1.el8.remi.x86_64.rpm   258 kB/s | 1.2 MB     00:04
(5/9): php-mbstring-8.1.4-1.el8.remi.x86_64.rpm 398 kB/s | 520 kB     00:01
(6/9): php-xml-8.1.4-1.el8.remi.x86_64.rpm      326 kB/s | 251 kB     00:00
(7/9): oniguruma5php-6.9.7.1-1.el8.remi.x86_64. 334 kB/s | 210 kB     00:00
(8/9): php-fpm-8.1.4-1.el8.remi.x86_64.rpm      316 kB/s | 1.8 MB     00:05
(9/9): php-cli-8.1.4-1.el8.remi.x86_64.rpm      434 kB/s | 5.3 MB     00:12
--------------------------------------------------------------------------------
Total                                           549 kB/s | 9.6 MB     00:17
Remi's Modular repository for Enterprise Linux  3.0 MB/s | 3.1 kB     00:00
Importing GPG key 0x5F11735A:
 Userid     : "Remi's RPM repository <remi@remirepo.net>"
 Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Running scriptlet: php-common-8.1.4-1.el8.remi.x86_64                     1/9
  Installing       : php-common-8.1.4-1.el8.remi.x86_64                     1/9
  Installing       : oniguruma5php-6.9.7.1-1.el8.remi.x86_64                2/9
  Installing       : libxslt-1.1.32-6.el8.x86_64                            3/9
  Running scriptlet: nginx-filesystem-1:1.14.1-9.module+el8.4.0+542+81547   4/9
  Installing       : nginx-filesystem-1:1.14.1-9.module+el8.4.0+542+81547   4/9
  Running scriptlet: httpd-filesystem-2.4.37-43.module+el8.5.0+747+83fae3   5/9
  Installing       : httpd-filesystem-2.4.37-43.module+el8.5.0+747+83fae3   5/9
  Installing       : php-fpm-8.1.4-1.el8.remi.x86_64                        6/9
  Running scriptlet: php-fpm-8.1.4-1.el8.remi.x86_64                        6/9
  Installing       : php-xml-8.1.4-1.el8.remi.x86_64                        7/9
  Installing       : php-mbstring-8.1.4-1.el8.remi.x86_64                   8/9
  Installing       : php-cli-8.1.4-1.el8.remi.x86_64                        9/9
  Running scriptlet: php-cli-8.1.4-1.el8.remi.x86_64                        9/9
  Running scriptlet: php-fpm-8.1.4-1.el8.remi.x86_64                        9/9
  Verifying        : httpd-filesystem-2.4.37-43.module+el8.5.0+747+83fae3   1/9
  Verifying        : nginx-filesystem-1:1.14.1-9.module+el8.4.0+542+81547   2/9
  Verifying        : libxslt-1.1.32-6.el8.x86_64                            3/9
  Verifying        : php-cli-8.1.4-1.el8.remi.x86_64                        4/9
  Verifying        : php-common-8.1.4-1.el8.remi.x86_64                     5/9
  Verifying        : php-fpm-8.1.4-1.el8.remi.x86_64                        6/9
  Verifying        : php-mbstring-8.1.4-1.el8.remi.x86_64                   7/9
  Verifying        : php-xml-8.1.4-1.el8.remi.x86_64                        8/9
  Verifying        : oniguruma5php-6.9.7.1-1.el8.remi.x86_64                9/9

Installed:
  httpd-filesystem-2.4.37-43.module+el8.5.0+747+83fae388.3.noarch
  libxslt-1.1.32-6.el8.x86_64
  nginx-filesystem-1:1.14.1-9.module+el8.4.0+542+81547229.noarch
  oniguruma5php-6.9.7.1-1.el8.remi.x86_64
  php-cli-8.1.4-1.el8.remi.x86_64
  php-common-8.1.4-1.el8.remi.x86_64
  php-fpm-8.1.4-1.el8.remi.x86_64
  php-mbstring-8.1.4-1.el8.remi.x86_64
  php-xml-8.1.4-1.el8.remi.x86_64

Complete!

 

Installing PHP Composer on Rocky Linux:

PHP composer is needed to install and configure the Laravel framework.

But before installing PHP Composer, you must also install git and unzip packages. These packages are required during PHP Composer installation.

# dnf install -y git unzip

Download and install PHP Composer by executing following command at Linux bash prompt.

# cd /tmp
# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...

Composer (version 2.3.3) successfully installed to: /tmp/composer.phar
Use it: php composer.phar

Rename and move the composer.phar file to location that is included in your PATH variable. So you can execute composer command from anywhere. Also set execution permissions of composer file.

# mv composer.phar /usr/local/bin/composer
# chmod +x /usr/local/bin/composer

Now. execute following command to check the PHP Composer version.

# composer -V
Composer version 2.3.3 2022-04-01 22:15:35

 

Installing Laravel on Rocky Linux:

Download and install Laravel Framework and dependent libraries by using composer command.

# composer global require "laravel/installer"
Changed current directory to /root/.config/composer
Using version ^4.2 for laravel/installer
./composer.json has been updated
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 10 installs, 0 updates, 0 removals
  - Downloading symfony/process (v6.0.7)
  - Downloading symfony/polyfill-mbstring (v1.25.0)
  - Downloading symfony/polyfill-intl-normalizer (v1.25.0)
  - Downloading symfony/polyfill-intl-grapheme (v1.25.0)
  - Downloading symfony/polyfill-ctype (v1.25.0)
  - Downloading symfony/string (v6.0.3)
  - Downloading psr/container (2.0.2)
  - Downloading symfony/service-contracts (v3.0.0)
  - Downloading symfony/console (v6.0.7)
  - Downloading laravel/installer (v4.2.10)
  - Installing symfony/process (v6.0.7): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.25.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.25.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.25.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.25.0): Extracting archive
  - Installing symfony/string (v6.0.3): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing symfony/service-contracts (v3.0.0): Extracting archive
  - Installing symfony/console (v6.0.7): Extracting archive
  - Installing laravel/installer (v4.2.10): Extracting archive
Generating autoload files
8 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Composer downloads the Laravel and other libraries in ~/.config/composer/vendor/bin directory.

Therefore, to make laravel command executable from anywhere, you need to include this location in PATH variable.

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

Execute .bash_profile once to load these changes.

# source .bash_profile

Now, execute following command to get Laravel version.

# laravel -V
Laravel Installer 4.2.10

 

Create a New Laravel Project:

Go to your home directory and create a new Laravel project as follows.

# cd
# laravel new helloworld

 _                               _
| |                             | |
| |     __ _ _ __ __ ___   _____| |
| |    / _` | '__/ _` \ \ / / _ \ |
| |___| (_| | | | (_| |\ V /  __/ |
|______\__,_|_|  \__,_| \_/ \___|_|

Creating a "laravel/laravel" project at "./helloworld"
Installing laravel/laravel (v9.1.3)
  - Downloading laravel/laravel (v9.1.3)
  - Installing laravel/laravel (v9.1.3): Extracting archive
Created project in /root/helloworld
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Lock file operations: 108 installs, 0 updates, 0 removals
  - Locking brick/math (0.9.3)
  - Locking dflydev/dot-access-data (v3.0.1)
  - Locking doctrine/inflector (2.0.4)
  - Locking doctrine/instantiator (1.4.1)
  - Locking doctrine/lexer (1.2.3)
  - Locking dragonmantank/cron-expression (v3.3.1)
  - Locking egulias/email-validator (3.1.2)
  - Locking facade/ignition-contracts (1.0.2)
  - Locking fakerphp/faker (v1.19.0)
  - Locking filp/whoops (2.14.5)
  - Locking fruitcake/php-cors (v1.2.0)
  - Locking graham-campbell/result-type (v1.0.4)
  - Locking guzzlehttp/guzzle (7.4.2)
  - Locking guzzlehttp/promises (1.5.1)
  - Locking guzzlehttp/psr7 (2.2.1)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v9.6.0)
  - Locking laravel/sail (v1.13.8)
  - Locking laravel/sanctum (v2.15.0)
  - Locking laravel/serializable-closure (v1.1.1)
  - Locking laravel/tinker (v2.7.2)
  - Locking league/commonmark (2.2.3)
  - Locking league/config (v1.1.1)
  - Locking league/flysystem (3.0.13)
  - Locking league/mime-type-detection (1.9.0)
  - Locking mockery/mockery (1.5.0)
  - Locking monolog/monolog (2.4.0)
  - Locking myclabs/deep-copy (1.11.0)
  - Locking nesbot/carbon (2.57.0)
  - Locking nette/schema (v1.2.2)
  - Locking nette/utils (v3.2.7)
  - Locking nikic/php-parser (v4.13.2)
  - Locking nunomaduro/collision (v6.1.0)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.3.0)
  - Locking phpdocumentor/type-resolver (1.6.1)
  - Locking phpoption/phpoption (1.8.1)
  - Locking phpspec/prophecy (v1.15.0)
  - Locking phpunit/php-code-coverage (9.2.15)
  - Locking phpunit/php-file-iterator (3.0.6)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.5.20)
  - Locking psr/container (2.0.2)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (3.0.0)
  - Locking psr/simple-cache (3.0.0)
  - Locking psy/psysh (v0.11.2)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (1.2.2)
  - Locking ramsey/uuid (4.3.1)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.6)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.3)
  - Locking sebastian/exporter (4.0.4)
  - Locking sebastian/global-state (5.0.5)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (3.0.0)
  - Locking sebastian/version (3.0.2)
  - Locking spatie/backtrace (1.2.1)
  - Locking spatie/flare-client-php (1.1.0)
  - Locking spatie/ignition (1.2.7)
  - Locking spatie/laravel-ignition (1.2.0)
  - Locking symfony/console (v6.0.7)
  - Locking symfony/css-selector (v6.0.3)
  - Locking symfony/deprecation-contracts (v3.0.0)
  - Locking symfony/error-handler (v6.0.7)
  - Locking symfony/event-dispatcher (v6.0.3)
  - Locking symfony/event-dispatcher-contracts (v3.0.0)
  - Locking symfony/finder (v6.0.3)
  - Locking symfony/http-foundation (v6.0.7)
  - Locking symfony/http-kernel (v6.0.7)
  - Locking symfony/mailer (v6.0.7)
  - Locking symfony/mime (v6.0.7)
  - Locking symfony/polyfill-ctype (v1.25.0)
  - Locking symfony/polyfill-intl-grapheme (v1.25.0)
  - Locking symfony/polyfill-intl-idn (v1.25.0)
  - Locking symfony/polyfill-intl-normalizer (v1.25.0)
  - Locking symfony/polyfill-mbstring (v1.25.0)
  - Locking symfony/polyfill-php72 (v1.25.0)
  - Locking symfony/polyfill-php80 (v1.25.0)
  - Locking symfony/polyfill-php81 (v1.25.0)
  - Locking symfony/process (v6.0.7)
  - Locking symfony/routing (v6.0.5)
  - Locking symfony/service-contracts (v3.0.0)
  - Locking symfony/string (v6.0.3)
  - Locking symfony/translation (v6.0.7)
  - Locking symfony/translation-contracts (v3.0.0)
  - Locking symfony/var-dumper (v6.0.6)
  - Locking theseer/tokenizer (1.2.1)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.4)
  - Locking vlucas/phpdotenv (v5.4.1)
  - Locking voku/portable-ascii (2.0.1)
  - Locking webmozart/assert (1.10.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 108 installs, 0 updates, 0 removals
  - Downloading doctrine/inflector (2.0.4)
  - Downloading doctrine/lexer (1.2.3)
  - Downloading webmozart/assert (1.10.0)
  - Downloading dragonmantank/cron-expression (v3.3.1)
  - Downloading symfony/deprecation-contracts (v3.0.0)
  - Downloading fakerphp/faker (v1.19.0)
  - Downloading symfony/http-foundation (v6.0.7)
  - Downloading fruitcake/php-cors (v1.2.0)
  - Downloading psr/http-message (1.0.1)
  - Downloading psr/http-client (1.0.1)
  - Downloading ralouphie/getallheaders (3.0.3)
  - Downloading psr/http-factory (1.0.1)
  - Downloading guzzlehttp/psr7 (2.2.1)
  - Downloading guzzlehttp/promises (1.5.1)
  - Downloading guzzlehttp/guzzle (7.4.2)
  - Downloading voku/portable-ascii (2.0.1)
  - Downloading symfony/polyfill-php80 (v1.25.0)
  - Downloading phpoption/phpoption (1.8.1)
  - Downloading graham-campbell/result-type (v1.0.4)
  - Downloading vlucas/phpdotenv (v5.4.1)
  - Downloading symfony/css-selector (v6.0.3)
  - Downloading tijsverkoyen/css-to-inline-styles (2.2.4)
  - Downloading symfony/var-dumper (v6.0.6)
  - Downloading symfony/routing (v6.0.5)
  - Downloading symfony/polyfill-php72 (v1.25.0)
  - Downloading symfony/polyfill-intl-idn (v1.25.0)
  - Downloading symfony/mime (v6.0.7)
  - Downloading psr/event-dispatcher (1.0.0)
  - Downloading symfony/event-dispatcher-contracts (v3.0.0)
  - Downloading symfony/event-dispatcher (v6.0.3)
  - Downloading psr/log (3.0.0)
  - Downloading egulias/email-validator (3.1.2)
  - Downloading symfony/mailer (v6.0.7)
  - Downloading symfony/error-handler (v6.0.7)
  - Downloading symfony/http-kernel (v6.0.7)
  - Downloading symfony/finder (v6.0.3)
  - Downloading symfony/polyfill-php81 (v1.25.0)
  - Downloading ramsey/collection (1.2.2)
  - Downloading brick/math (0.9.3)
  - Downloading ramsey/uuid (4.3.1)
  - Downloading psr/simple-cache (3.0.0)
  - Downloading symfony/translation-contracts (v3.0.0)
  - Downloading symfony/translation (v6.0.7)
  - Downloading nesbot/carbon (2.57.0)
  - Downloading monolog/monolog (2.4.0)
  - Downloading league/mime-type-detection (1.9.0)
  - Downloading league/flysystem (3.0.13)
  - Downloading nette/utils (v3.2.7)
  - Downloading nette/schema (v1.2.2)
  - Downloading dflydev/dot-access-data (v3.0.1)
  - Downloading league/config (v1.1.1)
  - Downloading league/commonmark (2.2.3)
  - Downloading laravel/serializable-closure (v1.1.1)
  - Downloading laravel/framework (v9.6.0)
  - Downloading laravel/sail (v1.13.8)
  - Downloading laravel/sanctum (v2.15.0)
  - Downloading nikic/php-parser (v4.13.2)
  - Downloading psy/psysh (v0.11.2)
  - Downloading laravel/tinker (v2.7.2)
  - Downloading hamcrest/hamcrest-php (v2.0.1)
  - Downloading mockery/mockery (1.5.0)
  - Downloading filp/whoops (2.14.5)
  - Downloading facade/ignition-contracts (1.0.2)
  - Downloading nunomaduro/collision (v6.1.0)
  - Downloading phpdocumentor/reflection-common (2.2.0)
  - Downloading phpdocumentor/type-resolver (1.6.1)
  - Downloading phpdocumentor/reflection-docblock (5.3.0)
  - Downloading sebastian/version (3.0.2)
  - Downloading sebastian/type (3.0.0)
  - Downloading sebastian/resource-operations (3.0.3)
  - Downloading sebastian/recursion-context (4.0.4)
  - Downloading sebastian/object-reflector (2.0.4)
  - Downloading sebastian/object-enumerator (4.0.4)
  - Downloading sebastian/global-state (5.0.5)
  - Downloading sebastian/exporter (4.0.4)
  - Downloading sebastian/environment (5.1.3)
  - Downloading sebastian/diff (4.0.4)
  - Downloading sebastian/comparator (4.0.6)
  - Downloading sebastian/code-unit (1.0.8)
  - Downloading sebastian/cli-parser (1.0.1)
  - Downloading phpunit/php-timer (5.0.3)
  - Downloading phpunit/php-text-template (2.0.4)
  - Downloading phpunit/php-invoker (3.1.1)
  - Downloading phpunit/php-file-iterator (3.0.6)
  - Downloading theseer/tokenizer (1.2.1)
  - Downloading sebastian/lines-of-code (1.0.3)
  - Downloading sebastian/complexity (2.0.2)
  - Downloading sebastian/code-unit-reverse-lookup (2.0.3)
  - Downloading phpunit/php-code-coverage (9.2.15)
  - Downloading doctrine/instantiator (1.4.1)
  - Downloading phpspec/prophecy (v1.15.0)
  - Downloading phar-io/version (3.2.1)
  - Downloading phar-io/manifest (2.0.3)
  - Downloading myclabs/deep-copy (1.11.0)
  - Downloading phpunit/phpunit (9.5.20)
  - Downloading spatie/backtrace (1.2.1)
  - Downloading spatie/flare-client-php (1.1.0)
  - Downloading spatie/ignition (1.2.7)
  - Downloading spatie/laravel-ignition (1.2.0)
  - Installing doctrine/inflector (2.0.4): Extracting archive
  - Installing doctrine/lexer (1.2.3): Extracting archive
  - Installing symfony/polyfill-ctype (v1.25.0): Extracting archive
  - Installing webmozart/assert (1.10.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.3.1): Extracting archive
  - Installing symfony/deprecation-contracts (v3.0.0): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing fakerphp/faker (v1.19.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.25.0): Extracting archive
  - Installing symfony/http-foundation (v6.0.7): Extracting archive
  - Installing fruitcake/php-cors (v1.2.0): Extracting archive
  - Installing psr/http-message (1.0.1): Extracting archive
  - Installing psr/http-client (1.0.1): Extracting archive
  - Installing ralouphie/getallheaders (3.0.3): Extracting archive
  - Installing psr/http-factory (1.0.1): Extracting archive
  - Installing guzzlehttp/psr7 (2.2.1): Extracting archive
  - Installing guzzlehttp/promises (1.5.1): Extracting archive
  - Installing guzzlehttp/guzzle (7.4.2): Extracting archive
  - Installing voku/portable-ascii (2.0.1): Extracting archive
  - Installing symfony/polyfill-php80 (v1.25.0): Extracting archive
  - Installing phpoption/phpoption (1.8.1): Extracting archive
  - Installing graham-campbell/result-type (v1.0.4): Extracting archive
  - Installing vlucas/phpdotenv (v5.4.1): Extracting archive
  - Installing symfony/css-selector (v6.0.3): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (2.2.4): Extracting archive
  - Installing symfony/var-dumper (v6.0.6): Extracting archive
  - Installing symfony/routing (v6.0.5): Extracting archive
  - Installing symfony/process (v6.0.7): Extracting archive
  - Installing symfony/polyfill-php72 (v1.25.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.25.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.25.0): Extracting archive
  - Installing symfony/mime (v6.0.7): Extracting archive
  - Installing symfony/service-contracts (v3.0.0): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v3.0.0): Extracting archive
  - Installing symfony/event-dispatcher (v6.0.3): Extracting archive
  - Installing psr/log (3.0.0): Extracting archive
  - Installing egulias/email-validator (3.1.2): Extracting archive
  - Installing symfony/mailer (v6.0.7): Extracting archive
  - Installing symfony/error-handler (v6.0.7): Extracting archive
  - Installing symfony/http-kernel (v6.0.7): Extracting archive
  - Installing symfony/finder (v6.0.3): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.25.0): Extracting archive
  - Installing symfony/string (v6.0.3): Extracting archive
  - Installing symfony/console (v6.0.7): Extracting archive
  - Installing symfony/polyfill-php81 (v1.25.0): Extracting archive
  - Installing ramsey/collection (1.2.2): Extracting archive
  - Installing brick/math (0.9.3): Extracting archive
  - Installing ramsey/uuid (4.3.1): Extracting archive
  - Installing psr/simple-cache (3.0.0): Extracting archive
  - Installing symfony/translation-contracts (v3.0.0): Extracting archive
  - Installing symfony/translation (v6.0.7): Extracting archive
  - Installing nesbot/carbon (2.57.0): Extracting archive
  - Installing monolog/monolog (2.4.0): Extracting archive
  - Installing league/mime-type-detection (1.9.0): Extracting archive
  - Installing league/flysystem (3.0.13): Extracting archive
  - Installing nette/utils (v3.2.7): Extracting archive
  - Installing nette/schema (v1.2.2): Extracting archive
  - Installing dflydev/dot-access-data (v3.0.1): Extracting archive
  - Installing league/config (v1.1.1): Extracting archive
  - Installing league/commonmark (2.2.3): Extracting archive
  - Installing laravel/serializable-closure (v1.1.1): Extracting archive
  - Installing laravel/framework (v9.6.0): Extracting archive
  - Installing laravel/sail (v1.13.8): Extracting archive
  - Installing laravel/sanctum (v2.15.0): Extracting archive
  - Installing nikic/php-parser (v4.13.2): Extracting archive
  - Installing psy/psysh (v0.11.2): Extracting archive
  - Installing laravel/tinker (v2.7.2): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
  - Installing mockery/mockery (1.5.0): Extracting archive
  - Installing filp/whoops (2.14.5): Extracting archive
  - Installing facade/ignition-contracts (1.0.2): Extracting archive
  - Installing nunomaduro/collision (v6.1.0): Extracting archive
  - Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
  - Installing phpdocumentor/type-resolver (1.6.1): Extracting archive
  - Installing phpdocumentor/reflection-docblock (5.3.0): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (3.0.0): Extracting archive
  - Installing sebastian/resource-operations (3.0.3): Extracting archive
  - Installing sebastian/recursion-context (4.0.4): Extracting archive
  - Installing sebastian/object-reflector (2.0.4): Extracting archive
  - Installing sebastian/object-enumerator (4.0.4): Extracting archive
  - Installing sebastian/global-state (5.0.5): Extracting archive
  - Installing sebastian/exporter (4.0.4): Extracting archive
  - Installing sebastian/environment (5.1.3): Extracting archive
  - Installing sebastian/diff (4.0.4): Extracting archive
  - Installing sebastian/comparator (4.0.6): Extracting archive
  - Installing sebastian/code-unit (1.0.8): Extracting archive
  - Installing sebastian/cli-parser (1.0.1): Extracting archive
  - Installing phpunit/php-timer (5.0.3): Extracting archive
  - Installing phpunit/php-text-template (2.0.4): Extracting archive
  - Installing phpunit/php-invoker (3.1.1): Extracting archive
  - Installing phpunit/php-file-iterator (3.0.6): Extracting archive
  - Installing theseer/tokenizer (1.2.1): Extracting archive
  - Installing sebastian/lines-of-code (1.0.3): Extracting archive
  - Installing sebastian/complexity (2.0.2): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (2.0.3): Extracting archive
  - Installing phpunit/php-code-coverage (9.2.15): Extracting archive
  - Installing doctrine/instantiator (1.4.1): Extracting archive
  - Installing phpspec/prophecy (v1.15.0): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.11.0): Extracting archive
  - Installing phpunit/phpunit (9.5.20): Extracting archive
  - Installing spatie/backtrace (1.2.1): Extracting archive
  - Installing spatie/flare-client-php (1.1.0): Extracting archive
  - Installing spatie/ignition (1.2.7): Extracting archive
  - Installing spatie/laravel-ignition (1.2.0): Extracting archive
71 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: laravel/sail
Discovered Package: laravel/sanctum
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: spatie/laravel-ignition
Package manifest generated successfully.
78 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> @php artisan vendor:publish --tag=laravel-assets --ansi --force
No publishable resources for tag [laravel-assets].
Publishing complete.
> @php artisan key:generate --ansi
Application key set successfully.

Application ready! Build something amazing.

You have successfully create a new Laravel project.

Typically, you may use a web server such as Apache or Nginx to serve your Laravel applications. If you are on PHP 5.4+ and would like to use PHP's built-in development server, you may use the serve Artisan command.

Artisan is the command line interface included with Laravel. Artisan exists at the root of your application as the artisan script and provides a number of helpful commands that can assist you while you build your application.

Execute the following command to start Laravel development server.

# php artisan serve --host=laravel-01.centlinux.com &
[1] 5727
Starting Laravel development server: http://laravel-01.centlinux.com:8000
[Sat Apr  2 22:20:46 2022] PHP 8.1.4 Development Server (http://laravel-01.centlinux.com:8000) started

 

Configure Linux Firewall:

Artisan default service port is 8000/tcp. Therefore, you need to allow it in Linux Firewall.

# firewall-cmd --permanent --add-port=8000/tcp
success
# firewall-cmd --reload
success

Open URL: http://laravel-01.centlinux.com:8000/ in a web browser.

php-laravel-default-homepage

Your Laravel application server has been started successfully.

Read Also: How to install PHP Laravel Framework on Rocky Linux 9 


Conclusion:

In this article, you have learned how to install PHP Laravel Framework on Rocky Linux 8 or other RPM based distros. To start building some amazing application, you may read Laravel: Up & Running: A Framework for Building Modern PHP Apps 2nd Edition by Matt Stauffer.

If you find this article useful? Consider supporting us by Buy Me A Coffee


© 2023 CentLinux. All Rights Reserved.