#!/bin/bash tmp=$(mktemp) whiptail --msgbox "Installing LAMP + Redis" 7 27 apt install apache2 libapache2-mod-php php mysql-server mysql-client php-mysql redis php-redis php-ctype php-curl php-xml php-fileinfo php-gd php-json php-mbstring php-zip -y if [ $? != 0 ]; then echo -e "\033[0;31mapt failed to run" exit 1 fi a2enmod rewrite if [ $? != 0 ]; then echo -e "\033[0;31mCould not enable mod_rewrite" exit 1 fi systemctl restart apache2 if [ $? != 0 ]; then echo -e "\033[0;31mCould not restart apache2" exit 1 fi whiptail --msgbox "Enabling overwrites for host" 7 32 cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak awk '//{f=1}f{sub(/None/, "All")}/<\/Directory>/{f=0}{print $0}' /etc/apache2/apache2.conf > "$tmp" && mv "$tmp" /etc/apache2/apache2.conf if [ $? != 0 ]; then echo -e "\033[0;31mCould not modify apache2 con exit 1 fig" exit 1 fi whiptail --msgbox "Secure MySQL Installation" 7 29 mysql_secure_installation if [ $? != 0 ]; then echo -e "\033[0;31mCould not secure MySQL installation" exit 1 fi whiptail --msgbox "Installing Composer" 7 23 php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" if [ $? != 0 ]; then echo -e "\033[0;31mCould not download composer setup" exit 1 fi php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" if [ $? != 0 ]; then echo -e "\033[0;31mCould not verify composer setup" exit 1 fi php composer-setup.php if [ $? != 0 ]; then echo -e "\033[0;31mCould not run composer setup" exit 1 fi php -r "unlink('composer-setup.php');" if [ $? != 0 ]; then echo -e "\033[0;31mCould not remove composer setup" exit 1 fi mv composer.phar /usr/local/bin/composer if [ $? != 0 ]; then echo -e "\033[0;31mCould not install composer" exit 1 fi