We’ll show you how to install Laravel on CentOS 7. Laravel is a free, open-source PHP web application framework with expressive, elegant syntax. It is intended for the development of web applications following the model–view–controller (MVC) architectural pattern. 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 etc… Installing Laravel on CentOS 7 is an easy task, just follow the steps in the tutorial below and you should have it installed in a few minutes.
Requirements:
We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.
Log in to your server via SSH:
Table of Contents
1. Update the System
Make sure your server is fully up to date:
2. Install Apache, MariaDB, and PHP
Before proceeding, let’s install Apache, MariaDB and PHP 5.6 along with it’s needed dependencies. First, install the EPEL and Webtatic repositories with the below commands:
3. Install LAMP Stack
You can now install LAMP (Linux Apache, MariaDB & PHP):
4. Start MariaDB and Apache
Start MariaDB and Apache, then enable them to start on boot:
5. Install Composer
Next, install Composer which is the tool for dependency management in PHP.
Once the Composer is installed, you need to move it so that Composer can be available within your machine path. To check your available path locations type the following:
The output will provide you with the path locations. Put composer in the /usr/local/bin/ directory:
6. Download Laravel
Navigate into a directory where you will download Laravel. We are using /opt :
Download Laravel and unzip the archive:
Then create a directory for your website and move the Laravel installation there:
Move the files/directories from the laravel-4.2.11 unpacked the archive into your website directory and then delete laravel-4.2.11:
7. Download and Install all Dependencies
Issue the below command to download and install all dependencies. This can take some time, so feel free to make yourself a cup of tea:
Once the installation is completed, set the ownership of your website files/directories to apache:
8. Create Virtual Host Directive
Now, create a virtual host directive for your website. Open a file called let’s say your_site.conf with your favorite text editor. We are using nano:
Paste the following:
Don’t forget to replace your_domain with your actual domain.
9. Restart Apache and Test Laravel installation on CentOS 7
Restart Apache so the changes can take effect:
With that out of the way, open your web browser and navigate to http://your_domain to access the Laravel website.
Congratulations, you have successfully installed Laravel on your CentOS 7 VPS.
Of course, you don’t have to Install Laravel on CentOS 7, if you use one of our Laravel VPS Hosting services, in which case you can simply ask our expert Linux admins to Install Laravel on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post on how to install Laravel on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.
Hey, you forgot the firewall, thanks for this guide!
firewall-cmd –permanent –zone=public –add-service=http
firewall-cmd –permanent –zone=public –add-service=https
firewall-cmd –reload
Thanks for your big effort! :D Great article, i will use it today… :D
Really Very Helpful Article
It would be great if you update for latest laravel version
You can always download the latest available version from GitHub https://github.com/laravel/laravel/archive/v6.18.8.zip