How to install Laravel on CentOS Web Panel
To install Laravel on CentOS Web Panel
Laravel is a free and open source PHP framework used for building web content. It is designed for the fastest development of MVC (Model-View-Controller) web applications in PHP. After a great search for the best framework which I can work with, I found laravel to be the best. It is regarded as one of the most popular and secure PHP framework available today. In this article, you will learn about the method to install Laravel In order to install laravel you need to setup LAMP or LEMP stack with php version 7.0 and above.
Installing Laravel
In order to install Laravel, you need to have a composer. So, download the composer by running the following command.
[root@cwp ~]# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading...
Composer (version 1.5.2) successfully installed to: /root/composer.phar
Use it: php composer.phar
Once it is downloaded, you should activate the composer command, so you need to place it into the bin directory. Doing this can make the composer work.
[root@cwp ~]# mv composer.phar /usr/local/bin/composer
You should now move to your document root of your domian where you want to install laravel. Do that with the help of the following command.
[root@cwp ~]# cd /home/laravel/public_html/
Now you shall execute composer command as shown below with any project name. for example " lara"
root@cwp public_html]# composer create-project laravel/laravel lara dev-master --prefer-dist
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Installing laravel/laravel (dev-master 593963979a6b6a27966aef9723b8ff08fb480b87)
- Installing laravel/laravel (dev-master master): Downloading (100%)
Created project in lara
> @php -r " file_exists(' .env' ) || copy(' .env.example' , ' .env' ) "
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 68 installs, 0 updates, 0 removals
- Installing hamcrest/hamcrest-php (v2.0.0): Downloading (100%)
- Installing mockery/mockery (1.0): Downloading (100%)
- Installing vlucas/phpdotenv (v2.4.0): Downloading (100%)
- Installing symfony/css-selector (v3.3.13): Downloading (100%)
- Installing tijsverkoyen/css-to-inline-styles (2.2.0): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.6.0): Downloading (100%)
- Installing symfony/var-dumper (v3.3.13): Downloading (100%)
- Installing symfony/routing (v3.3.13): Downloading (100%)
.
.
.
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Package manifest generated successfully.
> @php artisan key:generate
Application key [base64:OSR3DIZa17WwmS2vMEsJTzvfgXPhDypt7WCu5lNUqqA=] set successfully.
Now that laravel is installed on your domain, you can now change user and group ownership of laravel project directory and also set file permission for storage directory
[root@cwp public_html]# chown -R laravel:laravel lara/
[root@cwp public_html]# chmod -R 0777 lara/storage/
After that, you need to configure your Apache VirtualHost for Laravel. So, you need to create then open apache configuration and create entry for laravel domain as follows
[root@cwp public_html]# vim /usr/local/apache/conf/httpd.conf
And make the following modifications to the .conf file.
< VirtualHost *:80> Servername laravel.example.com DocumentRoot /home/laravel/public_html/lara/public < /VirtualHost> < Directory /home/laravel/public_html/lara/public> DirectoryIndex index.html index.php Options FollowSymLinks AllowOverride All Require all granted suPHP_UserGroup laravel laravel < /Directory>
And finally, restart your Apache service with the help of the following command.
[root@cwp public_html]# systemctl restart httpd
Now, open the browser and type your domian name to access laravel home page.
With this, the installation of Laraval comes to an end.
Comments ( 0 )
No comments available