-
-
Save m45k174/78b1b5faa4c7a7af1c55c887cf3563f5 to your computer and use it in GitHub Desktop.
#!/bin/sh | |
####################################### | |
# Bash script to install an AMP stack and PHPMyAdmin plus tweaks. For Debian based systems. | |
# Written by @AamnahAkram from http://aamnah.com | |
# In case of any errors (e.g. MySQL) just re-run the script. Nothing will be re-installed except for the packages with errors. | |
####################################### | |
#COLORS | |
# Reset | |
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 -y && sudo apt-get upgrade -y | |
## Install AMP | |
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 libapache2-mod-php php php-common php-curl php-dev php-gd php-idn php-pear php-imagick php-mcrypt php-mysql php-ps php-pspell php-recode php-xsl -y | |
echo -e "$Cyan \n Installing MySQL $Color_Off" | |
apt-get install mysql-server mysql-client libmysqlclient15.dev -y | |
echo -e "$Cyan \n Installing phpMyAdmin $Color_Off" | |
apt-get install phpmyadmin -y | |
echo -e "$Cyan \n Verifying installs$Color_Off" | |
apt-get install apache2 libapache2-mod-php php mysql-server php-pear php-mysql mysql-client mysql-server php-mysql php-gd -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 Rewrite, required for WordPress permalinks and .htaccess files | |
echo -e "$Cyan \n Enabling Modules $Color_Off" | |
a2enmod rewrite | |
phpenmod mcrypt | |
# Restart Apache | |
echo -e "$Cyan \n Restarting Apache $Color_Off" | |
service apache2 restart |
https://gist.github.com/Rushabhsorathia/e9646482e7185ee1313093a406129240
π οΈ Git Installation: Installs the Git version control system for managing your code repositories.
π Apache Installation: Sets up the Apache HTTP Server and configures the necessary firewall rules for web server functionality.
ποΈ MySQL Installation: Installs MySQL Server and provides options to secure your installation, ensuring a robust database setup.
π§© PHP Installation: Adds the PHP repository and installs multiple PHP versions (7.4, 8.0, 8.1, 8.2, 8.3) along with common modules for diverse development needs.
π phpMyAdmin Installation: Installs phpMyAdmin for easy database management with default credentials (Username: root, Password: password).
π Custom PHP Switch: Clones and executes a custom PHP version switcher script, allowing you to switch PHP versions effortlessly.
#COLORS
Reset
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
Why is this portion used
Update for Debian 9:
php5 -- > php
removed the sudo
Use "su" before running the script.