From 7c5109a5517556eb98082748189a72a59cd466ff Mon Sep 17 00:00:00 2001 From: fadmin Date: Tue, 9 Jun 2026 03:40:38 -0400 Subject: [PATCH] install-LAMP-phpMyAdmin-PHP82.sh --- install-LAMP-phpMyAdmin-PHP82.sh | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 install-LAMP-phpMyAdmin-PHP82.sh diff --git a/install-LAMP-phpMyAdmin-PHP82.sh b/install-LAMP-phpMyAdmin-PHP82.sh new file mode 100644 index 0000000..5fa7fd1 --- /dev/null +++ b/install-LAMP-phpMyAdmin-PHP82.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# 1. Prompt for the MySQL Root Password +echo "Enter the desired MySQL root password:" +read -s SECURE_PASS +echo "Confirm the MySQL root password:" +read -s SECURE_PASS_CONFIRM + +if [ "$SECURE_PASS" != "$SECURE_PASS_CONFIRM" ]; then + echo "Passwords do not match. Exiting." + exit 1 +fi + +# 2. Setup Remi Repository for PHP 8.2 +sudo dnf install -y https://rpms.remirepo.net/fedora/remi-release-$(rpm -E %fedora).rpm +sudo dnf install -y dnf-plugins-core +sudo dnf module reset php -y +sudo dnf module enable php:remi-8.2 -y + +# 3. Update and Install Packages +sudo dnf update -y +sudo dnf install -y httpd mariadb-server php php-mysqlnd php-mbstring \ +php-gd php-xml php-zip php-curl php-imap php-pecl-apcu phpmyadmin + +# 4. Start Services +sudo systemctl enable --now httpd +sudo systemctl enable --now mariadb + +# 5. Set MySQL Root Password +sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$SECURE_PASS';" +sudo mysql -e "FLUSH PRIVILEGES;" + +# 6. Configure PHPMyAdmin and Firewall +sudo sed -i 's/Require local/Require all granted/g' /etc/httpd/conf.d/phpMyAdmin.conf +sudo firewall-cmd --permanent --add-service={http,https} +sudo firewall-cmd --reload +sudo setsebool -P httpd_can_network_connect_db 1 +sudo setsebool -P httpd_can_network_connect 1 + +# 7. Restart Apache +sudo systemctl restart httpd + +echo "------------------------------------------------" +echo "LAMP Installation Complete!" +echo "------------------------------------------------" + +# 8. CALL THE NEXT SCRIPT +# Replace 'add_vhost.sh' with the name of your secondary script +NEXT_SCRIPT="./add_vhost.sh" + +if [ -f "$NEXT_SCRIPT" ]; then + echo "Found $NEXT_SCRIPT. Launching post-install setup..." + chmod +x "$NEXT_SCRIPT" + sudo "$NEXT_SCRIPT" +else + echo "No follow-up script found at $NEXT_SCRIPT. Finished." +fi