Skip to content

Commit 18245f8

Browse files
committed
enable remote mysql in cyberpanel.sh
1 parent 2abcfa0 commit 18245f8

2 files changed

Lines changed: 56 additions & 3 deletions

File tree

cyberpanel.sh

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ DEV="OFF"
88
POSTFIX_VARIABLE="ON"
99
POWERDNS_VARIABLE="ON"
1010
PUREFTPD_VARIABLE="ON"
11+
12+
### Remote MySQL Variables
13+
14+
REMOTE_MYSQL='OFF'
15+
MYSQL_HOST=''
16+
MYSQL_USER=''
17+
MYSQL_PASSWORD=''
18+
MYSQL_PORT=''
19+
1120
PROVIDER="undefined"
1221
SERIAL_NO=""
1322
DIR=$(pwd)
@@ -856,6 +865,42 @@ else
856865
fi
857866
fi
858867

868+
### Ask if you want to set up this CyberPanel with remote MySQL
869+
870+
echo -e "\nDo you want to setup Remote MySQL? (This will skip installation of local MySQL)"
871+
echo -e ""
872+
printf "%s" "Remote MySQL [Y/n]: "
873+
read TMP_YN
874+
if [[ `expr "x$TMP_YN" : 'x[Yy]'` -gt 1 ]] || [[ $TMP_YN == "" ]] ; then
875+
echo -e "\nRemote MySQL selected..."
876+
REMOTE_MYSQL='ON'
877+
878+
echo -e ""
879+
printf "%s" "Remote MySQL Hostname: "
880+
read MYSQL_HOST
881+
882+
echo -e ""
883+
printf "%s" "Remote MySQL Username: "
884+
read MYSQL_USER
885+
886+
echo -e ""
887+
printf "%s" "Remote MySQL Password: "
888+
read MYSQL_PASSWORD
889+
890+
echo -e ""
891+
printf "%s" "Remote MySQL Port: "
892+
read MYSQL_PORT
893+
894+
else
895+
896+
echo -e ""
897+
printf "%s" "Local MySQL selected.."
898+
echo -e ""
899+
900+
fi
901+
902+
###
903+
859904
#above comment for future use
860905

861906
#if [[ $DEV_ARG == "ON" ]] ; then
@@ -1029,9 +1074,17 @@ if [[ $debug == "1" ]] ; then
10291074
fi
10301075

10311076
if [[ $REDIS_HOSTING == "Yes" ]] ; then
1032-
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable
1077+
if [[ $REMOTE_MYSQL == "Yes" ]] ; then
1078+
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable --remotemysql $REMOTE_MYSQL --mysqlhost $MYSQL_HOST --mysqluser $MYSQL_USER --mysqlpassword $MYSQL_PASSWORD --mysqlport $MYSQL_PORT
1079+
else
1080+
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --redis enable
1081+
fi
10331082
else
1034-
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE
1083+
if [[ $REMOTE_MYSQL == "Yes" ]] ; then
1084+
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE --remotemysql $REMOTE_MYSQL --mysqlhost $MYSQL_HOST --mysqluser $MYSQL_USER --mysqlpassword $MYSQL_PASSWORD --mysqlport $MYSQL_PORT
1085+
else
1086+
/usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY --postfix $POSTFIX_VARIABLE --powerdns $POWERDNS_VARIABLE --ftp $PUREFTPD_VARIABLE
1087+
fi
10351088
fi
10361089

10371090
if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then

install/installCyberPanel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ def installMySQL(self, mysql):
284284
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
285285

286286

287-
288287
############## Start mariadb ######################
289288

290289
self.startMariaDB()
@@ -648,6 +647,7 @@ def Main(cwd, mysql, distro, ent, serial = None, port = "8090", ftp = None, dns
648647
installer.installMySQL(mysql)
649648
installer.changeMYSQLRootPassword()
650649
#installer.changeMYSQLRootPasswordCyberPanel(mysql)
650+
651651
installer.startMariaDB()
652652
if distro == ubuntu:
653653
installer.fixMariaDB()

0 commit comments

Comments
 (0)