Saturday, February 4, 2023

Laravel 9 Installation on Ubuntu 22.04 LTS

Laravel is a web application framework with expressive, elegant syntax. 
We’ve already laid the foundation freeing you to create without sweating the small things.

Let's see how o create the first app using this greate framework

Install composer

First install composer
apt install composer

Install Additional php extensions

sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip

Create the app

Create the App
composer create-project laravel/laravel app

Edit .env

Set user and password for database connection
...
DB_USERNAME=laravel
DB_PASSWORD=password
...

Generate the key and cache the config

cd app
php artisan key:generate
php artisan config:cache

Create Database

mysql> CREATE DATABASE laravel DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql> CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL ON laravel.* TO 'laravel'@'localhost';
mysql> flush privileges;

Install Sanctum

composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"

Migrate Database

php artisan migrate

Install Breeze

composer require laravel/breeze --dev
php artisan breeze:install
Select 2

Using Vue

Install Node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm list-remote
nvm install v18.13.0
npm install
npm run build

Launch the server

php artisan serve --host=0.0.0.0

No comments:

Post a Comment