Commit f07e77bf authored by w4t's avatar w4t

wtserver 0.10

parent 92dbbb65
......@@ -10,7 +10,7 @@ InstallphpMyAdmin() {
phpMyAdmin="5.2.2" #phpMyAdmin version
blowfish="hu67jty85Fgh6TRfcjiw50720fghTyjT" # blowfish 32 char secret maybe it can be autogenerated
echo -n -e "$IDENTATION_LVL_1 Creating necessary directories... "
echo -n -e "$IDENTATION_LVL_2 Creating necessary directories... "
# Create necessary directories
mkdir /usr/share/phpmyadmin
mkdir /etc/phpmyadmin
......@@ -19,7 +19,7 @@ InstallphpMyAdmin() {
touch /etc/phpmyadmin/htpasswd.setup
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Downloading phpMyAdmin... "
echo -n -e "$IDENTATION_LVL_2 Downloading phpMyAdmin... "
# Download and extract phpMyAdmin
cd /tmp
wget https://files.phpmyadmin.net/phpMyAdmin/$phpMyAdmin/phpMyAdmin-$phpMyAdmin-all-languages.tar.gz > /dev/null 2>&1
......@@ -29,7 +29,7 @@ InstallphpMyAdmin() {
rm -rf phpMyAdmin-$phpMyAdmin-all-languages
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Configuring phpMyAdmin... "
echo -n -e "$IDENTATION_LVL_2 Configuring phpMyAdmin... "
# Configure phpMyAdmin
cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
sed -i "s|\$cfg\['blowfish_secret'\]\s=\s'';|\$cfg['blowfish_secret'] = '$blowfish';|" /usr/share/phpmyadmin/config.inc.php
......@@ -37,7 +37,7 @@ InstallphpMyAdmin() {
echo -e "[${green}DONE${NC}]"
if [ "$CFG_WEBSERVER" == "apache" ]; then
echo -n -e "$IDENTATION_LVL_1 Configuring Apache for phpMyAdmin... "
echo -n -e "$IDENTATION_LVL_2 Configuring Apache for phpMyAdmin... "
# Apache configuration for phpMyAdmin
cat > /etc/apache2/conf-available/phpmyadmin.conf <<EOF
# phpMyAdmin default Apache configuration
......@@ -86,7 +86,7 @@ EOF
echo -e "[${green}DONE${NC}]"
elif [ "$CFG_WEBSERVER" == "nginx" ]; then
echo -n -e "$IDENTATION_LVL_1 Configuring Nginx for phpMyAdmin... "
echo -n -e "$IDENTATION_LVL_2 Configuring Nginx for phpMyAdmin...\n"
# Nginx configuration for phpMyAdmin
cat > /etc/nginx/conf.d/phpmyadmin.conf <<EOF
## phpMyAdmin default nginx configuration
......@@ -150,14 +150,14 @@ server {
}
EOF
echo -n -e "$IDENTATION_LVL_1 Disabling IPv6 if not enabled... "
echo -n -e "$IDENTATION_LVL_2 Disabling IPv6 if not enabled... "
# Disable IPv6 if not enabled
if [ $IPV6_ENABLED == false ]; then
sed -i "s/listen \[::\]:80/###-No IPV6### listen [::]:80/" /etc/nginx/sites-available/default
fi
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Ensuring sites-enabled loading... "
echo -n -e "$IDENTATION_LVL_2 Ensuring sites-enabled loading... "
# Ensure sites-enabled loading
if [ $IPV6_ENABLED == false ]; then
grep -q "sites-enabled\/\*\.vhost" /etc/nginx/nginx.conf || sed -i "/include \/etc\/nginx\/conf.d\/\*\.conf;/ a \ include \/etc\/nginx\/sites-enabled\/\*\.vhost;" /etc/nginx/nginx.conf
......@@ -172,23 +172,23 @@ EOF
#sed -i '/location\s\/squirrelmail\s{/ s/^/#/' /etc/nginx/sites-available/ispconfig.vhost
echo -n -e "$IDENTATION_LVL_1 Restarting Nginx and PHP-FPM... "
echo -n -e "$IDENTATION_LVL_2 Restarting Nginx and PHP-FPM... "
# Restart Nginx and PHP-FPM
systemctl restart nginx
systemctl restart php8.2-fpm
echo -e "[${green}DONE${NC}]"
fi
echo -n -e "$IDENTATION_LVL_1 Configuring phpMyAdmin database... "
echo -n -e "$IDENTATION_LVL_2 Configuring phpMyAdmin database... "
# Configure phpMyAdmin database
mysql -u root -p"$CFG_MYSQL_ROOT_PWD" -e"CREATE DATABASE phpmyadmin;"
mysql -u root -p"$CFG_MYSQL_ROOT_PWD" -e"CREATE USER 'pma'@'localhost' IDENTIFIED BY '$CFG_MYSQL_ROOT_PWD';"
mysql -u root -p"$CFG_MYSQL_ROOT_PWD" -e"GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY '$CFG_MYSQL_ROOT_PWD' WITH GRANT OPTION;"
mysql -u root -p"$CFG_MYSQL_ROOT_PWD" -e"FLUSH PRIVILEGES;"
mysql -u root -p"$CFG_MYSQL_ROOT_PWD" phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql
mariadb -u root -p"$CFG_MYSQL_ROOT_PWD" -e"CREATE DATABASE phpmyadmin;"
mariadb -u root -p"$CFG_MYSQL_ROOT_PWD" -e"CREATE USER 'pma'@'localhost' IDENTIFIED BY '$CFG_MYSQL_ROOT_PWD';"
mariadb -u root -p"$CFG_MYSQL_ROOT_PWD" -e"GRANT ALL PRIVILEGES ON phpmyadmin.* TO 'pma'@'localhost' IDENTIFIED BY '$CFG_MYSQL_ROOT_PWD' WITH GRANT OPTION;"
mariadb -u root -p"$CFG_MYSQL_ROOT_PWD" -e"FLUSH PRIVILEGES;"
mariadb -u root -p"$CFG_MYSQL_ROOT_PWD" phpmyadmin < /usr/share/phpmyadmin/sql/create_tables.sql
echo -e "[${green}DONE${NC}]"
echo -n -e "$IDENTATION_LVL_1 Updating phpMyAdmin storage configuration... "
echo -n -e "$IDENTATION_LVL_2 Updating phpMyAdmin storage configuration... "
# Update phpMyAdmin configuration for storage
sed -i "s|//\s\$cfg\['Servers'\]\[\$i\]\['controlhost'\]\s=\s'';|\$cfg['Servers'][\$i]['controlhost'] = 'localhost';|" /usr/share/phpmyadmin/config.inc.php
sed -i "s|//\s\$cfg\['Servers'\]\[\$i\]\['controlport'\]\s=\s'';|\$cfg['Servers'][\$i]['controlport'] = '';|" /usr/share/phpmyadmin/config.inc.php
......
......@@ -219,7 +219,7 @@ EOF
/usr/local/sbin/install-ngxblocker >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
/usr/local/sbin/install-ngxblocker -x >> $PROGRAMS_INSTALL_LOG_FILES 2>&1
chmod +x /usr/local/sbin/setup-ngxblocker
chmod +x /usr/local/sbin/update-ngxblocker
#chmod +x /usr/local/sbin/update-ngxblocker
##sh /usr/local/sbin/setup-ngxblocker
#sh /usr/local/sbin/setup-ngxblocker -x -e conf
......@@ -292,12 +292,18 @@ EOF
if [ "$CFG_PHPMYADMIN" == "yes" ]; then
source $APWD/distros/debian12/install_phpmyadmin.sh
echo -n -e "$IDENTATION_LVL_1 Installing phpMyAdmin... "
echo -n -e "$IDENTATION_LVL_1 Installing phpMyAdmin...\n"
InstallphpMyAdmin
echo -e "[${green}DONE${NC}]"
fi
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Installing extra PHP and Modules...${NC}"
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Installing extra PHP and Modules...${NC}\n"
if [[ "$CFG_PHP_VERSION" == *"none"* ]]; then
echo -e "No PHP version selected for installation."
else
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg >/dev/null 2>&1
echo "deb https://packages.sury.org/php/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/php.list
apt_update
#if [[ "$CFG_PHP_VERSION" == *"php5.5"* ]]; then
#InstallPhp55
#fi
......@@ -345,10 +351,6 @@ EOF
if [[ "$CFG_PHP_VERSION" == *"php8.4"* ]]; then
InstallPhp84
fi
if [[ "$CFG_PHP_VERSION" == *"none"* ]]; then
echo -e "No PHP version selected for installation."
fi
fi
echo -n -e "$IDENTATION_LVL_1 Installing additional programs for PHP and Nginx... "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment