Skip to content

Instantly share code, notes, and snippets.

@jewishmoses
Last active June 4, 2021 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jewishmoses/f2fc40ab28377592ffd48db275b82101 to your computer and use it in GitHub Desktop.
Save jewishmoses/f2fc40ab28377592ffd48db275b82101 to your computer and use it in GitHub Desktop.
Make your Linux machine ready for Laravel (without npm)
# Updating the system
sudo apt update
sudo apt upgrade
# Make PHP 8 available to Install
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
# Installing PHP and Laravel required packages
sudo apt install php nginx curl php-curl mysql-server php-fpm php-mysql php-bcmath php8.0-ctype php8.0-fileinfo php-json php-mbstring php8.0-pdo php-tokenizer php-xml php-zip zip unzip -y
# Uninstalling apache
sudo systemctl disable apache2
sudo systemctl stop apache2
sudo apt remove apache2
# Installing Composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
# MySQL setup
mysql_secure_installation
wget -O "set-password.sql" "https://gist.githubusercontent.com/jewishmoses/9cb2ecb7e9e502a00e09aa60b6aebf30/raw/set-password.sql"
nano "set-password.sql" # replace 'password' with a password of your liking
sudo mysql < "set-password.sql"
rm set-password.sql
# Creating non-root user
sudo adduser website
# Change PHP-FPM user and group
sudo nano /etc/php/8.0/fpm/pool.d/www.conf # replace user and group to 'website'
# Restart PHP-FPM
sudo service php8.0-fpm reload
sudo service php8.0-fpm restart
# Restart system
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment