• Home
  • About Us
  • Contact
  • Privacy Policy

LinuxAdmin.io

  • Home
  • Tutorials
    • System Administration
    • Linux Tutorials
    • Web Hosting
    • WordPress
    • Virtualization
    • Troubleshooting
    • OpenStack

Laravel Installation Guide For CentOS

How To Install Laravel On Centos

How to install Laravel on CentOS

One of the most popular frameworks of PHP is Laravel. The use of this framework is increasing day by day. Website development becomes easier by using this framework. It is open-source software. So anyone can install and use this software without any cost. This framework supports most of the well-known operating system such as Windows, Linux etc. It also supports maximum popular relational database such as MySQL, SQL Server, PostgreSQL etc. This is a guide on how the framework can be downloaded and installed on CentOS step by step.

Requirements:

Before starting the steps of this tutorial you require Apache and PHP to be installed on your system. So, you must install these packages and check these are working properly. You must have root privileges also to complete this tutorial.

Laravel Installation:

You need to follow the following steps to start the installation process the installation on CentOS.
Update the system
You have to make the system update-to-date to install any software. Run the following command to update the system.
$ sudo yum -y update

Install HTTPD from yum for Laravel

Check the apache server is enable and working. Run the following commands to start apache server.
$ sudo systemctl start httpd

Run the following commands to allow HTTP and HTTPS ports:

$ sudo firewall-cmd --permanent –add-port=80/tcp
$ sudo firewall-cmd --permanent –add-port=443/tcp

Check PHP is installed and working. Run the following command to check the installed PHP version. Here, PHP version 7.3.2 used. You can use PHP 7+ any version to complete the installation.

$ php -v

Check PHP compatibility for Laravel

Some PHP extensions are required to install Laravel. Run the following command to install necessary PHP extensions.

$ sudo yum install php-common php-gd php-phar php-xml php-cli php-mbstring php-openssl php-mcrypt php-pdo php-mysql

Install PHP modules for Laravel

PHP dependency manager, Composer is a very useful tool for installing any PHP package. It is used to install Laravel. The composer will be downloaded in this step. Run the following command to download the Composer installer for PHP.

$ sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Copy composer to Install Laravel

The composer will be installed in the required folder in this step. Run the following command to install Composer in the /usr/local/bin folder.
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Install Composer

Check the composer is installed properly by running the following command.

$ php /usr/local/bin/composer

If all the previous steps completed successfully then you can start the step for installing the latest version of Laravel. Run the command to download and install Laravel directly into apache document folder under laravel. It will require some time to complete the process.

$ php /usr/local/bin/composer create-project laravel/laravel /var/www/html/laravel

Use composer to install Laravel

After completing the installation, if the following success information appears at the ending then Laravel is installed successfully in the system.

Run the following commands to set the required permissions for the necessary folders.
$ sudo chown -R apache:apache /var/www/html/laravel
$ sudo chmod -R 755 /var/www/html/laravel/storage

Restart the apache
$ sudo systemctl restart httpd

You can run your application directly from a web server but Laravel has own development server also. To start it, proceed to the project folder and start the application development server.

$ cd /var/www/html/laravel
Run the following command to start Laravel Development server. If the following message appears like the following image then Laravel development server is working.

$ cd /var/www/html/laravel
$ php artisan server

Start The Laravel Web Server

Open any browser and type the following URL to check the installation is working properly.
http://localhost:8000
If the following screen appears then you have succeeded in your installation

Check and ensure Laravel is working.

Conclusion

After downloading and installing Laravel, many types of deprecated errors may appear based on PHP and Laravel version. After solving these problems, you can use this framework for developing any web application. We hope the reader will be able to install Laravel on CentOS by following the steps of this tutorial. Once you have completed the installation you can learn all of the features in the framework by reading further the documentation and start using them!

Mar 7, 2019LinuxAdmin.io
0 0 vote
Article Rating
Openstack Services Explanation And Overview
You Might Also Like
 
OSSEC Intrusion Detection Installation On Centos 7
 
Install And Configure ProFTPD On CentOS
Subscribe
Notify of
guest
guest
0 Comments
Inline Feedbacks
View all comments
4 years ago PHP, Web Hosting 3,091
Recent Posts
  • Laravel Installation Guide For CentOS
  • Openstack Services Explanation And Overview
  • OSSEC Intrusion Detection Installation On Centos 7
  • Configure ProFTPd for SFTP on CentOS
  • How To Check And Repair MyISAM Tables In MySQL
Most Commented
Hot Clone Linux Server with Rsync
Hot Clone A CentOS Server With Rsync
14 Comments
ngx_cache_purge module
Install The ngx_cache_purge Module In Nginx
8 Comments
piwik-nginx
Piwik Analytics on Nginx
8 Comments
Tags
linuxcentosLinux Performance Tuningsysadminkvmnetworkingmemcachedanalyticssystemd
About

We love Linux and are dedicated to creating Linux administration tutorials for System Administrators since 2016.

Most Viewed
Default Gateway
How To Configure A Default Gateway on CentOS
63,000 views
Zend Opcache
Setup and Optimize Zend OpCache
46,714 views
Install ffmpeg
FFMpeg Install On CentOS 7
20,912 views
Archives
Email subscription

Sign up for our newsletter to receive the latest news and event postings.

2018 © LinuxAdmin.io
wpDiscuz