Install Laravel 5 on Debian 9

Linux

Laravel is one of the best open source, MVC PHP framework, designed for the faster development of web applications. You can simply install and use on your development system. This article will help you to install Laravel 5 PHP Framework on Debian 9 (Stretch) system.

Laravel required following software and extensions to be installed on your system:

  • Apache
  • MySQL/MariaDB
  • PHP >= 7.0.0
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Step 1 – Prerequsiteis

To start with Laravel, we first need to set up a running LAMP server. If you have already running LAMP stack skip this step else use followings commands to set up the lamp on Debian 9 system.

Install PHP 7

Install Apache2

Install MySQL

Step 2 – Install PHP Composer

The composer is required for installing Laravel dependencies. So use below commands to download and use as a command in our system.

Step 3 – Install Laravel on Debian 9

Download the latest version of Laravel from the official git repository. Use the below command to clone the master branch of the Laravel from GitHub.

Navigate to Laravel code directory and use composer to install all dependencies required for Laravel framework.

The dependencies installation may take some time as per your network speed. After successfully installing all dependencies, set the proper permissions on all files.

Step 4 – Set Encryption Key

Now, rename the .evn.example file to .env in projects main directory. This will use to setup application environment for the project.

Now generate base64 random number encryption key, which used by the Illuminate encrypter service.

Application key [base64:Wer9JfZHN4qYQt9i8Hn1hLt8LWPeT3urzdI0hVqfzJM=] set successfully.

Edit the .env configuration file and update the required settings. Also, make sure APP_KEY is properly set as generated in above command.

Step 5 – Creating MySQL Database

You may also require creating a database for your Laravel application. Login to your MySQL server and create MySQL database and user.

DB_CONNECTION=mysqlEdit the .env file and update database settings.

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=secret_password

Step 6 – Apache Configuration

You can create a new Apache configuration file or edit Apache default virtual host configuration file 000-default.conf and update DocumentRoot to Laravel public directory as below.

Update configuration as:

Reload Apache configuration changes by restarting service using below command

Step 7 – Access Laravel Application

Laravel PHP framework has been successfully configured on your system. Access Laravel application in your favorite web browser as per configured Apache.

Install Laravel 5

Let’s start building an awesome application using Laravel PHP Framework.

Source

Share: