Last active
June 28, 2024 05:51
-
-
Save beneyraheem/dcc212b5be0741b05d301c10326459b4 to your computer and use it in GitHub Desktop.
Set up Ubuntu for a Laravel project, including the latest PHP, Composer, Node.js, Git, Nginx, and MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Update and upgrade the system | |
sudo apt update && sudo apt upgrade -y | |
# Install necessary dependencies | |
sudo apt install -y software-properties-common curl gnupg2 ca-certificates lsb-release | |
# Add repositories for PHP, Node.js, and MySQL | |
sudo add-apt-repository ppa:ondrej/php -y | |
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - | |
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.17-1_all.deb | |
sudo dpkg -i mysql-apt-config_0.8.17-1_all.deb | |
sudo apt update | |
# Install PHP, Composer, Node.js, Git, Nginx, and MySQL | |
sudo apt install -y php8.3 php8.3-fpm php8.3-mysql php8.3-xml php8.3-mbstring php8.3-zip php8.3-curl php8.3-xmlrpc php8.3-gd php8.3-intl | |
sudo apt install -y nodejs build-essential | |
sudo apt install -y git nginx mysql-server | |
# Install Composer | |
curl -sS https://getcomposer.org/installer | php | |
sudo mv composer.phar /usr/local/bin/composer | |
# Enable and start services | |
sudo systemctl enable php8.3-fpm | |
sudo systemctl enable nginx | |
sudo systemctl enable mysql | |
sudo systemctl start php8.3-fpm | |
sudo systemctl start nginx | |
sudo systemctl start mysql | |
# Secure MySQL installation | |
sudo mysql_secure_installation | |
# Display versions | |
php -v | |
composer -V | |
node -v | |
npm -v | |
git --version | |
nginx -v | |
mysql --version | |
echo "Basic setup for Laravel project completed." | |
Save this script to a file, for example, setup_laravel_env.sh, make it executable, and run it: | |
chmod +x setup_laravel_env.sh | |
./setup_laravel_env.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment