Ahnii!

Ubuntu 24.04 LTS is a solid base for learning web development. The Laravel docs recommend PHP, Composer, and the Laravel installer on your machine. This post follows that official path first, then shows the DDEV option if you prefer a container-based stack.

Prerequisites

  • Ubuntu 24.04 LTS (desktop or server)
  • For the official method: no PHP/Composer required yet — the install script adds them.
  • For the DDEV method: Docker and Docker Compose.

Official method: PHP, Composer, and Laravel installer

The Laravel 12 installation guide uses php.new to install PHP 8.4, Composer, and the Laravel installer in one go. On Linux you run:

/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)"

Restart your terminal after it finishes. That gives you PHP, Composer, and the laravel CLI. You also need Node.js and npm (or Bun) to build frontend assets; install them via your package manager if needed (e.g. sudo apt install nodejs npm on Ubuntu).

Create the application

Create a new Laravel app. The installer will prompt you for testing framework, database, and starter kit:

laravel new my-laravel-app
cd my-laravel-app

Then install frontend dependencies, build assets, and start the dev server:

npm install && npm run build
composer run dev

The app runs at http://localhost:8000. The composer run dev script starts Laravel’s HTTP server plus the Vite dev server and queue worker.

Verify it works

Open http://localhost:8000 in your browser. You should see the default Laravel welcome page.

Laravel welcome page showing successful installation

Alternatively: DDEV method

If you prefer to keep PHP and the database in containers, use DDEV. Follow the DDEV installation guide for Linux, then use the Laravel quickstart: create the project directory, configure DDEV for Laravel, start the containers, and install Laravel via Composer:

mkdir my-laravel-site && cd my-laravel-site
ddev config --project-type=laravel --docroot=public
ddev start
ddev composer create-project "laravel/laravel:^12"
ddev launch

ddev config sets the project type and document root. ddev start brings up the web and database containers. ddev composer create-project installs Laravel 12 inside the web container. The Laravel project type in DDEV automatically updates or creates the .env file with the database host, user, and password (db), so you don’t run key:generate or edit .env by hand. ddev launch opens the app in your browser.

Baamaapii