thelinuxlist/scripts/pmainstall.sh

53 lines
1.6 KiB
Bash

#!/bin/bash
while true
do
read -r -p "Would you like to install phpMyAdmin? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
break
;;
*)
echo "That wasn't an option..."
;;
esac
done
sudo apt update && apt upgrade -y
sudo add-apt-repository ppa:ondrej/php && apt install libapache2-mod-php8.1 -y
sudo systemtl stop apache2
sudo apt install apache2 -y
sudo apt install software-properties-common
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl -y
sudo echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
sudo phpenmod mbstring
sudo a2dismod php8.1
sudo a2dismod mpm_prefork
sudo a2disconf php7.4-fpm
sudo a2enmod mpm_event
sudo a2enmod proxy
sudo a2enmod proxy_fcgi
sudo a2enconf php8.1-fpm
sudo systemctl restart php8.1-fpm
sudo systemctl enable apache2
sudo systemctl restart apache2
echo -e "=================================================================="
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
echo "phpMyAdmin Should be available at http://${intenalip}/phpmyadmin"
echo "Or If you are using a VPS at http://${publicipaddress}/phpmyadmin"
echo -e "=================================================================="