Install Laravel in Ubuntu |
Install Laravel in Ubuntu |

Install Laravel in Ubuntu

Laravel is a popular PHP framework that simplifies the development of web applications. To start, you’ll need to have PHP, Composer, and some additional extensions installed on your Ubuntu system. Let’s walk through the steps together.

Step 1: Install PHP

Ubuntu’s default repositories might have older PHP versions. You can add a third-party repository to install the latest PHP version. Open the terminal and execute the following commands:

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php php-cli php-mbstring unzip

Step 2: Install Composer

Composer is a dependency manager for PHP. It’s necessary for Laravel and can be installed by running these commands:

sudo apt install curl php-cli php-mbstring git unzip
sudo curl -sS | php
sudo mv composer.phar /usr/local/bin/composer

Step 3: Install Laravel Installer

Now that Composer is installed, use it to install the Laravel installer globally:

composer global require laravel/installer

Step 4: Create a New Laravel Project

Once the Laravel installer is installed, you can create a new Laravel project using the following command:

laravel new projectName

Replace “projectName” with the desired name of your Laravel project.

Step 5: Serve Your Laravel Application

Navigate into your project directory:

cd projectName

And then use the php artisan command to start a development server:

php artisan serve

Your Laravel application will now be running locally at http://localhost:8000.

Practice Code:

Here’s an example of creating a simple route in Laravel:

Open the routes/web.php file in your project and add a route:

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');

This code sets up a route that will display the welcome.blade.php view when you visit the root URL of your application.


By following these steps, you should have Laravel installed on your Ubuntu system and a basic understanding of how to create a new Laravel project and set up a simple route. Laravel’s documentation is rich with information on how to proceed further with building your web application.

Check our tools website Word count
Check our tools website check More tutorial

Leave a Reply