2025-03-04 20:24:34 +01:00

38 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Ensure the script runs with root privileges
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Update package list and install necessary packages
apt-get update
apt-get install -y mariadb-server
service mariadb start
###
# Set debconf to non-interactive mode
export DEBIAN_FRONTEND=noninteractive
# Set the phpMyAdmin password (leave blank for random password)
PHPADMIN_PASSWORD=""
# Set the web server (1 for apache2, 2 for lighttpd)
WEB_SERVER="apache2"
# Preconfigure the phpMyAdmin installation
echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/app-password-confirm password $PHPADMIN_PASSWORD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/admin-pass password" | debconf-set-selections
echo "phpmyadmin phpmyadmin/mysql/app-pass password $PHPADMIN_PASSWORD" | debconf-set-selections
echo "phpmyadmin phpmyadmin/reconfigure-webserver select $WEB_SERVER" | debconf-set-selections
# Install phpMyAdmin
apt install -y phpmyadmin
# If using apache2, restart the apache2 service (adjust if using other web servers)
service apache2 restart
echo "phpMyAdmin installation completed successfully."