Skip to content

Instantly share code, notes, and snippets.

@istiyakamin
Last active October 30, 2019 13:05
Show Gist options
  • Save istiyakamin/db534a51323a401ec98bdd4305768c72 to your computer and use it in GitHub Desktop.
Save istiyakamin/db534a51323a401ec98bdd4305768c72 to your computer and use it in GitHub Desktop.
Simple run this file automatically install LAMP server within 1 minute
#!/bin/bash
# Update Package
sudo apt update
# Upgrade Package
sudo apt upgrade
# Install Apache2, MySQL, PHP
sudo apt install apache2
# Activate Apache2 Rules
sudo a2enmod rewrite mod-mime
# Install MySQL
sudo apt install mysql-server
# Install PHP
sudo apt install php
# Install PHP Module
sudo apt install php-pear php-fpm php-dev php-xdebug php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php libapache2-mod-php php-cli
# Allow to run Apache on boot up
sudo systemctl enable apache2
# Restart Apache Web Server
sudo systemctl start apache2
# Adjust Firewall
sudo ufw allow in "Apache Full"
# Allow Read/Write for Owner
sudo chmod -R 0755 /var/www/html/
# Create info.php for testing php processing
sudo echo "<?php phpinfo(); ?>" > /var/www/html/info.php
# Open localhost in the default browser
xdg-open "http://localhost"
xdg-open "http://localhost/info.php"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment