Created
March 12, 2019 04:51
-
-
Save ashishtz/7918b2d7c757b85bc6c77991084b4293 to your computer and use it in GitHub Desktop.
Shell script to install apache2, php, mysql and phpmyadmin.
This file contains 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/sh | |
#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" | |
sudo apt-get update -y && sudo apt-get upgrade -y | |
## Install AMP | |
echo -e "$Cyan \n Installing Apache2 $Color_Off" | |
sudo apt-get install apache2 -y | |
## Install AMP | |
echo -e "$Cyan \n Allowing apache2 $Color_Off" | |
sudo sudo ufw allow in "Apache Full" | |
echo -e "$Cyan \n Installing PHP & Requirements $Color_Off" | |
sudo apt-get install libapache2-mod-php php php-common php-curl php-dev php-gd php-pear php-mysql -y | |
echo -e "$Cyan \n Installing MySQL $Color_Off" | |
sudo apt-get install mysql-server -y | |
echo -e "$Cyan \n Securing Mysql $Color_Off" | |
sudo mysql_secure_installation | |
echo -e "$Cyan \n Installing phpMyAdmin $Color_Off" | |
sudo apt-get install phpmyadmin -y | |
# Permissions | |
echo -e "$Cyan \n Permissions for /var/www $Color_Off" | |
sudo 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" | |
sudo a2enmod rewrite | |
# Restart Apache | |
echo -e "$Cyan \n Restarting Apache $Color_Off" | |
sudo service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to download a file from the server,
wget https://gist.githubusercontent.com/ashishpatel6958/7918b2d7c757b85bc6c77991084b4293/raw/shell.sh
chmod -x ./shell.sh
and run the script by
$ sh shell.sh
Once the above process is complete, follow below steps,
Login to mySql
Get list of users
modify root/create a new user
Flush privileges:
Check modification
Exit.
and your setup has been finished.