Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Install Laravel Framework on Ubuntu

Learn how to install Laravel framework on Ubuntu with clear steps, practical tips, and troubleshooting advice for a smoother, more reliable result.

Table of Contents

This practical guide walks through how to install Laravel framework on Ubuntu, explains the main requirements, and highlights common issues that may appear along the way.

In this article, TipsMake will learn how to install and set up the Laravel framework on an Ubuntu system.

Condition

  • Ubuntu Linux based system
  • Terminal Access
  • User account with sudo privileges.

Note : The commands in this tutorial are executed on an Ubuntu 20.04 system. All the methods in the tutorial are valid for any Linux based system.

System updates and upgrades

It is best practice to start any installation with an upgraded and up to date system but that is necessary as Laravel does not work with PHP versions lower than 7.2.

To update and upgrade the system, run the following command.

sudo apt update && apt upgrade -y

System updates and upgrades — How to Install Laravel Framework on Ubuntu

Install PHP

To install PHP on the system, run the following apt command.

sudo apt install php

Install PHP — How to Install Laravel Framework on Ubuntu

Once the installation is done, check the installed version with the following command.

php -v

Now install the PHP extension with the same version using the following command.

sudo apt install php7.4-mbstring php7.4-xml php7.4-zip

Install curl

Run the following command to install curl if you don't already have it installed.

sudo apt install curl

Install Composer

You need Composer to manage dependencies in Laravel.

To install Composer, run the following command.

ccurl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Run the following command with Composer file path to run without sudo privileges.

sudo chown -R $USER /usr/local/bin/composer/

Install Symfony

Laravel typically uses the Symfony framework, so it's best to install it alongside Laravel.

To install Symfony, run the following command.

composer create-project symfony/skeleton testproj

Change to testproj directory and run the following command

run php -S 127.0.0.1:8000 -t public

Open the following link in a browser to verify the installation.

http://localhost:8000/

Install Symfony — How to Install Laravel Framework on Ubuntu

Install Laravel

Now that everything is up and running, install Laravel using the following composer command.

composer global require laravel/installer

Add Laravel on the path in .bashrc

After installing Laravel, open the .bashrc file.

nano .bashrc

Then add the following line of code at the end of the file.

export PATH="$PATH:$HOME/.config/composer/vendor/bin"

Press Ctrl + O and Ctrl + X to save and exit.

Next start running the file bashrc.

source ~/.bashrc

Create a new Laravel application

Just run the following command to create an application in Laravel.

laravel new [tên ?ng d?ng]

Navigate to the application directory and run the following composer command.

cd [name of app] composer install

Now, run the following commands to get the encryption key and access the localhost.

php artisan key:generate --ansi php artisan serve

Note the development server link and open it in the browser.

http://localhost:8001

Create a new Laravel application — How to Install Laravel Framework on Ubuntu

You can see Laravel in action.

Key Takeaways

Use the information above as a practical reference for how to install Laravel framework on Ubuntu. Review each step carefully, confirm any requirements, and choose the option that best fits your situation.

FAQ

What does this guide explain about Install Laravel Framework on Ubuntu?

It explains the main concepts, practical considerations, and useful steps related to install Laravel framework on Ubuntu without requiring advanced knowledge.

Who can benefit from learning about Install Laravel Framework on Ubuntu?

This information is useful for readers who want a clear overview, practical guidance, and reliable steps related to install Laravel framework on Ubuntu.

What should I check before applying this information?

Review the requirements, confirm that your device, software, or situation matches the instructions, and back up important data before making major changes.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.