Home / Linux  / CentOS  / Install laravel PHP Framework on CentOS 7 / RHEL 7 / Ubuntu Linux Server

Install laravel PHP Framework on CentOS 7 / RHEL 7 / Ubuntu Linux Server

php laravel php composer laravelle laravell laravel tutorial laravel storage laravel programmer laravel php laravel mobile app laravel install laravel download laravel config laravel cms laravel cloud hosting laravel 5 laravel   prefer dist laravel laraval 5 install laravel install composer download laravel composer.phar composer install

  is a php based web application framework ,which manage its dependencies through Composer. It will download on system , can archived its phar file in local project path or you can use globally through usr/local/bin . for windows composer having its installer. Use of framework will enjoy the developer to do the best code .  is open, powerful tool for large and robust applications.

Installation of framework is not complicated, we will discuss in this article guide installation of composer and on CentOs / RHEL / Ubuntu Server.

Prerequisite Server Requirements :

Laravel needs  PHP >= 5.4 version and MCrypt  Extension(php-mcrypt) .

If php 5.5 version using , it can be required php json extension.

Install Apache Web Server  on Centos / RHEL  / Ubuntu :

Here we are assuming that you have fresh Operating System of Linux flavor server , so you need to fresh install apache web server .

Set up Yum Repository  for  CentOS 7 / RHEL 7 Version :

Install and Configure yum epel and RepoForge repository on Centos 7 / RHEL 7 Version. we have other articles for yum repository configure. Please click on below link.

Setup EPEL and Repoforge

Install apache :

For CentOs / RHEL 7 :

To set up apache webserver on centos and rhel server, you need to run below command.

# yum --enablerepo=epel install httpd  -y

Start and active the service of apache on server.

# systemctl start httpd.service    # systemctl enable httpd.service

For Ubuntu Server :

# apt-get install apache2

Start and active the service of apache2  on ubuntu server.

# service apache2 start

Install PHP and its extension 

For Laravel , only need php , php mcrypt extension and some common module should be install.Run below command to install php and its module.

For ubuntu user :

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

For CentOS  / RHEL 7 :

#yum --enablerepo=epel install php  php-mcrypt php-mysql

After that restart apache web server.

Below steps of for both ubuntu and centos server, for run the command you should have root privileges other wise you have sudo user previleges.

#  curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer    Downloading...         Composer successfully installed to: /root/    Use it: php 

Use this file for globally on system , we have move to /usr/local/bin .

#  mv composer.phar /usr/local/bin/composer

Give executable permission to composer file.

#  chmod +x /usr/local/bin/composer

Configure Laravel

Go to server path where you want to configure framework. Here we are going to configure framework application on our document root of  domain name. which is  /home/admin/web/techtransit.org/public_html .

# cd /home/admin/web/techtransit.org/public_html    #  git clone https://github.com/laravel/laravel.git

then go to laravel folder which is in /home/admin/web/techtransit.org/public_html directory.

# cd /home/admin/web/techtransit.org/public_html    # composer install

Now after composer installation dependency will install then give web server user access to the laravel application code.


Laravel Apache Configuration on CentOs / RHEL / Ubuntu Server :

Create a new Virtual host configuration file in apache. We have create a apache configuration file  framework.conf  in our apache configuration directory   .

For CentOs / RHEL Server :    # cd  /etc/apache/conf.d/    # vim  framework.conf    For Ubuntu Server  :    # vim /etc/apache2/sites-available/framework.conf    # ln -s /etc/apache2/sites-available/framework.conf /etc/apache2/sites-enabled/framework.conf

Add the follow lines in our apache configuration file.

<VirtualHost *:80>  ServerAdmin  admin@domainname.com  DocumentRoot /home/techtransit/pubic_html/framework  ServerName    laravelframework.techtransit.org    <Directory /home/techtransit/pubic_html/framework>   Options FollowSymLinks    AllowOverride All   </Directory>   </VirtualHost>

After that restart your web server daemon according to your OS.

# systemctl restart httpd.service ( For CentOs / RHEL 7 )    # service apache2 restart ( For Ubuntu Server )

Now Open the web site in browser and Enjoy Laravel framework.

Thank you !!

A Linux Geek with Freelance Contributor, Server/ Cloud Administrator having experience in Open Source and Cloud Technologies.

Review overview
  • Pasquale March 31, 2016


    Lavarel site tell that php version must be >= 5.5.9. On CentOS 7.2 the php is ver. 5.4. Are you shure that Lavarel can work on CentOS 7.2 ?