How to Install Laravel on Debian 11

Install Laravel on Debian 11

In this article, we will have explained the necessary steps to install Laravel on Debian 11. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Laravel is one of the PHP language frameworks designed for web application development and works based on MVC. One of its advantages is that it has a much easier learning curve than other web and application development tools.

Install Laravel on Debian 11

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install the Laravel Requisites Dependency.

Before installing, you need to install PHP and some of its modules to your Debian Bullseye system:

sudo apt install php php-bcmath php-json php-mbstring php-pdo php-tokenizer php-xml php-pear php-zip php-zip unzip

Step 3. Install PHP Composer.

Composer is a project dependency manager for PHP programming. Now to install Composer on the system, you have to run this single command below:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Next, install it in a directory that is in our PATH. Also, you have to give it run permissions:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
sudo chmod +x /usr/local/bin/composer

Verify the Composer installed:

composer --version

Step 3. Install Laravel on the Debian system.

After PHP Composer is complete installed, run the following command to install Laravel:

composer create-project --prefer-dist laravel/laravel [your_project_name]

This will create a folder with the name of your project that we need to access:

cd linuxtips_project

If you want to check how the project is running and also if you want to verify the installation, you can run:

php artisan serve

Step 4. Accessing Laravel Interface

Now you can access the Laravel web install wizard using an HTTP connection URL http://localhost:8000

Install Laravel on Debian 11

That’s all you need to do to install the Laravel on Debian (Bullseye). I hope you find this quick tip helpful. For further reading Laravel PHP Framework on Debian’s system, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.