Skip to main content


Laravel is a PHP framework used to develop PHP based applications . Laravel is specially designed for easy and faster development of web applications. It supports multi-platform you can simply install and use on your development system. This post will guide you to install Laravel 5 PHP Framework on Debian 9 (Stretch) system.

Server Requirements

The Laravel framework has a few system requirements. You will need to make sure your server meets the following requirements:

PHP >= 7.1.3
BCMath PHP Extension
Ctype PHP Extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

Install Laravel in Debian

apt-get update

apt install git unzip

Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.

curl -sS https://getcomposer.org/installer | php

Make sure to place composer's system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system.

mv composer.phar /usr/local/bin/composer

Set permission to execute that composer.

chmod +x /usr/local/bin/composer

It's best practise to create a database for your Laravel application you might need it at one point. Login to your MySQL server and create MySQL database and user.

mysql -u root -p

CREATE DATABASE dbtest;

GRANT ALL PRIVILEGES ON *.* TO 'dbtest'@'%' IDENTIFIED BY 'dbtest' WITH GRANT OPTION;

FLUSH PRIVILEGES;


move to html directory to install git.

cd /var/www/html

Use git to download the latest version of Laravel from the official git repository.

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

When the git clone finishes, move to the Laravel directory

cd laravel

set the proper permissions on all files.

chown -R www-data.www-data /var/www/html/laravel

chmod -R 755 /var/www/html/laravel

chmod -R 777 /var/www/html/laravel/storage

rename the .evn.example file to .env. This is used to setup application environment for the project.

cp .env.example .env

chown -R www-data.www-data .env


use composer to install all dependencies required for Laravel framework.

composer install

generate base64 random number encryption key

php artisan key:generate
Application key 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

nano .env

# on line 3 make sure you see the app key 

APP_KEY=base64:pPRKLYFCMJawhNYH6CITxHmTYJuOQKRvb6e1/tXAAnA=

 # line 5 add the ip address that you will use to access the server 
APP_URL=http://192.168.0.250

# from line 9 add necessary information to connect to your database

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dbtest
DB_USERNAME=dbtest
DB_PASSWORD=dbtest



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 I have opt to edit the existing file.

nano /etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>

ServerAdmin webmaster@internal.labnet
DocumentRoot /var/www/html/laravel/public
         <Directory />
                Options FollowSymLinks
                AllowOverride None

        </Directory>

        <Directory /var/www/html/laravel>
                AllowOverride All
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>


restart the apache server for changes to take effect

service apache2 restart

Once the above process is completed, open the browser with IP address to access it.

Popular posts from this blog

How To Install the Anaconda Python Distribution on Debian 9 And Running a public notebook server

Anaconda Distribution is an open-source package manager, environment manager and distribution of Python and R programming languages. With a collection of 1,000+ open source packages with free community support. Designed for data science and machine learning workflows, you can use it whether you are on Windows, macOS or Linux. The Anaconda distribution ships with the conda command-line package management utility. You can learn more about Anaconda and conda by reading the official Anaconda Documentation . Jupyter is a browser-based interpreter that allows you to interactively work with Python and R. Anaconda provides Jupyter as well. You can think of Jupyter as a digital notebook that gives you an ability to execute commands, take notes and draw charts.It’s primarily used by Data Scientists. But I find that very useful tool if you are learning Python or R. It’s basically the same as working on a shell but much better. The Jupyter notebook web application is based on a

How to create REST API using Django REST Framework

This post begins with already working project and app's, I found that there some few requirement's that my project needed to handle and the best option for those requirement's was to use the Django's  Rest Framework. The way that I will tackle this task is more specific to the needs of the project rather than a one to one how to..., that being said you can still follow along, the approach that I'm going to use is easy to follow since I'll be providing a lot of information a log the way for better understanding of the why and how.....this code is available on Github , enough with the alerts and on with the show. Note:  If you would want to mimic the exactly settings then you will need to enable user authentication on your project you can follow this link for details .  Start with the DRF (Django Rest Framework) installation pip3 install djangorestframework For our app to use DRF, we'll have to add rest_framework into our settings.py.   nan

django react app setting up the backend

On the previous article I demonstrated how we can use the generic views along with ModelSerializer classes to rapidly develop our REST APIs. Knowledge that you will need  in your career as full stack / backend developer, however think of this article as an extension to the previous one, equipped with what we already know about REST API we will step our game up and discuss about ViewSet, ModelViewset we will dig deep into the concepts of Routers which allow us to manage our api routes in a simple and sophisticated manner as well as helping to speed up building APIs even further. There for on part II of this article i'll work you through on how React application can consume this RESTful API. There for at the end of the day we will have a full stack web app, in short we strat our development at the backend then later on we move at the frontend... so are you excited and ready to take the challange? lets do this then..... you can get source code for the bakend on github Preparat