How to install Laravel on Rocky Linux 9

Share on Social Media

Learn how to install Laravel on Rocky Linux 9 with our step-by-step guide. Dive into the world of modern web development and harness the power of this popular PHP framework to build scalable and feature-rich web applications. #centlinux #linux #laravel

YouTube player

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.

What is Laravel used for?

Laravel is a powerful and popular PHP framework used for building web applications. It offers a wide range of features and capabilities that make web development faster, more efficient, and more enjoyable. Here are some common uses of Laravel:

  1. Web Application Development: Laravel framework is primarily used for building web applications of all sizes and complexities. It provides a robust set of tools, including routing, middleware, controllers, views, and authentication, that streamline the development process and allow developers to focus on building features rather than boilerplate code.
  2. API Development: Laravel framework can be used for building RESTful APIs (Application Programming Interfaces) to provide data and functionality to other applications or services. Laravel’s built-in support for API authentication, resource controllers, and response formatting makes it well-suited for developing backend APIs.
  3. Content Management Systems (CMS): Laravel framework can be used as the foundation for building custom content management systems (CMS) and blogging platforms. Developers can leverage Laravel’s flexible routing, templating, and database management features to create custom CMS solutions tailored to specific requirements.
  4. E-commerce Platforms: Laravel framework can power e-commerce platforms and online stores, either through custom development or by using Laravel-based e-commerce packages and extensions. Laravel’s robustness, security features, and integration capabilities make it suitable for building scalable and secure e-commerce applications.
  5. Enterprise Applications: Laravel framework can be used for building enterprise-level applications, such as customer relationship management (CRM) systems, project management tools, and internal business applications. Laravel’s modular architecture, testing support, and extensibility make it well-suited for developing complex and scalable enterprise solutions.
  6. Real-Time Applications: Laravel framework can be used in conjunction with technologies like WebSockets and event broadcasting to build real-time applications, such as chat applications, live dashboards, and collaborative tools. Laravel’s event-driven architecture and support for real-time communication make it suitable for building reactive and interactive applications.

Overall, PHP Laravel is a versatile framework that can be used for a wide range of web development projects, from simple websites and blogs to complex enterprise applications and APIs. Its expressive syntax, rich feature set, and active community make it a popular choice among developers for building modern and scalable web applications.

Recommended Online Training: Laravel Blog Mastery: Build Your Stunning Blog in 1 Hour

4572484 ee18 7show?id=oLRJ54lcVEg&offerid=1074652.4572484&bids=1074652

Environment Specification:

We are using a minimally installed Rocky Linux 9 virtual machine with following specifications.

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

Prepare your Linux Server

Connect with your Rocky Linux server as root user by using a SSH client software.

Set a Fully Qualified Domain Name (FQDN) for your Linux server by executing hostnamectl command.

# hostnamectl set-hostname laravel-01.centlinux.com

Edit /etc/hosts file by using vim text editor.

# vi /etc/hosts

Add following line in this file to setup name resolution for your server.

192.168.116.131 laravel-01 laravel-01.centlinux.com

Rebuild your cache for enabled yum repositories.

# dnf makecache

Execute following command to update software packages in your Linux operating system.

# dnf update -y

Sometimes, above command also updates your Linux Kernel. In such scenario, you should reboot your Linux operating system with newly installed Kernel.

# reboot

You may also need git and unzip commands during installation of PHP Composer, therefore, it is better to install them now.

# dnf install -y git unzip

Confirm the Linux Kernel and operating system versions that are being used in this tutorial.

# cat /etc/rocky-release
Rocky Linux release 9.1 (Blue Onyx)

# uname -r
5.14.0-162.6.1.el9_1.0.1.x86_64

Install PHP on Rocky Linux 9

In Rocky Linux 9, PHP 8.1 is available via standard yum repositories. Therefore, you can easily install it by using dnf command and there is no need to install EPEL or REMI yum repositories.

Check the available versions of PHP module in yum repository.

