Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How To Install Laravel on Debian 10

    How To Install Laravel on Debian 10

    RahulBy RahulMarch 22, 20193 Mins ReadUpdated:June 7, 2021

    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 the Laravel PHP Framework on Debian 10 (Buster) Linux system.

    Laravel requirements

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

    Step 1 – Prerequsiteis

    You need to install the recommended PHP version with the required modules before starting the Laravel installation. The system has already running LAMP stack skip this step else use the following commands to set up the lamp on Debian 10 system.

    Install PHP 7

    sudo apt-get install git python-software-properties
    wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
    echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list
    
    sudo apt update
    sudo apt install php php-mcrypt php-gd php-mbstring php-xml
    

    Install Apache2

    sudo apt install apache2 libapache2-mod-php
    

    Install MySQL

    sudo apt install mysql-server php-mysql
    

    Install PHP Composer

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

    curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer
    sudo chmod +x /usr/local/bin/composer
    

    Step 2 – Installing Laravel on Debian

    Clone the latest Laravel source code from its official git repository to your local system. Just execute the following command to do it.

    cd /var/www
    git clone https://github.com/laravel/laravel.git
    

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

    cd /var/www/laravel
    sudo composer install
    

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

    chown -R www-data.www-data /var/www/laravel
    chmod -R 755 /var/www/laravel
    chmod -R 777 /var/www/laravel/storage
    

    Step 3 – 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.

    mv .env.example .env
    

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

    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.

    vi .env
    
    APP_NAME=Laravel
    APP_ENV=local
    APP_KEY=base64:Wer9JfZHN4qYQt9i8Hn1hLt8LWPeT3urzdI0hVqfzJM=
    APP_DEBUG=true
    APP_URL=http://localhost
    

    Step 4 – Setup MySQL Database

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

    1
    2
    3
    4
    mysql> CREATE DATABASE laravel;
    mysql> GRANT ALL ON laravel.* to 'laravel'@'localhost' IDENTIFIED BY 'secret_password';
    mysql> FLUSH PRIVILEGES;
    mysql> quit

    Edit the .env file and update database settings.

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

    Step 5 – 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.

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

    Update configuration as:

    <VirtualHost *:80>
    
            ServerAdmin [email protected]
            DocumentRoot /var/www/laravel/public
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/laravel>
                    AllowOverride All
            </Directory>
    
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    
    </VirtualHost>
    

    Reload Apache configuration changes by restarting service using below command

    sudo service apache2 restart
    

    Step 6 – Access Laravel Application

    Finally, Laravel PHP framework has been successfully configured on your Debian 10 Buster Linux system. Access Laravel application in your favorite web browser as below:

    Install Laravel 5 on Debian 10

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

    Happy coding!

    Buster Debian 10 Laravel
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow To Install Java on Debian 10 (Buster)
    Next Article How To Clone Specific Git Branch

    Related Posts

    How To Install Docker on Ubuntu 22.04

    3 Mins Read

    Filesystem Hierarchy Structure (FHS) in Linux

    Updated:July 1, 20222 Mins Read

    What is CPU? – Definition, Types and Parts

    3 Mins Read

    How to Install Ionic Framework on Ubuntu 22.04

    3 Mins Read

    What is the /etc/hosts file in Linux

    Updated:June 27, 20222 Mins Read

    Creating DMARC Record for Your Domain

    Updated:June 29, 20223 Mins Read

    2 Comments

    1. Cesar on September 6, 2020 6:53 pm

      Excellent.
      All good, however, the version of laraver that was installed was 4.0.0
      I have Debian 10 and the steps outlined here worked perfectly.
      Any comment? to have more recent versions of laravel

      Reply
    2. Stephane Winnepenninckx on August 10, 2019 8:52 am

      Nice, could you also explain how to access the Laravel App on RaspberryPi from another computer?

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How To Install Docker on Ubuntu 22.04
    • How to Install Bower on Ubuntu 22.04 & 20.04
    • How to run “npm start” through Docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.