Instructions for installing Laravel on CentOS - HOSTVN Blog




Laravel is a free and open source PHP framework designed to develop web applications following the MVC model. This article will guide you how to install Laravel on CentOS.



Instructions for installing Laravel on CentOS


1. Install Yum Repositories


First of all, you need to add REMI and EPEL repositories in your system. The archive has updated packages. Use one of the following commands according to your operating system version and system architecture.






2. Install LAMP or LEMP and configure Virtual Host


First you need to install Webserver to be able to run Laravel, you can choose to install LAMP or LEMP


3. Install Composer


To make it easier to install Laravel you need to install Composer


4. Install Git


To install Git on CentOS you can follow these instructions: How to install Git on CentOS 7


5. Install Laravel on CentOS


In this tutorial HOSTVN will assume the directory containing web code will be /home/hostvn.net/public_html


5.1. Method 1: Install Laravel with Git


To install Laravel with Git, run the following commands one after the other





Install Laravel on CentOS

Next you need to move all the files and folders in the folder laravel go out public_html





You enter A and press Enter when asked


Screenshot_156

Next, run the following command to install the necessary components





Finally we create APP_KEY by running the following 2 commands






5.2. Method 2: Install laravel with Composer


To install Laravel with Composer, run the following commands one after the other






  • Install the latest version






  • Install custom version





Next you need to move all the files and folders in the folder laravel go out public_html





You enter A and press Enter when asked


Screenshot_156

6. Set owner for files and folders


After completing the installation, you need to set the owner of the file and folder to avoid permission errors












7. Configuring Virtual host


After the installation of Laravel is complete, you need to edit the vhost to point the document root to the Laravel public folder


7.1. With Apache

You modified Document root to look like the following





Proceed to restart Apache to update the configuration






7.2. With Nginx

You fix the root to the following





Next you add above the line index index.html index.htm index.php; following rules





Proceed to restart Nginx to update the configuration






8. Reference link


9. Conclusion


Through this article, HOSTVN showed you how to install Laravel on Centos. If you have any comments you can leave a comment below. Also you can see more Guide to create Cron Jobs on VPS Linux.



email-business-leaderboard-blog-v3.png