Install Laravel in window or Ubuntu example; In this tutorial we will show you how to Install Laravel 9 or 8 in Ubuntu or Windows xamp server and how to setup the basic database credentials for installing laravel application.
If you are windows user then your must need download composer from internet and install them, after that all work same as unbuntu. Here in this tutorial we are using laravel 9, but you can use any other laravel version as well. Let’s see laravel installation and basic configuration in ubuntu or window 10 xamp server.
Prerequests for Laravel 9 Installation
- PHP >= 7.3
- BCMath PHP Extension
- Ctype PHP Extension
- Fileinfo PHP extension
- JSON PHP Extension
- Mbstring PHP Extension
- OpenSSL PHP Extension
- PDO PHP Extension
- Tokenizer PHP Extension
- XML PHP Extension
Install Laravel 9 in Unbuntu
Method 1: You can also install Laravel using composer:
composer create-project --prefer-dist laravel/laravel laravel-app
Method 2: You can install Laravel using Laravel installer
# install installer
composer global require laravel/installer
# create project
laravel new laravel-app
Install Laravel 9 on Windows 10 XAMPP
If you are installing laravel app in windows xampp server and not added composer in your system then you need to add composer first. Go to this site and download the composer then install it after that run the below command which will generate new laravel project in your xampp/htdocs directory.
After that run below command
cd xampp
cd htdocs
After that run
composer create-project --prefer-dist laravel/laravel laravel-app
Database Configuration
In the Laravel project, there is a file called .env. It’s for project configuration. To connect with the database we need to set database credentials.
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
Install Laravel UI
Laravel UI is an official package that contains the extracted UI parts from a Laravel project. To generate UI scaffolding, we first need to install the laravel/ui.
composer require laravel/ui
Once the laravel/ui package has been installed, you may install the frontend scaffolding using the ui Artisan command:
Generate basic scaffolding
/**
* Generate basic scaffolding
* Run one command only
*/
php artisan ui bootstrap
php artisan ui vue
php artisan ui react
Generate Auth scaffolding (Laravel 9 Auth)
For generation authentication in laravel 9 app you need to run below command as per your requirements.
/**
* Generate login / registration scaffolding
* Run one command if needed auth or skip this
*/
php artisan ui bootstrap --auth
php artisan ui vue --auth
php artisan ui react --auth
After that you need to run the following commands:
npm install && npm run dev
# migrate database
php artisan migrate
Run Development and Start Laravel App
All are setips now run your development server using the following command:
php artisan serve
Now run the url in your browser a laravel app is running…
http://localhost:8080/
I hope you like this post.. hope you enjoy it…
5 thoughts on “Install Laravel 9 in Ubuntu or Windows 10 XAMPP”