-
Notifications
You must be signed in to change notification settings - Fork 31
lamp.sh
#! /bin/bash/
#Credit to rbgeek.wordpress.com for Automated installation of LAMP stack on Ubuntu Server accessed: Dec 21, 2016
#Adapted using digitalocean.com "how-to-install-linux-apache-mysql-php-lamp-stack-on-ubunutu-16-04" and "how-to-install-lamp-on-ubuntu-14-04-quickstart" accessed: Dec 21, 2016
#Instructions to use this script
#
#source lamp.sh
#
echo "###################################################################################"
echo "Please be Patient: Installation will start now.......and it will take some time :) Some portions of the inst
allation are interactive"
echo "###################################################################################"
#Check which platform using
read -p "What platform are you using? [ubuntu14,ubuntu16,other] : " platform
#Update the repositories
#Apache, Php, MySQL and required packages installation
#Install apache2
#Install mysql and run secure installation
#Install PHP
#Restart all the installed services to verify that everything is installed properly
if [ "$platform" = "ubuntu14" ]; then
sudo apt-get update
sudo apt-get -y install apache2
sudo apt-get install mysql-server
sudo mysql_secure_installation
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-mysql
sudo service apache2 restart
sudo service mysql restart
elif [ "$platform" = "ubuntu16" ]; then
sudo apt-get update
sudo apt-get -y install apache2
sudo apt-get install mysql-server
sudo mysql_secure_installation
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
sudo systemctl restart apache2
sudo systemctl restart mysql
else
echo "ERROR: Other option not available at this time"
fi
if [ $? -ne 0 ]; then
echo "Please Check the Install Services, There is some $(tput bold)$(tput setaf 1)Problem$(tput sgr0)"
else
echo "Installed Services run $(tput bold)$(tput setaf 2)Sucessfully$(tput sgr0)"
fi
echo -e "\n"