Skip to content

Instantly share code, notes, and snippets.

@LoganGray
Last active September 26, 2024 21:26
Show Gist options
  • Save LoganGray/bab412798fc7c8962b23c126ecd02974 to your computer and use it in GitHub Desktop.
Save LoganGray/bab412798fc7c8962b23c126ecd02974 to your computer and use it in GitHub Desktop.
laravel 2024 setup on Linux Dev box - this'll basically install all the standard stuff. with option to install DB
#!/bin/bash
# Update package list
sudo apt update
# Install PHP and required extensions
sudo apt install -y php php-cli php-fpm php-json php-common php-zip php-gd php-mbstring php-curl php-xml php-bcmath
# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Install Node.js and npm (using the latest LTS version)
# curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# sudo apt install -y nodejs
# Install Node but maybe use Volta instead??
# install Volta
curl https://get.volta.sh | bash
# install Node
volta install node
# Install Git
sudo apt install -y git
# Database selection
echo "Please select a database to install:"
echo "1) MySQL"
echo "2) MariaDB"
echo "3) PostgreSQL"
echo "4) No database (default)"
read -p "Enter your choice (1-4): " db_choice
case $db_choice in
1)
echo "Installing MySQL..."
sudo apt install -y mysql-server
sudo apt install -y php-mysql
;;
2)
echo "Installing MariaDB..."
sudo apt install -y mariadb-server
sudo apt install -y php-mysql
;;
3)
echo "Installing PostgreSQL..."
sudo apt install -y postgresql postgresql-contrib
sudo apt install -y php-pgsql
;;
*)
echo "No database selected. Skipping database installation."
;;
esac
# Install Laravel globally via Composer
composer global require laravel/installer
# Add Composer's global bin to PATH
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
source ~/.bashrc
echo "Laravel requirements installation completed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment