Install: MariaDB prompt first, non-interactive SSH key, AlmaLinux 9 MariaDB 11.8

- cyberpanel.sh: ask MariaDB version (11.8/12.1) first even in --auto; add --mariadb-version
- install/install.py: remove existing SSH key before ssh-keygen to avoid Overwrite (y/n) prompt
- install/installCyberPanel.py: use MariaDB 11.8 and --nobest for AlmaLinux 9 / cent8 to fix client dependency
This commit is contained in:
master3395
2026-02-04 20:31:28 +01:00
parent cb588a2a65
commit c685966fa3
3 changed files with 68 additions and 18 deletions

View File

@@ -11,6 +11,7 @@ OS_FAMILY=""
PACKAGE_MANAGER=""
ARCHITECTURE=""
BRANCH_NAME=""
MARIADB_VER=""
DEBUG_MODE=false
AUTO_INSTALL=false
INSTALLATION_TYPE=""
@@ -579,6 +580,20 @@ cleanup_existing_cyberpanel() {
# Function to install CyberPanel directly using the working method
install_cyberpanel_direct() {
# Ask MariaDB version first (even in no-confirmation/auto mode) if not set via --mariadb-version
if [ -z "$MARIADB_VER" ]; then
echo ""
echo " MariaDB version: 11.8 (LTS, default) or 12.1?"
read -r -t 60 -p " Enter 11.8 or 12.1 [11.8]: " MARIADB_VER || true
MARIADB_VER="${MARIADB_VER:-11.8}"
MARIADB_VER="${MARIADB_VER// /}"
if [ "$MARIADB_VER" != "11.8" ] && [ "$MARIADB_VER" != "12.1" ]; then
MARIADB_VER="11.8"
fi
echo " Using MariaDB $MARIADB_VER"
echo ""
fi
echo " 🔄 Downloading CyberPanel installation files..."
# Check if CyberPanel is already installed
@@ -1185,6 +1200,7 @@ except Exception as e:
install_args+=("--powerdns" "ON")
install_args+=("--ftp" "ON")
install_args+=("--remotemysql" "OFF")
install_args+=("--mariadb-version" "${MARIADB_VER:-11.8}")
if [ "$DEBUG_MODE" = true ]; then
# Note: install.py doesn't have --debug, but we can set it via environment
@@ -1352,8 +1368,9 @@ apply_fixes() {
systemctl start mariadb 2>/dev/null || true
systemctl enable mariadb 2>/dev/null || true
# Fix LiteSpeed service
cat > /etc/systemd/system/lsws.service << 'EOF'
# Fix LiteSpeed service only if the web server was actually installed
if [ -x /usr/local/lsws/bin/lswsctrl ] || [ -x /usr/local/lsws/bin/lsctrl ] || [ -f /usr/local/lsws/bin/openlitespeed ]; then
cat > /etc/systemd/system/lsws.service << 'EOF'
[Unit]
Description=LiteSpeed Web Server
After=network.target
@@ -1372,9 +1389,15 @@ RestartSec=5
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable lsws
systemctl start lsws
systemctl daemon-reload
systemctl enable lsws
systemctl start lsws || true
else
echo " • LiteSpeed/OpenLiteSpeed not found at /usr/local/lsws - skipping lsws.service (install may have skipped web server)"
systemctl disable lsws 2>/dev/null || true
rm -f /etc/systemd/system/lsws.service
systemctl daemon-reload
fi
# Set OpenLiteSpeed admin password to match CyberPanel
echo " • Configuring OpenLiteSpeed admin password..."
@@ -2674,6 +2697,18 @@ parse_arguments() {
set -x
shift
;;
--mariadb-version)
if [ -n "$2" ] && [ "$2" = "11.8" ]; then
MARIADB_VER="11.8"
shift 2
elif [ -n "$2" ] && [ "$2" = "12.1" ]; then
MARIADB_VER="12.1"
shift 2
else
echo "ERROR: --mariadb-version requires 11.8 or 12.1"
exit 1
fi
;;
--auto)
AUTO_INSTALL=true
shift
@@ -2683,8 +2718,9 @@ parse_arguments() {
echo "Options:"
echo " -b, --branch BRANCH Install from specific branch/commit"
echo " -v, --version VER Install specific version (auto-adds v prefix)"
echo " --mariadb-version VER MariaDB version: 11.8 or 12.1 (asked first if omitted)"
echo " --debug Enable debug mode"
echo " --auto Auto mode without prompts"
echo " --auto Auto mode without prompts (MariaDB still asked first unless --mariadb-version)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
@@ -2696,6 +2732,8 @@ parse_arguments() {
echo " $0 -v 2.4.3 # Install version 2.4.3"
echo " $0 -b main # Install from main branch"
echo " $0 -b a1b2c3d4 # Install from specific commit"
echo " $0 --mariadb-version 12.1 # Use MariaDB 12.1 (no prompt)"
echo " $0 --auto --mariadb-version 11.8 # Fully non-interactive with MariaDB 11.8"
echo ""
echo "Standard CyberPanel Installation Methods:"
echo " sh <(curl https://cyberpanel.net/install.sh)"

View File

@@ -3307,10 +3307,10 @@ password="%s"
preFlightsChecks.stdOut("ERROR: Virtual environment setup failed!", 0)
return False
# Find the correct Python virtual environment path
# Find the correct Python virtual environment path (prefer CyberCP - app install path)
python_paths = [
"/usr/local/CyberPanel/bin/python",
"/usr/local/CyberCP/bin/python",
"/usr/local/CyberPanel/bin/python",
"/usr/local/CyberPanel-venv/bin/python"
]
@@ -4956,8 +4956,8 @@ user_query = SELECT email as user, password, 'vmail' as uid, 'vmail' as gid, '/h
# Determine the correct Python path
python_paths = [
"/usr/local/CyberPanel/bin/python",
"/usr/local/CyberCP/bin/python",
"/usr/local/CyberPanel/bin/python",
"/usr/bin/python3",
"/usr/local/bin/python3"
]
@@ -5026,7 +5026,7 @@ user_query = SELECT email as user, password, 'vmail' as uid, 'vmail' as gid, '/h
def ensureVirtualEnvironmentSetup(self):
"""Ensure virtual environment is properly set up and accessible"""
try:
# Check multiple possible virtual environment locations
# Check multiple possible virtual environment locations (prefer CyberCP - app path)
venv_paths = [
'/usr/local/CyberCP/bin/python',
'/usr/local/CyberPanel/bin/python',
@@ -5077,8 +5077,8 @@ user_query = SELECT email as user, password, 'vmail' as uid, 'vmail' as gid, '/h
# Determine the correct Python path
python_paths = [
"/usr/local/CyberPanel/bin/python",
"/usr/local/CyberCP/bin/python",
"/usr/local/CyberPanel/bin/python",
"/usr/bin/python3",
"/usr/local/bin/python3"
]
@@ -5292,10 +5292,21 @@ user_query = SELECT email as user, password, 'vmail' as uid, 'vmail' as gid, '/h
def install_default_keys(self):
try:
path = "/root/.ssh"
key_path = "/root/.ssh/cyberpanel"
key_pub = "/root/.ssh/cyberpanel.pub"
if not os.path.exists(path):
os.mkdir(path)
# Remove existing key files so ssh-keygen never prompts "Overwrite (y/n)?"
# This keeps unattended / no-confirmation installs fully non-interactive
for f in (key_path, key_pub):
if os.path.exists(f):
try:
os.remove(f)
except OSError:
pass
command = "ssh-keygen -f /root/.ssh/cyberpanel -t rsa -N ''"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)

View File

@@ -85,15 +85,15 @@ class InstallCyberPanel:
command = "dnf clean all"
install_utils.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Install MariaDB from official repository
self.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 from official repository (11.8 LTS for el9 to avoid client dependency issues)
self.stdOut("Setting up official MariaDB repository (11.8 LTS)...", 1)
command = "curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version='11.8'"
install_utils.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Install MariaDB packages
# Install MariaDB packages (server + client from same repo to satisfy dependencies)
self.stdOut("Installing MariaDB packages...", 1)
mariadb_packages = "MariaDB-server MariaDB-client MariaDB-backup MariaDB-devel"
command = f"dnf install -y {mariadb_packages}"
command = f"dnf install -y --nobest {mariadb_packages}"
install_utils.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
self.stdOut("AlmaLinux 9 MariaDB fixes completed", 1)
@@ -902,7 +902,7 @@ gpgcheck=1
else:
command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.11'
command = 'curl -LsS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.8'
install_utils.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True)
command = 'yum remove mariadb* -y'
@@ -922,7 +922,8 @@ gpgcheck=1
command = 'dnf clean all'
install_utils.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True)
command = 'dnf install MariaDB-server MariaDB-client MariaDB-backup -y'
# Use --nobest so server+client resolve from same repo (avoids AlmaLinux 9 dependency conflict)
command = 'dnf install -y --nobest MariaDB-server MariaDB-client MariaDB-backup'
install_utils.call(command, self.distro, command, command, 1, 1, os.EX_OSERR, True)