How to install Laravel in Linux

First of all we need to Download Composer Then we need to install Laravel through composer then install composer :

First way

Download composer by typing this into terminal –

Note: If the above fails for some reason, you can download the installer with php instead:

This will just check a few PHP settings and then download composer.phar to your working directory

To make Composer run only from your Local project folder you need to enter downloadable folder after that through composer install Laravel into your correct path. Now type below cmd in terminal –

To resolve and download dependencies you need to enter into the laravel project folder, run the composer installation command:

Update composer.phar type-

Second way –

To make composer run Globally You need to move composer.phar file to bin folder as composer after download, run these commands to easily access composer from anywhere on your system:

Now type below cmd in terminal to install Laravel –

As you did a global install of composer so now you need to enter into the laravel project folder, run this cmd:

Update composer type-

After installation of Composer and Laravel Another Important thing is –

Laravel requires mcrypt extension. Let’s install that –

To check if mcrypt is already includes in our php:

If you received an output of, “Extension ‘mcrypt’ not present”. That means php doesn’t recognize your mcrypt yet. To fix this, let’s find out first what is your loaded php.ini. Then open the said php.ini file by typing this you will see the path.

Then enable the extension and restart Apache again-

For php7.2 –

When you are shown the prompt

Press [Enter] to autodetect

After success installing search for mcrypt if cannot find, you should add mcrypt.so extension to php.ini. Then restart Apache by “service apache2 restart”

Grab installing path and add to cli and apache2 php.ini configuration.

To verify mcrypt run command:

Now, another thing that Laravel requires is PDO.

Again, lets open php.ini and look for pdo section and add the following codes below. Don’t forget to restart apache.

The next thing that we need to do is set the permissions of the Laravel app/storage folder:

The last step in the configuration of Laravel is to modify the Laravel folder structure to remove the public folder, which removes public from the URL for the project for simplicity. To do this, in the laravel folder, run:

Open the index.php in the laravel folder in a text editor and replace the two occurrences of __DIR__.’/../bootstrap/autoload.php’ with __DIR__.’/bootstrap/autoload.php’. Essentially, you are removing /.. from the path. Save the index.php file.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.