# How to install Laravel on Ubuntu 22.04

The PHP framework Laravel provides an **extensive collection of libraries and components** for PHP development. Here you can find out what the requirements for installation are and how to install Laravel on Ubuntu 22.04.

## What are the requirements for Laravel?

There are not many requirements that your system needs to meet in order to use Laravel on Ubuntu 22.04. Since Laravel is a PHP framework, you’ll need to make sure you have PHP installed on your Ubuntu server. The specific **PHP version** you need depends on **which version of Laravel** you want to use. The official documentation currently (as at June 2023) recommends the following:

<table>
  <thead>
    <tr>
      <th>Laravel version</th>
      <th>Supported PHP versions</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>9</td>
      <td>8.0 to 8.2</td>
    </tr>
    <tr>
      <td>10</td>
      <td>8.1 to 8.2</td>
    </tr>
    <tr>
      <td>11</td>
      <td>8.2</td>
    </tr>
  </tbody>
</table>

Although PHP comes **installed on Ubuntu by default**, you should still check which version you are currently using. To do this, execute the following command in the terminal:

```bash
php -v
```

After entering the command, the output should look like this:

[![Image: Ubuntu terminal: PHP version check](https://www.ionos.com/en-ie/digitalguide/fileadmin/_processed_/9/5/csm_php-version-check_41817f90da.webp "Ubuntu terminal: PHP version check")](https://www.ionos.com/en-ie/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/php-version-check.png) You can check the PHP version in the Ubuntu terminal. In this example, you can see that PHP version 8.1.2 is installed and functioning properly.

Note If you have set up your server with a minimal installation, you‘ll need to install PHP and configure it before you can proceed.

Laravel developer Taylor Otwell recommends using the **PHP package management system** [Composer](https://getcomposer.org/). You can find out more about this handy package tool in our step-by-step guide on how to install Composer on Ubuntu.

## How to install Laravel on Ubuntu 22.02: step-by-step instructions

Once you have a compatible PHP version and Composer, you can install Laravel on Ubuntu 22.04. To do this, open the terminal and navigate to your system’s **HTML directory**.

```bash
cd /var/www/html/
```

To install the PHP framework, execute the following command in this directory:

```bash
sudo composer create-project laravel/laravel test-project
```

Instead of using ‘test-project’, you can choose a name for the PHP application you want to create with Laravel. If the setup is successful, you will receive a message that says, ‘Application key set successfully.’

[![Image: Ubuntu terminal: PHP framework Laravel successfully installed](https://www.ionos.com/en-ie/digitalguide/fileadmin/_processed_/6/6/csm_laravel-installation-successfully_601b6f5be4.webp "Ubuntu terminal: PHP framework Laravel successfully installed")](https://www.ionos.com/en-ie/digitalguide/fileadmin/DigitalGuide/Screenshots_2023/laravel-installation-successfully.png) To start the installation process, use administrator privileges to confirm the execution of the installation via Composer. After the installation is complete, grant the directory for the Laravel application that you just added (referred to as ‘test-project’ in this tutorial) **ownership of the server**. You can do this by executing the following commands:

```bash
sudo chown -R www-data:www-data /var/www/html/test-project
sudo chmod -R 775 /var/www/html/test-project/storage
```

To verify the installation, navigate to the directory of the Laravel application and execute the following command:

```bash
php artisan
```

Tip It’s best to have **MySQL** or an alternative database management system installed when working with Laravel. Additionally, having the web server **Apache** (if not already installed) is also useful. For optimal compatibility, we recommend installing the popular LAMP-stack.


This is a markdown version of: [https://www.ionos.com/en-ie/digitalguide/websites/web-development/install-laravel-on-ubuntu/](https://www.ionos.com/en-ie/digitalguide/websites/web-development/install-laravel-on-ubuntu/) for AI/LLM consumption.