# dnf module list php
Last metadata expiration check: 0:06:23 ago on Mon 26 Dec 2022 07:31:44 AM CST.
Rocky Linux 9 - AppStream
Name      Stream      Profiles                        Summary
php       8.1         common [d], devel, minimal      PHP scripting language

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

Install PHP module by executing following command at Linux bash prompt.

# dnf module install -y php
...
Installed:
  httpd-filesystem-2.4.53-7.el9.noarch
  libxslt-1.1.34-9.el9.x86_64
  nginx-filesystem-1:1.20.1-13.el9.noarch
  oniguruma-6.9.6-1.el9.5.x86_64
  php-cli-8.1.8-1.module+el9.1.0+13171+4883e0c8.x86_64
  php-common-8.1.8-1.module+el9.1.0+13171+4883e0c8.x86_64
  php-fpm-8.1.8-1.module+el9.1.0+13171+4883e0c8.x86_64
  php-mbstring-8.1.8-1.module+el9.1.0+13171+4883e0c8.x86_64
  php-xml-8.1.8-1.module+el9.1.0+13171+4883e0c8.x86_64

Complete!

Install PHP Composer on Rocky Linux 9

You may need PHP Composer to install Laravel Framework.

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.5.1) 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

Execute following command now, to check the PHP Composer version.

# composer -V
Composer version 2.5.1 2022-12-22 15:33:54

How to install Laravel on Rocky Linux 9

Now you can download and install Laravel Framework and dependent libraries by using composer command.

