Laravel  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 Laravel framework will enjoy the developer to do the best code . Laravel is open, powerful tool for large and robust applications.

Installation of Laravel php framework is not complicated, we will discuss in this article guide installation of composer and laravel 5 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.

Install Composer

Below steps of composer install 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/composer.phar

Use it: php composer.phar

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  /www/wwwroot/techtransit.org .

# cd /www/wwwroot/techtransit.org

#  git clone https://github.com/laravel/laravel.git

then go to laravel folder which is in /www/wwwroot/techtransit.org directory.

# cd /www/wwwroot/techtransit.org

# 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  [email protected]
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 !!

By Sachin G

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks! Sachin G Follow me on LinkedIn and x formerly twitter