To install Laravel 9x on your Ubuntu machine from scratch, you can follow these steps:
1.Install PHP and other dependencies:
ShellScript
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.2 php8.2-cli php8.2-mbstring php8.2-xml php8.2-zip
2.Install Composer:
PowerShell
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
3.Install Laravel:
ShellScript
composer global require laravel/installer
4.Add the Composer global bin directory to your PATH:
ShellScript
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
source ~/.bashrc
5.Create a new Laravel project:
ShellScript
laravel new myproject
6.Start the development server:
ShellScript
cd myproject
compose install
php artisan serve