DEV Community

David Boureau
David Boureau

Posted on • Originally published at saaslit.com

How to install Laravel 11 on linux

Prerequisite

By default, Laravel v11 tries to connect to a sqlite database, so ensure it is properly installed with

sudo apt install php-sqlite3
Enter fullscreen mode Exit fullscreen mode

Install PHP8.3

Laravel 11 requires PHP 8.2 or 8.3, so let's install the latest version

It should work the same way if you installed MySql and not PostGre

1. Run system updates

sudo apt update && apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

2. Add Ondrej repository

The current maintainer of PHP is Ondrej Sury. It sounds odds that the package of such a language doesn't belong to an organisation, but here you can add it safely :

sudo add-apt-repository ppa:ondrej/php
Enter fullscreen mode Exit fullscreen mode

Update all repositories once again with

sudo apt update
Enter fullscreen mode Exit fullscreen mode

Check PHP version with

php --version
# PHP 8.3.3-1+ubuntu22.04.1+deb.sury.org+1 (cli)
Enter fullscreen mode Exit fullscreen mode

3. Add dependencies

Laravel will be buggy if you don't install PHP base modules

sudo apt-get install -y php8.3-cli php8.3-common php8.3-fpm php8.3-zip php8.3-gd php8.3-mbstring php8.3-curl php8.3-xml php8.3-bcmath
Enter fullscreen mode Exit fullscreen mode

Install composer

composer is a tool to build new laravel application.

Follow first paragraph of https://getcomposer.org/download/

Ensure it is properly working on your machine by typing

composer  --version
# Composer version 2.7.2 2024-03-11 17:12:18
Enter fullscreen mode Exit fullscreen mode

Create a default Laravel 11 application

composer create-project laravel/laravel=11 MyApp
Enter fullscreen mode Exit fullscreen mode

Installation will last a few second, it should end up with migrations, like this

# long previous logs...

   INFO  Running migrations.  

  0001_01_01_000000_create_users_table .......................... 31.91ms DONE
  0001_01_01_000001_create_cache_table .......................... 18.81ms DONE
  0001_01_01_000002_create_jobs_table ........................... 24.48ms DONE
Enter fullscreen mode Exit fullscreen mode

Run the application

cd MyApp
php artisan serve
Enter fullscreen mode Exit fullscreen mode

Open browser at http://127.0.0.1:8000, and ta-da!

Top comments (1)

Collapse
 
sourovpal profile image
Sourov Pal

Hi,
This is Sourov Pal. I am a freelance web developer and Software Developer. I can do one of project for free. If you like my work you will pay me otherwise you don't need to pay. No upfront needed, no contract needed. If you want to outsource your work to me you may knock me.

My what's app no is: +8801919852044
Github Profile: github.com/sourovpal
Thanks