Steps to Install Laravel On CentOS 7

How To Install Laravel On CentOS 7

Laravel is one of the PHP language frameworks designed for web application development and works on an MVC basis. The Laravel Framework makes it easy to program PHP web applications and makes PHP projects easy to develop.

The Laravel framework is built on various components of the Symfony framework and gives your program a great base of reliable and tested code if you install Laravel.

Laravel provides a collection of the best solutions with meaningful and creative syntax that are done right. As a result, by simplifying common tasks such as authentication, routing, sessions, working with databases, etc.
Which is used in almost all web projects. Laravel reduces development problems for both the developer and the client. Laravel, Symphony, KickPh, and Igniter code are some of the most popular PHP language frameworks, which test their popularity on Google Trend, reflecting the growing growth of Laravel frameworks.

Laravel the best

Why Should We Learn And Use Laravel?

    • Easy to learn and update
    • Facilitate routine programming tasks such as authentication, routing, sessions, and caching
    • Quick and easy setup of multiple environments and relationships
    • Enjoying Remote Component
    • Limit Eloquent with simple commands
    • Improve speeds and increase speeds by 100%
    • Make the development process pleasant for developers without compromising program capabilities.
    • Use standard bundle style in earlier versions and use packages in the new version.
    • Run multiple unit tests with simple commands
    • Easy access to databases and ease of modifying and controlling code and updating and developing applications
    • Using Blade Templates Engine

Why Laravel

How To Install Laravel On CentOS 7

If you need the Laravel framework and do not know where to start, this article is for you, and you can learn Laravel step by step, but keep in mind that you must have a Linux VPS with a CentOS distribution. Installed. Because in this tutorial, we will teach Laravel on Santos 7.

If you do not have a Linux VPS server, I suggest you buy from OperaVPS so that if you encounter any problems during the installation process, our team can solve the problem for you.

From the link I mentioned below, you can buy a Linux VPS server and start the Laravel installation tutorial:



First of all, we need to add REMI and EPEL rpm repositories to the Centos system. These containers have updated packages.
Connect to VPS with Putty and run the below command:

rpm -Uvh


rpm -Uvh

Step 2 – Install Apache, MySQL, and PHP (LAMP)

Here is a brief guide to installing LAMP. You need to run the Laravel framework on your CentOS system.
Use this command to install Apache.

> A complete guide to Install LAMP on CentOS 7:

yum --enablerepo=remi,epel install httpd

To install MySQL, use the following commands:

yum --enablerepo=remi,epel install mysql-server


service mysqld start



To install PHP using the following command:

yum --enablerepo=remi,epel install php php-zip php-mysql php-mcrypt php-xml php-mbstring

Then restart the Apache:

service httpd restart

Step 3 – Install Composer

Composer is required to install Laravel, and one of Laravel’s prerequisites is to install.
You can install Composer using the following commands.

curl -sS | php


mv composer.phar /usr/bin/composer


chmod +x /usr/bin/composer

Step 4 – Install Laravel

You can install the latest version of Laurel using the following command.

cd /var/www


git clone

After entering the above command, use Composer to solve the Laravel prerequisite problem.

cd /var/www/laravel


composer install

The prerequisite installation is a bit long but wait until it’s fully installed and enter the following commands.

chown -R apache.apache /var/www/laravel


chmod -R 755 /var/www/laravel


chmod -R 755 /var/www/laravel/storage

Use the command to write to the storage directory.

chcon -R -t httpd_sys_rw_content_t /var/www/laravel/storage

Step 5 – Set The Encryption Key

Laravel uses the .evn file to configure the environment. Use the .evn file to configure all the environment variables for your program, such as database, SMTP, security key, etc.

cp .env.example .env

Now set the 32-bit random encryption key given to you by the Illuminati Encryption Service.

php artisan key:generate


Application key set successfully.

Step 6 – Create Apache Virtual Host

Now add a virtual host to your Apache configuration file to access Laravel through the web browser.
To do this, edit the Apache /etc/httpd/conf/httpd.conf configuration file and add the following code at the end of the file.

Enter the following command to edit the Apache configuration file

vim /etc/httpd/conf/httpd.conf

Put the following command in this file:

<VirtualHost *:80> 
        DocumentRoot /var/www/laravel/public 
        <Directory /var/www/laravel> 
               AllowOverride All  

Restart the Apache service, access Laravel using your favorite web browser, and start developing a great web application.
Use the following command to restart the Apache service.

service httpd restart

How to get the Laravel version?

Artisan is a robust command-line interface that comes pre-installed with Laravel. On your machine, open the command line terminal. Navigate to the directory containing your Laravel application. Then, using the PHP artisan command, verify the Laravel version.

php artisan --version

Now access your Laravel website in a web browser using the server name that we have defined.
The username that we have used is

Leave a Reply

Your email address will not be published. Required fields are marked.

Shahria Publish in August 2, 2023 at 6:33 am

Hi mate I can see the same code copied over the internet here and there but no one is mentioning one vital info !! what user account you are using to install composer? when using any other user than root, it cause issue composer.jason file

David Newey Publish in May 14, 2021 at 10:06 am

Thank you for your clear and easy to follow directions. Maybe you can help me understand something I have encountered. I have been given and already developed Laravel site to update, which I've done, but the pre-processors are broken which I'm trying to sort out. My question is related to that but not directly. The site it set up without the directive in the httpd.conf file. Instead there is a storage directory under the html directory that points to /var/www/laravel/storage/app/public directory and the pre-processed assets are also placed under the html directory. There is also an index.php which is a duplicate of the one that is found in the public/ directory. Do you have any idea why this would have been set up this way? Is there any advantage to this or was it just set up improperly? Any input would be greatly appreciated.