diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 2210944fa..363e3ac73 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -461,11 +461,11 @@ if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "AlmaLinux9" ]] ; then fi cat << EOF > /etc/yum.repos.d/MariaDB.repo -# MariaDB 12.1 repository list - updated 2025-09-25 +# MariaDB 11.8 LTS repository list - updated 2026-02 # https://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB -baseurl = https://mirror.mariadb.org/yum/12.1/$MARIADB_REPO +baseurl = https://mirror.mariadb.org/yum/11.8/$MARIADB_REPO gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 EOF diff --git a/databases/databaseManager.py b/databases/databaseManager.py index 5bf124fec..0b0c7617a 100644 --- a/databases/databaseManager.py +++ b/databases/databaseManager.py @@ -134,7 +134,7 @@ class DatabaseManager: def Upgardemysql(self, request = None, userID = None): data={} - data['mysqlversions']=['10.6','10.11'] + data['mysqlversions']=['10.6','10.11','11.8'] template = 'databases/Updatemysql.html' proc = httpProc(request, template, data, 'admin') return proc.render() diff --git a/install/install.py b/install/install.py index 5c6c42024..09d6046bd 100644 --- a/install/install.py +++ b/install/install.py @@ -1531,19 +1531,18 @@ module cyberpanel_ols { return False def disableMariaDB12RepositoryIfNeeded(self): - """Disable MariaDB 12.1 repository if MariaDB 10.x is already installed to prevent upgrade attempts""" + """Disable MariaDB 12.x repository if MariaDB 10.x is already installed so 11.8 LTS upgrade can be used""" try: is_installed, installed_version, major_minor = self.checkExistingMariaDB() if is_installed and major_minor and major_minor != "unknown": try: major_ver = float(major_minor) - if major_ver < 12.0: - # MariaDB 10.x is installed, disable 12.1 repository to prevent upgrade attempts - self.stdOut(f"MariaDB {installed_version} detected, disabling MariaDB 12.1 repository to prevent upgrade conflicts", 1) - logging.InstallLog.writeToFile(f"MariaDB {installed_version} detected, disabling MariaDB 12.1 repository") + if major_ver < 11.0: + # MariaDB 10.x is installed, disable 12.x repo so we use 11.8 LTS + self.stdOut(f"MariaDB {installed_version} detected, disabling MariaDB 12.x repository", 1) + logging.InstallLog.writeToFile(f"MariaDB {installed_version} detected, disabling MariaDB 12.x repository") - # Disable MariaDB 12.1 repository - check all possible repo file locations repo_files = [ '/etc/yum.repos.d/mariadb-main.repo', '/etc/yum.repos.d/mariadb.repo', @@ -1700,7 +1699,7 @@ module cyberpanel_ols { return False, None, None def _attemptMariaDBUpgrade(self): - """Attempt to upgrade MariaDB to 12.1. Returns True if successful, False otherwise.""" + """Attempt to upgrade MariaDB to 11.8 LTS. Returns True if successful, False otherwise.""" try: if self.distro == ubuntu: # Ubuntu MariaDB upgrade @@ -1719,8 +1718,8 @@ module cyberpanel_ols { logging.InstallLog.writeToFile(f"Failed to download MariaDB keyring: {result.stderr}") return False - # Setup MariaDB 12.1 repository - command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=12.1' + # Setup MariaDB 11.8 LTS repository + command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.8' result = subprocess.run(command, shell=True, capture_output=True, universal_newlines=True) if result.returncode != 0: logging.InstallLog.writeToFile(f"Failed to setup MariaDB repository: {result.stderr}") @@ -1747,15 +1746,14 @@ module cyberpanel_ols { return True else: # RHEL-based MariaDB upgrade - # Setup MariaDB 12.1 repository - command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=12.1' + # Setup MariaDB 11.8 LTS repository + command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.8' result = subprocess.run(command, shell=True, capture_output=True, universal_newlines=True) if result.returncode != 0: logging.InstallLog.writeToFile(f"Failed to setup MariaDB repository: {result.stderr}") return False - # Attempt to install MariaDB 12.1 - # Use --allowerasing to allow package replacements if needed + # Attempt to install MariaDB 11.8 LTS (repo already set above) command = 'dnf install mariadb-server mariadb-devel mariadb-client-utils -y --allowerasing' result = subprocess.run(command, shell=True, capture_output=True, universal_newlines=True) if result.returncode != 0: @@ -1787,26 +1785,26 @@ module cyberpanel_ols { if major_minor and major_minor != "unknown": try: major_ver = float(major_minor) - if major_ver < 12.0: + if major_ver < 11.0: should_try_upgrade = True - self.stdOut(f"Existing MariaDB {major_minor} detected. Attempting to upgrade to MariaDB 12.1...", 1) + self.stdOut(f"Existing MariaDB {major_minor} detected. Attempting to upgrade to MariaDB 11.8 LTS...", 1) self.stdOut("If upgrade fails, we will use the existing MariaDB installation.", 1) except (ValueError, TypeError): pass - # If MariaDB 10.x is installed, try to upgrade to 12.1 first + # If MariaDB 10.x is installed, try to upgrade to 11.8 LTS first if should_try_upgrade: try: - self.stdOut("Attempting to install MariaDB 12.1...", 1) + self.stdOut("Attempting to install MariaDB 11.8 LTS...", 1) upgrade_success = self._attemptMariaDBUpgrade() if upgrade_success: - self.stdOut("✅ Successfully upgraded to MariaDB 12.1", 1) + self.stdOut("✅ Successfully upgraded to MariaDB 11.8 LTS", 1) self.startMariaDB() self.changeMYSQLRootPassword() self.fixMariaDB() return True else: - self.stdOut("⚠️ MariaDB 12.1 upgrade failed, using existing MariaDB installation", 1) + self.stdOut("⚠️ MariaDB 11.8 LTS upgrade failed, using existing MariaDB installation", 1) self.startMariaDB() return True except Exception as upgrade_error: @@ -1857,7 +1855,7 @@ module cyberpanel_ols { else: # RHEL-based MariaDB installation # CRITICAL: Remove conflicting MariaDB compat packages first - # These packages from MariaDB 12.1 can conflict with MariaDB 10.11 + # These packages from MariaDB 12.x can conflict with 10.x/11.x self.stdOut("Removing conflicting MariaDB compat packages...", 1) try: # Multiple aggressive removal attempts to ensure compat package is gone @@ -1891,13 +1889,12 @@ module cyberpanel_ols { if is_installed: self.stdOut(f"MariaDB/MySQL is already installed (version: {installed_version}), skipping installation", 1) - # Don't set up 12.1 repository if 10.x is installed to avoid upgrade issues + # Use existing if already on 11.x or 12.x if major_minor and major_minor != "unknown": try: major_ver = float(major_minor) - if major_ver < 12.0: - self.stdOut("Skipping MariaDB 12.1 repository setup to avoid upgrade conflicts", 1) - self.stdOut("Using existing MariaDB installation", 1) + if major_ver >= 11.0: + self.stdOut("Using existing MariaDB installation (11.x/12.x)", 1) self.startMariaDB() self.changeMYSQLRootPassword() self.fixMariaDB() @@ -1905,8 +1902,8 @@ module cyberpanel_ols { except (ValueError, TypeError): pass - # Set up MariaDB 12.1 repository only if not already installed - command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version=12.1' + # Set up MariaDB 11.8 LTS repository only if not already installed + command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version=11.8' self.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True) command = 'dnf install mariadb-server mariadb-devel mariadb-client-utils -y' @@ -3728,24 +3725,40 @@ class Migration(migrations.Migration): def download_install_phpmyadmin(self): try: - if not os.path.exists("/usr/local/CyberCP/public"): os.mkdir("/usr/local/CyberCP/public") + try: + shutil.rmtree("/usr/local/CyberCP/public/phpmyadmin") + except Exception: + pass - command = 'wget -O /usr/local/CyberCP/public/phpmyadmin.zip https://github.com/usmannasir/cyberpanel/raw/stable/phpmyadmin.zip' + # Resolve phpMyAdmin version (same as upgrade path) + phpmyadmin_version = '5.2.3' + try: + from plogical.versionFetcher import get_latest_phpmyadmin_version + latest_version = get_latest_phpmyadmin_version() + if latest_version and latest_version != phpmyadmin_version: + self.stdOut(f"Using latest phpMyAdmin version: {latest_version}", 1) + phpmyadmin_version = latest_version + else: + self.stdOut(f"Using fallback phpMyAdmin version: {phpmyadmin_version}", 1) + except Exception as e: + self.stdOut(f"Failed to fetch latest phpMyAdmin version, using fallback: {e}", 1) - preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', + self.stdOut("Installing phpMyAdmin...", 1) + command = ( + f'wget -q -O /usr/local/CyberCP/public/phpmyadmin.tar.gz ' + f'https://files.phpmyadmin.net/phpMyAdmin/{phpmyadmin_version}/phpMyAdmin-{phpmyadmin_version}-all-languages.tar.gz' + ) + preFlightsChecks.call(command, self.distro, f'[download_install_phpmyadmin] {phpmyadmin_version}', command, 1, 0, os.EX_OSERR) - - command = 'unzip /usr/local/CyberCP/public/phpmyadmin.zip -d /usr/local/CyberCP/public' - preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', + command = 'tar -xzf /usr/local/CyberCP/public/phpmyadmin.tar.gz -C /usr/local/CyberCP/public/' + preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin] extract', command, 1, 0, os.EX_OSERR) - command = 'mv /usr/local/CyberCP/public/phpMyAdmin-*-all-languages /usr/local/CyberCP/public/phpmyadmin' subprocess.call(command, shell=True) - - command = 'rm -f /usr/local/CyberCP/public/phpmyadmin.zip' - preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin]', + command = 'rm -f /usr/local/CyberCP/public/phpmyadmin.tar.gz' + preFlightsChecks.call(command, self.distro, '[download_install_phpmyadmin] cleanup', command, 1, 0, os.EX_OSERR) ## Write secret phrase diff --git a/install/universal_os_fixes.py b/install/universal_os_fixes.py index eea45dc19..1e29d4a04 100644 --- a/install/universal_os_fixes.py +++ b/install/universal_os_fixes.py @@ -476,14 +476,14 @@ class UniversalOSFixes: cmd = [ 'curl', '-LsS', 'https://downloads.mariadb.com/MariaDB/mariadb_repo_setup', - '|', 'sudo', 'bash', '-s', '--', '--mariadb-server-version=12.1' + '|', 'sudo', 'bash', '-s', '--', '--mariadb-server-version=11.8' ] else: # RHEL family MariaDB setup cmd = [ 'curl', '-LsS', 'https://downloads.mariadb.com/MariaDB/mariadb_repo_setup', - '|', 'sudo', 'bash', '-s', '--', '--mariadb-server-version=12.1' + '|', 'sudo', 'bash', '-s', '--', '--mariadb-server-version=11.8' ] subprocess.run(' '.join(cmd), shell=True, check=True) diff --git a/plogical/mysqlUtilities.py b/plogical/mysqlUtilities.py index 92b568e27..123c96189 100644 --- a/plogical/mysqlUtilities.py +++ b/plogical/mysqlUtilities.py @@ -1360,7 +1360,7 @@ Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp RepoContent = f""" [mariadb] name = MariaDB -baseurl = http://yum.mariadb.org/{versionToInstall}/rhel8-amd64 +baseurl = https://mirror.mariadb.org/yum/{versionToInstall}/rhel8-amd64 module_hotfixes=1 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 diff --git a/plogical/upgrade.py b/plogical/upgrade.py index bfefa5c52..ee4defcea 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -4326,7 +4326,7 @@ echo $oConfig->Save() ? 'Done' : 'Error'; Upgrade.stdOut("Applying AlmaLinux 9 MariaDB fixes...", 1) try: - # CRITICAL: Remove MariaDB-server-compat* before any MariaDB install (conflicts with 10.11) + # CRITICAL: Remove MariaDB-server-compat* before any MariaDB install (conflicts with 11.x) Upgrade.stdOut("Removing conflicting MariaDB-server-compat packages...", 1) try: # Multiple aggressive removal attempts to ensure compat package is gone @@ -4334,7 +4334,7 @@ echo $oConfig->Save() ? 'Done' : 'Error'; subprocess.run("dnf remove -y --allowerasing 'MariaDB-server-compat*' 2>/dev/null || true", shell=True, timeout=60) # Step 2: Force remove with rpm - subprocess.run("rpm -e --nodeps MariaDB-server-compat-12.1.2-1.el9.noarch 2>/dev/null; true", shell=True, timeout=30) + subprocess.run("rpm -e --nodeps MariaDB-server-compat-12.1.2-1.el9.noarch 2>/dev/null; true", shell=True, timeout=30) # cleanup if present from previous 12.1 # Step 3: Find and remove any remaining compat packages r = subprocess.run("rpm -qa 2>/dev/null | grep -i MariaDB-server-compat", shell=True, capture_output=True, text=True, timeout=30) @@ -4376,9 +4376,9 @@ echo $oConfig->Save() ? 'Done' : 'Error'; command = "dnf clean all" subprocess.run(command, shell=True, capture_output=True) - # Install MariaDB 10.11 from official repository (avoid 12.1 compat conflicts) - Upgrade.stdOut("Setting up official MariaDB repository...", 1) - command = "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='10.11'" + # Install MariaDB 11.8 LTS from official repository + Upgrade.stdOut("Setting up official MariaDB 11.8 LTS repository...", 1) + command = "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='11.8'" result = subprocess.run(command, shell=True, capture_output=True, text=True) if result.returncode != 0: Upgrade.stdOut(f"Warning: MariaDB repo setup failed: {result.stderr}", 0) diff --git a/to-do/MARIADB-11.8-LTS-UPGRADE.md b/to-do/MARIADB-11.8-LTS-UPGRADE.md new file mode 100644 index 000000000..e6260c8ab --- /dev/null +++ b/to-do/MARIADB-11.8-LTS-UPGRADE.md @@ -0,0 +1,20 @@ +# MariaDB 11.8 LTS (Long Term Service) + +## Summary + +CyberPanel install and upgrade now target **MariaDB 11.8 LTS** instead of 10.11 or 12.1. + +- **New installs:** Use `mariadb_repo_setup --mariadb-server-version=11.8` and install from official MariaDB 11.8 repo. +- **Upgrades:** Same; AlmaLinux 9 fix sets up 11.8 repo and installs MariaDB 11.8. +- **cyberpanel_upgrade.sh:** Writes `/etc/yum.repos.d/MariaDB.repo` with `baseurl = https://mirror.mariadb.org/yum/11.8/$MARIADB_REPO`. +- **UI (Database upgrade):** `databases/databaseManager.py` offers versions 10.6, 10.11, **11.8** for manual upgrade. +- **mysqlUtilities.UpgradeMariaDB:** Still accepts version argument; repo baseurl uses `versionToInstall` (e.g. 11.8). + +## References + +- `cyberpanel_upgrade.sh`: MariaDB.repo 11.8 +- `plogical/upgrade.py`: mariadb_repo_setup 11.8, fix_almalinux9_comprehensive() +- `install/install.py`: mariadb_repo_setup 11.8, _attemptMariaDBUpgrade(), installMySQL(), disableMariaDB12RepositoryIfNeeded() +- `install/universal_os_fixes.py`: setup_mariadb_repository() 11.8 +- `databases/databaseManager.py`: mysqlversions 10.6, 10.11, 11.8 +- `plogical/mysqlUtilities.py`: UpgradeMariaDB() baseurl for RHEL