How to Install Laravel 12 on Ubuntu (Step-by-Step Beginner Guide)

There are many Php frameworks in the market like Symfony, Laravel, CodeIgniter, CackPHP, Zend Framework etc. For all of these Laravel is the most popular and good framewaork to build modern web apps. In the StackOverFlow Survey 2025 laravel has taken good spot and it below the django framework.

Stack-over-flow-developer-survey-2025

If you are new to Laravel and using Ubuntu as your OS of choice, this guide will help you install Laravel 12 step by step without any confusion. This tutorial is written for absolute beginners in mind.

Prerequisites

Before installing Laravel 12, make sure your system meets these requirements. Those are.

  • Ubuntu 20.04 / 22.04 / 24.04 any version will work recomanded is 24.04 LTS.
  • Basic knowledge of terminal commands
  • Internet connection

Laravel 12 requires:

  • PHP 8.2 or higher
  • Composer
  • Required PHP extensions

Step 1: Update Your Ubuntu System

Open your terminal and run:

sudo apt update && sudo apt upgrade -y

now enter your password and update your system.

Step 2: Install PHP, Composer and Laravel Installer all at Once

Now your system is up to date and ready to install php, Composer and laravel all in one single command. I will show you how easy to install all it once.

Now open your favorite browser like Chrome or firefox or any thing you like (We recomanded chrome). go to www.laravel.com. This is laravel’s official site. then click on the Get Started button or go to Docs in the menu bar.

laravel-official-site-image

After that Laravel Docs this link wil open. In some how if you can not go to that page click on the Laravel Docs link it will go to that page. Then scrool down a little bit you can find a heading says Creating a Laravel Application. Here you can find the code and all details.

Now copy the code and past it into your terminal and hit enter. It will install PHP, Composer and Laravel installar all.

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

command-to-install-laravel-php-composer

After complete the task run

source ~/.bashrc

This will source your bash.(if you use bash then this code will work). Now close your terminal and reopen it. and check that if laravel, php, composer is install or not. Type in you terminal.

php -v
composer --version
laravel --version

Terminal-output-for-laravel-php-composer

now you can easyly

Step 3: Create a Laravel 12 Project

now open your termainl and go to your any directory you like (recomanded create a folder name code).

mkdir code
cd code

then in the code directory run this command

laravel new example-site

Now run this command to serve the laravel app in local developemnt server.

php artisan serve

now open browser and see the site is running.

http://127.0.0.1:8000