# composer global require "laravel/installer"
Changed current directory to /root/.config/composer
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been created
Running composer update laravel/installer
Loading composer repositories with package information
Updating dependencies
Lock file operations: 11 installs, 0 updates, 0 removals
  - Locking laravel/installer (v4.2.17)
  - Locking psr/container (2.0.2)
  - Locking symfony/console (v6.2.2)
  - Locking symfony/deprecation-contracts (v3.2.0)
  - Locking symfony/polyfill-ctype (v1.27.0)
  - Locking symfony/polyfill-intl-grapheme (v1.27.0)
  - Locking symfony/polyfill-intl-normalizer (v1.27.0)
  - Locking symfony/polyfill-mbstring (v1.27.0)
  - Locking symfony/process (v6.2.0)
  - Locking symfony/service-contracts (v3.2.0)
  - Locking symfony/string (v6.2.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 11 installs, 0 updates, 0 removals
  - Downloading symfony/process (v6.2.0)
  - Downloading symfony/polyfill-mbstring (v1.27.0)
  - Downloading symfony/polyfill-intl-normalizer (v1.27.0)
  - Downloading symfony/polyfill-intl-grapheme (v1.27.0)
  - Downloading symfony/polyfill-ctype (v1.27.0)
  - Downloading symfony/string (v6.2.2)
  - Downloading psr/container (2.0.2)
  - Downloading symfony/service-contracts (v3.2.0)
  - Downloading symfony/deprecation-contracts (v3.2.0)
  - Downloading symfony/console (v6.2.2)
  - Downloading laravel/installer (v4.2.17)
  - Installing symfony/process (v6.2.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.27.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.27.0): Extracting archive
  - Installing symfony/string (v6.2.2): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing symfony/service-contracts (v3.2.0): Extracting archive
  - Installing symfony/deprecation-contracts (v3.2.0): Extracting archive
  - Installing symfony/console (v6.2.2): Extracting archive
  - Installing laravel/installer (v4.2.17): Extracting archive
6 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
Using version ^4.2 for laravel/installer

Composer downloads the Laravel framework 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

Laravel Example: HelloWorld

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

# laravel new helloworld

   _                               _
  | |                             | |
  | |     __ _ _ __ __ ___   _____| |
  | |    / _` | '__/ _`   / / _  |
  | |___| (_| | | | (_| | V /  __/ |
  |________,_|_|  __,_| _/ ___|_|

Creating a "laravel/laravel" project at "./helloworld"
Installing laravel/laravel (v9.4.1)
  - Downloading laravel/laravel (v9.4.1)
  - Installing laravel/laravel (v9.4.1): 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: 107 installs, 0 updates, 0 removals
  - Locking brick/math (0.10.2)
  - Locking dflydev/dot-access-data (v3.0.2)
  - Locking doctrine/inflector (2.0.6)
  - Locking doctrine/instantiator (1.4.1)
  - Locking doctrine/lexer (1.2.3)
  - Locking dragonmantank/cron-expression (v3.3.2)
  - Locking egulias/email-validator (3.2.1)
  - Locking fakerphp/faker (v1.21.0)
  - Locking filp/whoops (2.14.6)
  - Locking fruitcake/php-cors (v1.2.0)
  - Locking graham-campbell/result-type (v1.1.0)
  - Locking guzzlehttp/guzzle (7.5.0)
  - Locking guzzlehttp/promises (1.5.2)
  - Locking guzzlehttp/psr7 (2.4.3)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking laravel/framework (v9.45.1)
  - Locking laravel/pint (v1.3.0)
  - Locking laravel/sail (v1.16.6)
  - Locking laravel/sanctum (v3.0.1)
  - Locking laravel/serializable-closure (v1.2.2)
  - Locking laravel/tinker (v2.7.3)
  - Locking league/commonmark (2.3.8)
  - Locking league/config (v1.2.0)
  - Locking league/flysystem (3.12.0)
  - Locking league/mime-type-detection (1.11.0)
  - Locking mockery/mockery (1.5.1)
  - Locking monolog/monolog (2.8.0)
  - Locking myclabs/deep-copy (1.11.0)
  - Locking nesbot/carbon (2.64.0)
  - Locking nette/schema (v1.2.3)
  - Locking nette/utils (v3.2.8)
  - Locking nikic/php-parser (v4.15.2)
  - Locking nunomaduro/collision (v6.3.2)
  - Locking nunomaduro/termwind (v1.15.0)
  - Locking phar-io/manifest (2.0.3)
  - Locking phar-io/version (3.2.1)
  - Locking phpoption/phpoption (1.9.0)
  - Locking phpunit/php-code-coverage (9.2.22)
  - 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.27)
  - 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.10)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/collection (1.2.2)
  - Locking ramsey/uuid (4.7.0)
  - 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.8)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.4)
  - Locking sebastian/exporter (4.0.5)
  - 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.2.0)
  - Locking sebastian/version (3.0.2)
  - Locking spatie/backtrace (1.2.1)
  - Locking spatie/flare-client-php (1.3.1)
  - Locking spatie/ignition (1.4.1)
  - Locking spatie/laravel-ignition (1.6.2)
  - Locking symfony/console (v6.2.2)
  - Locking symfony/css-selector (v6.2.0)
  - Locking symfony/deprecation-contracts (v3.2.0)
  - Locking symfony/error-handler (v6.2.2)
  - Locking symfony/event-dispatcher (v6.2.2)
  - Locking symfony/event-dispatcher-contracts (v3.2.0)
  - Locking symfony/finder (v6.2.0)
  - Locking symfony/http-foundation (v6.2.2)
  - Locking symfony/http-kernel (v6.2.2)
  - Locking symfony/mailer (v6.2.2)
  - Locking symfony/mime (v6.2.2)
  - Locking symfony/polyfill-ctype (v1.27.0)
  - Locking symfony/polyfill-intl-grapheme (v1.27.0)
  - Locking symfony/polyfill-intl-idn (v1.27.0)
  - Locking symfony/polyfill-intl-normalizer (v1.27.0)
  - Locking symfony/polyfill-mbstring (v1.27.0)
  - Locking symfony/polyfill-php72 (v1.27.0)
  - Locking symfony/polyfill-php80 (v1.27.0)
  - Locking symfony/polyfill-php81 (v1.27.0)
  - Locking symfony/polyfill-uuid (v1.27.0)
  - Locking symfony/process (v6.2.0)
  - Locking symfony/routing (v6.2.0)
  - Locking symfony/service-contracts (v3.2.0)
  - Locking symfony/string (v6.2.2)
  - Locking symfony/translation (v6.2.2)
  - Locking symfony/translation-contracts (v3.2.0)
  - Locking symfony/uid (v6.2.0)
  - Locking symfony/var-dumper (v6.2.2)
  - Locking theseer/tokenizer (1.2.1)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.5)
  - Locking vlucas/phpdotenv (v5.5.0)
  - Locking voku/portable-ascii (2.0.1)
  - Locking webmozart/assert (1.11.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 107 installs, 0 updates, 0 removals
  - Downloading doctrine/inflector (2.0.6)
  - Downloading doctrine/lexer (1.2.3)
  - Downloading webmozart/assert (1.11.0)
  - Downloading dragonmantank/cron-expression (v3.3.2)
  - Downloading fakerphp/faker (v1.21.0)
  - Downloading symfony/http-foundation (v6.2.2)
  - 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.4.3)
  - Downloading guzzlehttp/promises (1.5.2)
  - Downloading guzzlehttp/guzzle (7.5.0)
  - Downloading laravel/pint (v1.3.0)
  - Downloading voku/portable-ascii (2.0.1)
  - Downloading symfony/polyfill-php80 (v1.27.0)
  - Downloading phpoption/phpoption (1.9.0)
  - Downloading graham-campbell/result-type (v1.1.0)
  - Downloading vlucas/phpdotenv (v5.5.0)
  - Downloading symfony/css-selector (v6.2.0)
  - Downloading tijsverkoyen/css-to-inline-styles (2.2.5)
  - Downloading symfony/var-dumper (v6.2.2)
  - Downloading symfony/polyfill-uuid (v1.27.0)
  - Downloading symfony/uid (v6.2.0)
  - Downloading symfony/routing (v6.2.0)
  - Downloading symfony/polyfill-php72 (v1.27.0)
  - Downloading symfony/polyfill-intl-idn (v1.27.0)
  - Downloading symfony/mime (v6.2.2)
  - Downloading psr/event-dispatcher (1.0.0)
  - Downloading symfony/event-dispatcher-contracts (v3.2.0)
  - Downloading symfony/event-dispatcher (v6.2.2)
  - Downloading psr/log (3.0.0)
  - Downloading egulias/email-validator (3.2.1)
  - Downloading symfony/mailer (v6.2.2)
  - Downloading symfony/error-handler (v6.2.2)
  - Downloading symfony/http-kernel (v6.2.2)
  - Downloading symfony/finder (v6.2.0)
  - Downloading symfony/polyfill-php81 (v1.27.0)
  - Downloading ramsey/collection (1.2.2)
  - Downloading brick/math (0.10.2)
  - Downloading ramsey/uuid (4.7.0)
  - Downloading psr/simple-cache (3.0.0)
  - Downloading nunomaduro/termwind (v1.15.0)
  - Downloading symfony/translation-contracts (v3.2.0)
  - Downloading symfony/translation (v6.2.2)
  - Downloading nesbot/carbon (2.64.0)
  - Downloading monolog/monolog (2.8.0)
  - Downloading league/mime-type-detection (1.11.0)
  - Downloading league/flysystem (3.12.0)
  - Downloading nette/utils (v3.2.8)
  - Downloading nette/schema (v1.2.3)
  - Downloading dflydev/dot-access-data (v3.0.2)
  - Downloading league/config (v1.2.0)
  - Downloading league/commonmark (2.3.8)
  - Downloading laravel/serializable-closure (v1.2.2)
  - Downloading laravel/framework (v9.45.1)
  - Downloading laravel/sail (v1.16.6)
  - Downloading laravel/sanctum (v3.0.1)
  - Downloading nikic/php-parser (v4.15.2)
  - Downloading psy/psysh (v0.11.10)
  - Downloading laravel/tinker (v2.7.3)
  - Downloading hamcrest/hamcrest-php (v2.0.1)
  - Downloading mockery/mockery (1.5.1)
  - Downloading filp/whoops (2.14.6)
  - Downloading nunomaduro/collision (v6.3.2)
  - Downloading sebastian/version (3.0.2)
  - Downloading sebastian/type (3.2.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.5)
  - Downloading sebastian/environment (5.1.4)
  - Downloading sebastian/diff (4.0.4)
  - Downloading sebastian/comparator (4.0.8)
  - 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.22)
  - Downloading phar-io/version (3.2.1)
  - Downloading phar-io/manifest (2.0.3)
  - Downloading myclabs/deep-copy (1.11.0)
  - Downloading doctrine/instantiator (1.4.1)
  - Downloading phpunit/phpunit (9.5.27)
  - Downloading spatie/backtrace (1.2.1)
  - Downloading spatie/flare-client-php (1.3.1)
  - Downloading spatie/ignition (1.4.1)
  - Downloading spatie/laravel-ignition (1.6.2)
  - Installing doctrine/inflector (2.0.6): Extracting archive
  - Installing doctrine/lexer (1.2.3): Extracting archive
  - Installing symfony/polyfill-ctype (v1.27.0): Extracting archive
  - Installing webmozart/assert (1.11.0): Extracting archive
  - Installing dragonmantank/cron-expression (v3.3.2): Extracting archive
  - Installing symfony/deprecation-contracts (v3.2.0): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing fakerphp/faker (v1.21.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.27.0): Extracting archive
  - Installing symfony/http-foundation (v6.2.2): 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.4.3): Extracting archive
  - Installing guzzlehttp/promises (1.5.2): Extracting archive
  - Installing guzzlehttp/guzzle (7.5.0): Extracting archive
  - Installing laravel/pint (v1.3.0): Extracting archive
  - Installing voku/portable-ascii (2.0.1): Extracting archive
  - Installing symfony/polyfill-php80 (v1.27.0): Extracting archive
  - Installing phpoption/phpoption (1.9.0): Extracting archive
  - Installing graham-campbell/result-type (v1.1.0): Extracting archive
  - Installing vlucas/phpdotenv (v5.5.0): Extracting archive
  - Installing symfony/css-selector (v6.2.0): Extracting archive
  - Installing tijsverkoyen/css-to-inline-styles (2.2.5): Extracting archive
  - Installing symfony/var-dumper (v6.2.2): Extracting archive
  - Installing symfony/polyfill-uuid (v1.27.0): Extracting archive
  - Installing symfony/uid (v6.2.0): Extracting archive
  - Installing symfony/routing (v6.2.0): Extracting archive
  - Installing symfony/process (v6.2.0): Extracting archive
  - Installing symfony/polyfill-php72 (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-normalizer (v1.27.0): Extracting archive
  - Installing symfony/polyfill-intl-idn (v1.27.0): Extracting archive
  - Installing symfony/mime (v6.2.2): Extracting archive
  - Installing symfony/service-contracts (v3.2.0): Extracting archive
  - Installing psr/event-dispatcher (1.0.0): Extracting archive
  - Installing symfony/event-dispatcher-contracts (v3.2.0): Extracting archive
  - Installing symfony/event-dispatcher (v6.2.2): Extracting archive
  - Installing psr/log (3.0.0): Extracting archive
  - Installing egulias/email-validator (3.2.1): Extracting archive
  - Installing symfony/mailer (v6.2.2): Extracting archive
  - Installing symfony/error-handler (v6.2.2): Extracting archive
  - Installing symfony/http-kernel (v6.2.2): Extracting archive
  - Installing symfony/finder (v6.2.0): Extracting archive
  - Installing symfony/polyfill-intl-grapheme (v1.27.0): Extracting archive
  - Installing symfony/string (v6.2.2): Extracting archive
  - Installing symfony/console (v6.2.2): Extracting archive
  - Installing symfony/polyfill-php81 (v1.27.0): Extracting archive
  - Installing ramsey/collection (1.2.2): Extracting archive
  - Installing brick/math (0.10.2): Extracting archive
  - Installing ramsey/uuid (4.7.0): Extracting archive
  - Installing psr/simple-cache (3.0.0): Extracting archive
  - Installing nunomaduro/termwind (v1.15.0): Extracting archive
  - Installing symfony/translation-contracts (v3.2.0): Extracting archive
  - Installing symfony/translation (v6.2.2): Extracting archive
  - Installing nesbot/carbon (2.64.0): Extracting archive
  - Installing monolog/monolog (2.8.0): Extracting archive
  - Installing league/mime-type-detection (1.11.0): Extracting archive
  - Installing league/flysystem (3.12.0): Extracting archive
  - Installing nette/utils (v3.2.8): Extracting archive
  - Installing nette/schema (v1.2.3): Extracting archive
  - Installing dflydev/dot-access-data (v3.0.2): Extracting archive
  - Installing league/config (v1.2.0): Extracting archive
  - Installing league/commonmark (2.3.8): Extracting archive
  - Installing laravel/serializable-closure (v1.2.2): Extracting archive
  - Installing laravel/framework (v9.45.1): Extracting archive
  - Installing laravel/sail (v1.16.6): Extracting archive
  - Installing laravel/sanctum (v3.0.1): Extracting archive
  - Installing nikic/php-parser (v4.15.2): Extracting archive
  - Installing psy/psysh (v0.11.10): Extracting archive
  - Installing laravel/tinker (v2.7.3): Extracting archive
  - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive
  - Installing mockery/mockery (1.5.1): Extracting archive
  - Installing filp/whoops (2.14.6): Extracting archive
  - Installing nunomaduro/collision (v6.3.2): Extracting archive
  - Installing sebastian/version (3.0.2): Extracting archive
  - Installing sebastian/type (3.2.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.5): Extracting archive
  - Installing sebastian/environment (5.1.4): Extracting archive
  - Installing sebastian/diff (4.0.4): Extracting archive
  - Installing sebastian/comparator (4.0.8): 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.22): 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 doctrine/instantiator (1.4.1): Extracting archive
  - Installing phpunit/phpunit (9.5.27): Extracting archive
  - Installing spatie/backtrace (1.2.1): Extracting archive
  - Installing spatie/flare-client-php (1.3.1): Extracting archive
  - Installing spatie/ignition (1.4.1): Extracting archive
  - Installing spatie/laravel-ignition (1.6.2): Extracting archive
