Enhance MySQL/MariaDB development headers installation in cyberpanel scripts

- Improved conflict resolution for MariaDB and MySQL packages in both cyberpanel.sh and cyberpanel_upgrade.sh.
- Added checks and symlink creation for mysql.h compatibility to ensure successful installation of MySQL development headers.
- Enhanced error handling during Python requirements installation with fallback options for mysqlclient and PyMySQL.
- Verified installation of MySQL development headers and modified requirements to avoid mysqlclient compilation issues.
This commit is contained in:
Master3395
2025-09-24 12:45:58 +02:00
parent d957b28fac
commit 18242077d5
2 changed files with 177 additions and 3 deletions

View File

@@ -1078,11 +1078,25 @@ if ! /usr/local/CyberCP/bin/python -c "import django" 2>/dev/null; then
elif [[ "$Server_OS" =~ ^(CentOS|RHEL|AlmaLinux|RockyLinux|CloudLinux) ]]; then
# RHEL-based systems
if command -v dnf >/dev/null 2>&1; then
dnf install -y mariadb-devel pkgconfig gcc python3-devel
# Remove conflicting packages first
dnf remove -y mariadb mariadb-client-utils mariadb-server || true
dnf remove -y MariaDB-server MariaDB-client MariaDB-devel || true
# Install development packages with conflict resolution
dnf install -y --allowerasing --skip-broken --nobest mariadb-devel pkgconfig gcc python3-devel || \
dnf install -y --allowerasing --skip-broken --nobest mysql-devel pkgconfig gcc python3-devel || \
dnf install -y --allowerasing --skip-broken --nobest mysql-community-devel pkgconfig gcc python3-devel
else
yum install -y mariadb-devel pkgconfig gcc python3-devel
fi
fi
# Check if mysql.h is available and create symlink if needed
if [[ ! -f "/usr/include/mysql/mysql.h" ]] && [[ -f "/usr/include/mariadb/mysql.h" ]]; then
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Creating mysql.h symlink for compatibility..." | tee -a /var/log/cyberpanel_upgrade_debug.log
mkdir -p /usr/include/mysql
ln -sf /usr/include/mariadb/mysql.h /usr/include/mysql/mysql.h
fi
# Re-install requirements
echo -e "[$(date +"%Y-%m-%d %H:%M:%S")] Re-installing Python requirements..." | tee -a /var/log/cyberpanel_upgrade_debug.log