Installing and Configuring Laravel in Ubuntu

Laravel installation needs the Composer to be installed first. As the Composer will resolve the dependencies needs for the Laravel.

Install Composer
Composer is a popular dependency management tool for PHP, created mainly to facilitate installation and updates for project dependencies. It will check which other packages a specific project depends on and install them for you, using the appropriate versions according to the project requirements.
We will use composer to install Laravel and if any dependencies.

First do an update of Ubuntu package manager
sudo apt-get update

Now we need curl to download Composer.
Also we need php5-cli for installing and running Composer from command line.

sudo apt-get install curl php5-cli git

Now to download and install Composer as a system-wide command named composer, under /usr/local/bin execute the following command
curl -sS | sudo php -- --install-dir=/usr/local/bin --filename=composer

After the installation check it, everything works fine.
execute the command
if you see the composer version and other info on the command parameters, composer installation is perfect.

Laravel installation

To install Laravel, we shall use the laravel installer, as it is the officially recommended/preferred method
So, execute the command to install
composer global require "laravel/installer=~1.1"
This installs the Laravel globally

Laravel has following requirements
PHP >= 5.4
Mcrypt PHP Extension
OpenSSL PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
PHP_JSON extension (for some OS distros, we need to install manually)


That’s it. we are ready to go. Laravel is setup in your system. You can create new projects using Laravel. for that refer Laravel documentation.

If you use Apache for serving your website, you would need to enable mod_rewrite module.

By default, the Laravel comes with the public/.htaccess file that is used to allow URLs without index.php. If this default file comes with Laravel, does not work with your Apache installation, then create a new .htaccess file with the following contents or make sure your .htaccesss has to he following contents

Options +FollowSymLinks
 RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^ index.php [L]