Skip to content

Instantly share code, notes, and snippets.

@anupkrbid
Last active September 9, 2017 09:40
Show Gist options
  • Save anupkrbid/39a3f6d650632ab47c076bccf523dc6d to your computer and use it in GitHub Desktop.
Save anupkrbid/39a3f6d650632ab47c076bccf523dc6d to your computer and use it in GitHub Desktop.
Bash Script to setup LAMP Stack on Ubuntu 16.04 along with composer
#!/bin/bash
printf "\033[1;31m/** Updating Packages ... */ \033[0m\n"
sudo apt-get update
printf "\033[1;31m/** Installing Apache2 as Web Server ... */\033[0m\n"
sudo apt-get install -y apache2
printf "\033[1;31m/** Restarting Apache2 Web Server ... */\033[0m\n"
sudo systemctl restart apache2
printf "\033[1;31m/** Installing MySQL as Database ... */\033[0m\n"
sudo apt-get install -y mysql-server
printf "\033[1;31m/** Configuting MySQL ... */\033[0m\n"
mysql_secure_installation
printf "\033[1;31m/** Installing PHP 7.0 using PPA ... */\033[0m\n"
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.0
printf "\033[1;31m/** Installing Additional PHP 7.0 Moduless ... */\033[0m\n"
sudo apt-get -y install curl php7.0-zip libapache2-mod-php7.0 php7.0-mbstring php7.0-mcrypt php7.0-cgi php7.0-cli php7.0-common php7.0-curl php7.0-dom php7.0-mysql php-token-stream php7.0-fpm php7.0-gd php-gettext
printf "\033[1;31m/** Installing phpMyAdmin ... */\033[0m\n"
sudo apt-get install -y phpmyadmin
sudo echo 'Include /etc/phpmyadmin/apache.conf' >> /etc/apache2/apache2.conf
printf "\033[1;31m/** Enabling Modules for Laravel ... */\033[0m\n"
sudo phpenmod mcrypt mbstring curl gettext
sudo a2enmod rewrite
sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.0-fpm
sudo a2enmod php7.0
printf "\033[1;31m/** Restarting PHP ... */\033[0m\n"
sudo systemctl restart php7.0-fpm
printf "\033[1;31m/** Restarting Apache2 Web Server to Apply New Configurations ... */\033[0m\n"
sudo service apache2 reload
sudo systemctl restart apache2
printf "\033[1;31m/** Installing GIT ... */\033[0m\n"
sudo apt install -y git
printf "\033[1;31m/** Installing Composer ... */\033[0m\n"
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
printf "\033[1;31m/** Cleaning unnecesary files from apt-get ... */\033[0m\n"
sudo apt-get clean
printf "\033[1;31m/** Done */\033[0m\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment