Skip to content

Instantly share code, notes, and snippets.

@amarjit-singh
Last active December 17, 2021 17:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amarjit-singh/d3f72725751adcde3e753b6e13704e36 to your computer and use it in GitHub Desktop.
Save amarjit-singh/d3f72725751adcde3e753b6e13704e36 to your computer and use it in GitHub Desktop.
Bash file to install lamp stack
#!/bin/bash
Color_Off='\033[0m' # Text Reset
# Regular Colors
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Purple='\033[0;35m' # Purple
Cyan='\033[0;36m' # Cyan
# Update packages and Upgrade system
echo -e "$Cyan \n Updating System.. $Color_Off"
apt-get update
apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php -y
apt-get update
echo -e "$Cyan \n Installing Apache2 $Color_Off"
apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert -y
echo -e "$Cyan \n Installing PHP & Requirements $Color_Off"
apt-get install php7.2 libapache2-mod-php php7.2-mysql php7.2-curl php7.2-common php7.2-dev php7.2-gd php7.2-idn php7.2-pear php7.2-imagick php7.2-mcrypt php7.2-ps php7.2-pspell php7.2-recode php7.2-xsl php7.2-json php7.2-cgi -y
echo -e "$Cyan \n Installing MySQL $Color_Off"
apt-get install mysql-server -y
echo -e "$Cyan \n Installing phpMyAdmin $Color_Off"
apt-get install phpmyadmin -y
## TWEAKS and Settings
# Permissions
echo -e "$Cyan \n Permissions for /var/www $Color_Off"
chown -R www-data:www-data /var/www
echo -e "$Green \n Permissions have been set $Color_Off"
# Enabling Mod headers and Rewrite, required for WordPress permalinks and .htaccess files
echo -e "$Cyan \n Enabling Modules $Color_Off"
a2enmod rewrite && a2enmod headers
# Restart Apache
echo -e "$Cyan \n Restarting Apache $Color_Off"
service apache2 restart
@amarjit-singh
Copy link
Author

amarjit-singh commented Sep 11, 2018

Install Lamp stack in just 2 commands

cd ~ && wget https://gist.githubusercontent.com/amarjit-singh/d3f72725751adcde3e753b6e13704e36/raw/87feedf65e51c07a6debf8c4a2c71ce4a9b66b24/lamp_setup.sh

chmod -x ./lamp_setup.sh && sudo sh ./lamp_setup.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment