Updated: 28 September 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9

Laravel is a PHP framework for web applications. You need PHP 8.3 or newer (for Laravel 13), Composer and a database.

Install Composer

apt install composer          # Ubuntu 24.04 / Debian 12
# or the official installer (any system):
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php

Create the Laravel project

cd /var/www
composer create-project laravel/laravel example-app
cd example-app
cp .env.example .env    # if not created
php artisan key:generate

Set the database details in .env (DB_DATABASE, DB_USERNAME, DB_PASSWORD), then run php artisan migrate.

Permissions

chown -R www-data:www-data storage bootstrap/cache    # apache or nginx on AlmaLinux/Rocky
chmod -R 775 storage bootstrap/cache

The web server's document root must be the project's public folder, never the project folder itself.

Note: Laravel 13 (the current version) needs PHP 8.3 or newer: Ubuntu 24.04 and AlmaLinux/Rocky 9 with the php:8.3 stream are fine. On Debian 12 (PHP 8.2) Composer installs Laravel 12 instead, which receives security fixes until February 2027.

For a full server setup with Apache or Nginx, see "How to install Laravel 5.5 + PHP 7.1 with Apache on Ubuntu 16.04?" and "How to install Laravel on Centos 7 with Nginx" (both updated for current systems).

Tip: On cPanel hosting, you can create a Laravel project in Terminal with Composer and point a subdomain's document root to its public folder.

Related services

Web hosting

shared hosting on Virtualmin with NVMe storage, free SSL and email.

SSL certificates

DV, OV and wildcard, with free installation help.

Reseller hosting

white-label cPanel hosting for your own clients.

Was this answer helpful?

Still stuck? Open a ticket