Laravel 7 was released the other day. This time I’d like to install Laravel 7 in the environment of CentOS 8 and PHP 7.4.

Laravel 7 requirements

The following requirements must be met in order to install and operate Laravel 7.

  • PHP version7.2.5 or above
  • PHP extensions
    • BCMath
    • Ctype
    • Fileinfo
    • JSON
    • Mbstring
    • OpenSSL
    • PDO
    • Tokenizer
    • XML

We will install Laravel 7 after aligning these areas.

Install PHP 7.4

CentOS 8 starts with nothing basic (httpd OpenSSL unzip wget, etc.) installed, so first install PHP 7.4.

We will install it from the Remi repository.

Add EPEL repository

In order to install PHP 7.4 with Remi, we need an EPEL (Extra Packages for Enterprise Linux) repository, so we will install it first.

Add the EPEL repository by hitting the following command.

dnf -y install epel-release

Add Remi repository

Hit the following command to add the Remi repository.

dnf -y install

Confirm that dnf info shows PHP 7.4 package information.

# Confirm the package information of PHP 7.4
dnf info php74

# Execution result
[root@localhost /]# dnf info php74
Remi's Modular repository for Enterprise Linux 8 - x86_64
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64
Available Packages
Name         : php74
Version      : 1.0
Release      : 1.el8.remi
Architecture : x86_64
Size         : 6.6 k
Source       : php74-1.0-1.el8.remi.src.rpm
Repository   : remi-safe
Summary      : Package that installs PHP 7.4
License      : GPLv2+
Description  : This is the main package for php74 Software Collection,
             : that install PHP 7.4 language.

PHP 7.4 is now ready for installation.

# PHP 7.4 install 
dnf -y module install php: remi-7.4

Confirm the installation with the php command.

# PHP installation confirmation 
[root @ localhost /] # php -v
PHP 7.4.4 (cli)
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Now you have PHP 7.4 installed.

Install PHP extensions

When installing PHP 7.4, the minimum required extensions are installed, so install the extensions required for Laravel 7 to operate.

Hit the following command to see if you have the required extensions for Laravel 7 to work.

# Make sure you have installed the extensions needed to run Laravel 7
php -m | grep -e bcmath -e ctype -e fileinfo -e json -e mbstring -e openssl -e PDO -e tokenizer -e ^xml$

# Execution result
[root@localhost /]# php -m | grep -e bcmath -e ctype -e fileinfo -e json -e mbstring -e openssl -e PDO -e tokenizer -e ^xml$

Compared with the server requirements, it seems that BCMath is necessary for this environment.

Read also >>  Laravel Developer

The installed ones will be skipped, so this time I specified all the extensions required for Laravel 7, and made a command with some other things I want to put in, so I hit this. Please get rid of unnecessary things and add other necessary things.

# PHP extension installation 
dnf install -y php-bcmath php-mcrypt php-pdo php-xml php-tokenizer php-mysqlnd php-pecl-xdebug php-gd php-intl php-zip php-opcache

After the installation is complete, check again, and if BCMath is displayed, the required extensions have been installed.

[root@localhost /]# php -m | grep -e bcmath -e ctype -e fileinfo -e json -e mbstring -e openssl -e PDO -e tokenizer -e ^xml$

Install Composer

Next, install Composer to install Laravel. Install Composer by hitting the following commands in sequence.

# Download installer
wget -O composer-installer.php

# Install
php composer-installer.php --filename=composer --install-dir=/usr/local/bin

# Update
composer self-update

When you’re done, hit the composer command to get the usual one.

# composer version check 
[root @ localhost /] # composer -v 
  / ____ / ___ ____ ___ ____ ____ ________ _____ 
/ / / __ \ / __ `__ \ / __ \ / __ \ / ___ / _ \ / ___ / 
/ / ___ / / _ / / / / / / / / _ / / / _ / (__) __ / / 
\ ____ / \ ____ / _ / / _ / / _ / .___ / \ ____ / ____ / \ ___ / _ / 
                    / _ / 
Composer version 1.10.1 2020-04-24 14:10:27

This completes the Composer installation.

Laravel 7 installation

Now that you’re ready to install Laravel, it’s time to install Laravel 7.

As the official manual says, there are two ways to install Laravel. I will go with each.

Install from Laravel installer

If you want to use the Laravel installer, first install the installer with composer.

# Download Laravel installer 
composer global require laravel / installer

Once downloaded, pass the laravel new command so that you can hit it from anywhere.

The path will change depending on the environment. (Hereafter, quoted from the official document and

  • macOS: $ HOME / .composer / vendor / bin
  • Windows:% USERPROFILE% \ AppData \ Roaming \ Composer \ vendor \ bin
  • GNU / Linux distribution: $ HOME / .config / composer / vendor / bin or $ HOME / .composer / vendor / bin
Read also >>  Install Laravel in Docker container on Ubuntu for beginners 101

Since it is CentOS (Linux) this time, pass the path by the following procedure. Replace here depending on your environment.

Open the .bash_profile in the editor and add the path

# Open with editor
vi ~/.bash_profile

# Add this part "$HOME/.composer/vendor/bin"

Load .bash_profile with source command

# load .bash_profile 
source ~ / .bash_profile

After passing the path, move to the directory where you want to install Laravel and hit the laravel command.

# Format 
Laravel New [project_name]

Please give an arbitrary name to the [project_name] part. It will be the root directory name of laravel.

# laravel project creation 
laravel new my_laravel

If you hit the laravel command with the above feeling, the latest version of Laravel will be installed.

[me @ localhost my_laravel] # php artisan --version 
Laravel Framework 7.2.2

The Laravel 7 installation is now complete.

Install from Composer command

If you don’t want to pass the path or if you want to install the latest version, you can also use composer command.

# Format 
Composer Create-Project Laravel / Laravel --Prefer-Dist [project_name] [Version]

When installing the latest version, it is not necessary to specify the version. This time, hit the following to install.

# create laravel project from composer command 
composer create-project laravel / laravel --prefer-dist my_lara

Again, the latest version will be installed.

[me @ localhost my_lara] # php artisan --version 
Laravel Framework 7.2.2

This completes the Laravel 7 installation.

Other work

After installing Laravel, you need to make the following directories writable by the web server.

  • storage
  • bootstrap / cache

In other words, in a Linux environment like this time, set it as apache or nginx user.

chown -R apache: apache / path / to / laravel / storage 
chown -R apache: apache / path / to / laravel / bootstrap / cache

And apart from the work up to this point, prepare a DB and write that information to .env.

Then, after setting the webserver (apache or nginx) (appropriate document root or its side), you can check the operation of Laravel from the browser.

Read also >>  Mint Task Manager SaaS Version - Task Progress Tracking, User Rating & Analysis


This completes the work.

Laravel has been compliant with Semantic Versioning since 6, so the version will go up faster than 5.x.

I think that we will continue to evolve, so I would like to support as many new versions as possible and benefit from a safe and convenient FW.


Please enter your comment!
Please enter your name here