DEV Community

Cover image for How to easily install Laravel on Ubuntu
Sameer's Code Canvas
Sameer's Code Canvas

Posted on

How to easily install Laravel on Ubuntu

Here's a step-by-step guide to installing Laravel on Ubuntu:

Step 1: Install PHP: Laravel is a PHP framework, so you need to have PHP installed on your Ubuntu system. To install PHP, open a terminal window and run the following command:

"sudo apt-get install php"

Image description

Step 2: Install Composer: Laravel uses Composer, a package manager for PHP, to manage its dependencies. To install Composer, run the following commands in your terminal:

"curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer"

Image description

Step 3: Install Laravel: Once you have PHP and Composer installed, you can use Composer to install Laravel. Run the following command in your terminal:

"composer global require laravel/installer"

Image description

Step 4: Add Laravel to your PATH: To use the laravel command globally, you need to add it to your system's PATH. Open the ~/.bashrc file using your preferred text editor and add the following line at the end of the file:

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

Image description

Step 5: Save and close the file. To activate the changes, run the following command:

"source ~/.bashrc"

Image description

Step 6: Create a new Laravel project: Now that you have installed Laravel, you can create a new Laravel project by running the following command:

"laravel new project-name"

Image description

That's it! You have successfully installed Laravel on your Ubuntu system and created a new Laravel project.

Top comments (0)