Linux MintUbuntu Based

How To Install Laravel on Linux Mint 21

Install Laravel on Linux Mint 21

In this tutorial, we will show you how to install Laravel on Linux Mint 21. Laravel, a robust MVC (Model-View-Controller) PHP framework, is designed for developers who need a simple and elegant toolkit to create full-featured web applications. Laravel simplifies tasks such as routing, authentication, sessions, and caching, making it highly popular among developers.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Laravel PHP web application framework on a Linux Mint 21.

Prerequisites

  • A server running one of the following operating systems: Linux Mint 21.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • While we’ll guide you through the process, a basic understanding of the command line will be beneficial. If you’re new to the CLI, you might want to acquaint yourself with some fundamental commands.
  • An active internet connection.
  • Administrative privileges are essential for installing and configuring software on your system. Ensure that you have superuser or sudo access.

Install Laravel on Linux Mint 21

Step 1. Before installing Laravel, ensure your Linux Mint 21 system is up-to-date and has the necessary software installed.

sudo apt update
sudo apt upgrade

Step 2. Installing LAMP Stack.

Laravel requires a web server, database server, and PHP to run properly. The quickest way to get these set up on Linux Mint is by installing the LAMP (Linux, Apache, MySQL, PHP) stack. Run the following commands to install LAMP:

sudo apt update sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql

Step 3. Installing Composer.

Composer is essential for managing Laravel‘s dependencies. Install Composer globally using the following commands:

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

Verify the installation by checking Composer‘s version:

composer --version

Step 4. Installing Laravel on Linux Mint 21.

With Composer installed, you can now install Laravel globally. This allows you to create new Laravel projects from anywhere in your system:

composer global require laravel/installer

Ensure the ~/.composer/vendor/bin directory is in your system’s PATH so that the laravel executable can be located by your system. Add the following line to your ~/.bashrc or ~/.zshrc file:

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

Source your profile to apply the changes:

source ~/.bashrc
# Or
source ~/.zshrc if you are using zsh

Step 5. Create a New Laravel Project.

Now that Laravel is installed, you can create a new project using the following command:

laravel new my_laravel_project

Replace my_laravel_project with your desired project name.

Navigate to your project directory and start the Laravel development server:

cd my_laravel_project
php artisan serve

Finally, you can now access your Laravel application by visiting http://localhost:8000 in your web browser.

Install Laravel on Linux Mint 21

Congratulations! You have successfully installed Laravel. Thanks for using this tutorial to install the latest version of the Laravel PHP web application framework on the Linux Mint system. For additional help or useful information, we recommend you check the official Laravel website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button