If you are a developer in search of a comprehensive, user-friendly framework for web application development, Laravel is a superb choice. This article provides a detailed step-by-step guide on installing Laravel on Linux Mint 21.
Introduction to Laravel
Laravel is a highly robust MVC (Model-View-Controller) PHP framework. It’s tailored for developers seeking an elegant, streamlined toolkit to build feature-rich web applications. Laravel simplifies various tasks such as authentication, routing, caching, and sessions, making it a favorite among developers.
Before we delve into the installation process, let’s discuss the prerequisites.
Prerequisites
- A server operating on Linux Mint 21.
- A fresh OS installation is advisable to circumvent potential issues.
- Basic knowledge of the command line is beneficial.
- An active internet connection.
- Administrative privileges or sudo access for software installation and configuration.
Laravel Installation on Linux Mint 21
Step 1: Update System
Before we embark on installing Laravel, make sure your Linux Mint 21 system is updated and equipped with the necessary software.
sudo apt update sudo apt upgrade
Step 2: Install LAMP Stack
Laravel necessitates a web server, a database server, and PHP for proper functioning. The best way to set these up on Linux Mint is through the LAMP (Linux, Apache, MySQL, PHP) stack.
To install LAMP, run the following commands:
sudo apt update sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql
Step 3: Install Composer
Composer is indispensable for Laravel’s dependency management. Install Composer globally using these commands:
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer chmod +x /usr/local/bin/composer
To verify the installation, check Composer’s version:
composer --version
Step 4: Install Laravel on Linux Mint 21
With Composer in place, Laravel can now be installed globally. This allows the creation of new Laravel projects from anywhere in your system:
composer global require laravel/installer
Make sure your system can locate the laravel
executable by adding the ~/.composer/vendor/bin
directory to your system’s PATH. Add the following line to your ~/.bashrc
or ~/.zshrc
file:
export PATH="$HOME/.composer/vendor/bin:$PATH"
Apply the changes by sourcing your profile:
source ~/.bashrc # Or source ~/.zshrc if you are using zsh
Step 5: Create a New Laravel Project
With Laravel installed, a new project can be created using the following command:
laravel new my_laravel_project
Replace my_laravel_project
with your preferred project name.
Navigate to your project directory and start the Laravel development server:
cd my_laravel_project php artisan serve
Finally, your Laravel application can be accessed by visiting http://localhost:8000
in your web browser.
If you find the whole process time-consuming or outside of your area of expertise, we offer a “VPS Management Service”, starting. Please contact us for the best deal. We provide reliable Linux SSD VPS services for businesses seeking efficient, scalable, and secure cloud hosting solutions.