How to Install Laravel PHP Framework on CentOS 7/ubuntu 15.04

Source: Internet
Author: User
Tags mcrypt php framework composer install epel repo how to install laravel fully qualified domain name

Composer Official website: https://getcomposer.org/

Laravel Official website: https://laravel.com/docs/5.2/installation

Hi all, in this article we is going to setup Laravel on CentOS 7 and Ubuntu 15.04. If you're a PHP web developer then your don ' t need to worry on all modern PHP frameworks, Laravel was the easiest to Get up and running that saves your time and effort and makes web development a joy. Laravel embraces a general development philosophy this sets a high priority on creating maintainable code by following SOM E simple guidelines, should is able to keep a rapid pace of development and is free to change your code with little FE Ar of breaking existing functionality.
Laravel ' s PHP framework installation is not a big deal. You can simply follow the "step by step" in this article for your CentOS 7 or Ubuntu server.

1) Server Requirements

Laravel depends upon a number of prerequisites that must be setup before installing it. Those prerequisites includes some basic tuning parameter of server like your system update, sudo rights and installation O F Required Packages.

Once connected to your server make sure to configure the fully qualified domain name then run the commands below T o Enable EPEL Repo and update your server.

CentOS-7

# yum Install Epel-release

# RPM-UVH https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# RPM-UVH https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

# Yum Update

Ubuntu

# Apt-get Install Python-software-properties
# add-apt-repository PPA:ONDREJ/PHP5

# Apt-get Update

# apt-get install-y php5 mcrypt php5-mcrypt php5-gd

2) Firewall Setup

System Firewall and SELinux Setup is a important part regarding the security of your applications in production. You can make firewall off if you is working on test server and keep SELinux to permissive mode using the below command, s o that you installing setup won ' t being affected by it.

# Setenforce 0

3) Apache, MariaDB, PHP Setup

Laravel installation requires a complete LAMP stack with OpenSSL, PDO, mbstring and Tokenizer PHP Extensions. If you is already running LAMP server then you can skip this step to move on and just make sure that the required PHP ext Ensions is installed.

To install AMP stack you can use the below commands on your respective server.

Centos

# yum Install httpd mariadb-server php56w php56w-mysql php56w-mcrypt php56w-dom php56w-mbstring

To start and enable Apache Web and MYSQL/MARIADB services for bootup on CentOS 7, we'll use below commands.

Mysqld changed to Systemctl start Mariadb.service.

# Systemctl Start httpd
# Systemctl Enable httpd

#systemctl Start mysqld
#systemctl Enable Mysqld

After starting MariaDB service, we'll configure its secured password with below command.

#mysql_secure_installation

Ubuntu

# apt-get Install mysql-server apache2 libapache2-mod-php5 php5-mysql

4) Install Composer

Now we be going to install composer that's one of the most important requirement before starting the Laravel Installatio n that helps in installing Laravel ' s dependencies.

Centos/ubuntu
Run the below commands to setup ' composer ' in Centos/ubuntu.

# CURL-SS Https://getcomposer.org/installer | Php
# MV Composer.phar/usr/local/bin/composer
# chmod +x/usr/local/bin/composer

Composer installation

5) Installing Laravel

Laravel ' s installation package can is downloaded from github using the command below.

# wget Https://github.com/laravel/laravel/archive/develop.zip

To extract the archived package and move into the document root directory, use below commands.

# Unzip Develop.zip

# MV Laravel-develop/var/www/

Now with the following compose command that would install all required dependencies for Laravel within its directory.

# cd/var/www/laravel-develop/
# Composer Install

Compose Laravel

6) Key Encryption

For Encrypter service, we'll be generating a digit encryption key using the command below.

Convert. env.example files to. env files

# php Artisan key:generate

Application key [Lf54qk56s3qdh0ywgf9jdrxo2n0ov9qi] set successfully

Now put this key into the ' app.php ' file as shown below.

# vim/var/www/laravel-develop/config/app.php

Key encryption

7) Virtua Host and Ownership

After composer installation assign the permissions and Apache user ownership to the document root directory as shown.

Installed in the/var/www/html/blog directory laravel to the blog directory to do the corresponding operation and then open the link/blog/public the same as display installation Laravel success

# chmod 775/var/www/laravel-develop/app/storage

# Chown-r Apache:apache/var/www/laravel-develop

Open The default configuration file of Apache Web server using any editor to add the following lines at the end file for n EW Virtual host entry.

Change the original/var/www/html to/var/www/laravel-develop/public

# vim/etc/httpd/conf/httpd.conf

ServerName Laravel-develop
Documentroot/var/www/laravel/public

Start Directory/var/www/laravel
AllowOverride All
Directory Close

Now the time was to restart Apache Web Server services as shown below and then open your Web browser to check your Localhos T page.

Centos

# systemctl Restart httpd

Ubuntu

# Service Apache2 Restart

8) Laravel 5 Web Access

Open your Web browser and give your server IP or Fully qualified Domain name and you'll see the Default Web page of Lara Vel 5 frame work.

Laravel Default

Conclusion

Laravel Framework is a great tool to develop your Web applications. So, at the end of this article learned it installation setup on Ubuntu and CentOS 7, now start using this AW Esome PHP Framework that provides you a lot of more features and comfort in your development work. Feel free-comment us back-for-your valuable suggestions an feedback-to-guide, more specific and easiest.

How to Install Laravel PHP Framework on CentOS 7/ubuntu 15.04

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.