70 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.

  laravel/sail .......................................................... DONE
  laravel/sanctum ....................................................... DONE
  laravel/tinker ........................................................ DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/collision .................................................. DONE
  nunomaduro/termwind ................................................... DONE
  spatie/laravel-ignition ............................................... DONE

81 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

   INFO  No publishable resources for tag [laravel-assets].

No security vulnerability advisories found
> @php artisan key:generate --ansi

   INFO  Application key set successfully.

   INFO  Application ready! Build something amazing.

You have successfully created 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 PHP Laravel framework. 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 following command to check version of your Laravel Framework.

# cd helloworld/
# php artisan --version
Laravel Framework 9.45.1

Execute the following command to start Laravel development server.

# php artisan serve --host=laravel-01.centlinux.com &
[1] 3571
INFO Server running on [http://laravel-01.centlinux.com:8000].

Press Ctrl+C to stop the server

Configure Linux Firewall

Artisan default service port is 8000/tcp. Therefore, you need to allow port in your 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
PHP Laravel Default Homepage

Your Laravel application server has been started successfully.

Read Also: How to install Laravel on Rocky Linux 8

Final Thoughts

Equip yourself with the skills to effortlessly install Laravel on Rocky Linux 9 with our comprehensive guide. Dive into the world of modern web development and unleash the power of this versatile PHP framework to bring your web application ideas to life. Let this tutorial be your starting point on the path to building scalable, secure, and feature-rich web applications. To start building some amazing application, you may read Laravel: Up & Running: A Framework for Building Modern PHP Apps 2nd Edition (PAID LINK) by Matt Stauffer.

Leave a Comment