How to install Laravel the desired version

Learn how to install a specific version of Laravel with an example.

Installing Laravel is a straightforward process. The first step is to download the desired version of Laravel from the official website.

The Laravel website provides a series of downloads, each of which is a ZIP file containing the Laravel software. For example, to download version 5.8 of Laravel, you can use the following link: https://laravel.com/docs/5.8/installation#installing-laravel

Steps to install Laravel

Once the ZIP file is downloaded, it must be extracted to the desired location on your server. After the extraction of the file, we need to open the command-line terminal and navigate to the Laravel root directory. To install Laravel, you must have Composer installed on your system.


sudo apt-get update
sudo apt-get install composer

Once Composer is installed, you can run the following command in the terminal to install Laravel:


composer create-project laravel/laravel[your-project-name] --prefer-dist

This will install the desired version of Laravel in the current working directory. Now, you need to configure the database credentials in the .env file. This file is located in the root of the project directory. You need to set the database name, username, and password.


DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=YOUR_DATABASE_NAME
DB_USERNAME=YOUR_DATABASE_USERNAME
DB_PASSWORD=YOUR_DATABASE_PASSWORD

After setting the database credentials, you can migrate the database by running the following command:


php artisan migrate

This will create the required tables in the database. Finally, you can run the Laravel application by running the following command:


php artisan serve

This will start the Laravel development server. You can access your application at http://localhost:8000.

Answers (0)