Installation Step of Laravel 5 in Ubuntu

This article we will Learn, how to Install Laravel 5 in Ubuntu.As We know Laravel is designed for development of MVC web applications in PHP. Installation Step of Laravel 5 are giveb below.

Step 1:Install openssl and mcrypt.

sudo apt-get install openssl    // Install openssl
sudo apt-get install php5-mcrypt  //  Install php5-mcrypt
sudo php5enmod mcrypt

Step 2:In Second step we will install composer.Composer is used to install Laravel dependencies.We will use below commands to install Composer.

curl -sS | php   // Install composer
sudo mv composer.phar /usr/local/bin/composer       // Set Environment 

Step 3: Downlaod Laravel.

cd /opt/lampp/htdocs 
composer create-project laravel/laravel --prefer-dist

Step 4: Set Encryption Key.

php artisan key:generate

To Set Encryption go to "config/app.php" and update above generated encryption key as below.This key is used by the Illuminate encrypter service and should be set to a random, 32 character string.

'key' => env('APP_KEY', 'RgWlDNYJWrEf17oMJQ3LNvTwALewQPoP'),
'cipher' => 'AES-256-CBC',

Step 5:Giving write permissions.

sudo chmod 777 cd /opt/lampp/htdocs/laravel/storage
sudo chmod 777 cd /opt/lampp/htdocs/Your-Laravel5-Directory

Step 6:Set up Apache VirtualHost.

  1. Go to /opt/lampp/etc/httpd.conf And open httpd.conf.
  2. Now search "#Include conf/extra/httpd-vhosts.conf" and remove "#" sign in front of "Include conf/extra/httpd-vhosts.conf".
  3. Open httpd-vhosts.conf file located in "/opt/lampp/etc/extra/httpd-vhosts.conf" and add following code.
  4. <VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs
    ServerName localhost
    ServerAlias www.localhost
    #New Virtual host
    <VirtualHost *:80>
    DocumentRoot /opt/lampp/htdocs/laravel/public
    #path of your new host
    ServerName laravel
    #name of your new host
    ServerAlias www.laravel
    #alias of your new host
  5. Go to "/etc/hosts" and open the file "hosts" and add following line.
  6. laravel

Step 7:Restart the Apache service. And type "http://laravel" in browser.We will see following screen.