mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-01 19:06:01 +01:00
Enhance OS detection and package management in installation scripts: Updated install.sh to improve OS detection logic for various CentOS, AlmaLinux, CloudLinux, Ubuntu, Debian, and openEuler versions. Refined package installation commands and added error handling for unsupported OS scenarios. Improved service name mapping in install.py for better compatibility across distributions.
This commit is contained in:
167
cyberpanel.sh
167
cyberpanel.sh
@@ -253,16 +253,30 @@ log_function_end "Set_Default_Variables"
|
|||||||
install_package() {
|
install_package() {
|
||||||
local package="$1"
|
local package="$1"
|
||||||
case "$Server_OS" in
|
case "$Server_OS" in
|
||||||
"CentOS"|"openEuler")
|
"CentOS7")
|
||||||
if [[ "$Server_OS_Version" -ge 8 ]]; then
|
yum install -y "$package"
|
||||||
dnf install -y "$package"
|
|
||||||
else
|
|
||||||
yum install -y "$package"
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
"Ubuntu")
|
"CentOS8"|"CentOS9"|"CentOSStream8"|"CentOSStream9"|"RHEL8"|"RHEL9"|"AlmaLinux8"|"AlmaLinux9"|"AlmaLinux10"|"RockyLinux8"|"RockyLinux9")
|
||||||
|
dnf install -y "$package"
|
||||||
|
;;
|
||||||
|
"CloudLinux7"|"CloudLinux8"|"CloudLinux9")
|
||||||
|
yum install -y "$package"
|
||||||
|
;;
|
||||||
|
"Ubuntu1804"|"Ubuntu2004"|"Ubuntu2010"|"Ubuntu2204"|"Ubuntu2404"|"Ubuntu24043"|"Debian11"|"Debian12"|"Debian13")
|
||||||
DEBIAN_FRONTEND=noninteractive apt install -y "$package"
|
DEBIAN_FRONTEND=noninteractive apt install -y "$package"
|
||||||
;;
|
;;
|
||||||
|
"openEuler2003"|"openEuler2203"|"openEuler2403")
|
||||||
|
dnf install -y "$package"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "Unknown OS: $Server_OS, attempting package installation..."
|
||||||
|
# Try different package managers in order of likelihood
|
||||||
|
if [[ "$Server_OS" =~ ^(CentOS|RHEL|AlmaLinux|RockyLinux|CloudLinux|openEuler) ]]; then
|
||||||
|
dnf install -y "$package" 2>/dev/null || yum install -y "$package" 2>/dev/null || echo -e "Failed to install $package"
|
||||||
|
else
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install -y "$package" 2>/dev/null || echo -e "Failed to install $package"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,19 +284,54 @@ install_package() {
|
|||||||
manage_service() {
|
manage_service() {
|
||||||
local service="$1"
|
local service="$1"
|
||||||
local action="$2"
|
local action="$2"
|
||||||
|
|
||||||
|
# Check if service exists before trying to manage it
|
||||||
|
if ! systemctl list-unit-files | grep -q "${service}.service"; then
|
||||||
|
echo -e "Service $service not found, skipping $action"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Handle platform-specific service names
|
||||||
|
case "$service" in
|
||||||
|
"pdns")
|
||||||
|
if [[ "$Server_OS" =~ ^(Ubuntu|Debian) ]]; then
|
||||||
|
service="pdns-server"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"pure-ftpd")
|
||||||
|
if [[ "$Server_OS" =~ ^(Ubuntu|Debian) ]]; then
|
||||||
|
service="pure-ftpd"
|
||||||
|
elif [[ "$Server_OS" =~ ^(CentOS|AlmaLinux|RockyLinux|RHEL|CloudLinux) ]]; then
|
||||||
|
service="pure-ftpd"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
systemctl "$action" "$service"
|
systemctl "$action" "$service"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper Function for Development Tools Installation
|
# Helper Function for Development Tools Installation
|
||||||
install_dev_tools() {
|
install_dev_tools() {
|
||||||
case "$Server_OS" in
|
case "$Server_OS" in
|
||||||
"CentOS"|"openEuler")
|
"CentOS7"|"CloudLinux7"|"CloudLinux8"|"CloudLinux9")
|
||||||
yum groupinstall "Development Tools" -y
|
yum groupinstall "Development Tools" -y
|
||||||
yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y
|
yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y
|
||||||
;;
|
;;
|
||||||
"Ubuntu")
|
"CentOS8"|"CentOS9"|"CentOSStream8"|"CentOSStream9"|"RHEL8"|"RHEL9"|"AlmaLinux8"|"AlmaLinux9"|"AlmaLinux10"|"RockyLinux8"|"RockyLinux9"|"openEuler2003"|"openEuler2203"|"openEuler2403")
|
||||||
|
dnf groupinstall "Development Tools" -y
|
||||||
|
dnf install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y
|
||||||
|
;;
|
||||||
|
"Ubuntu1804"|"Ubuntu2004"|"Ubuntu2010"|"Ubuntu2204"|"Ubuntu2404"|"Ubuntu24043"|"Debian11"|"Debian12"|"Debian13")
|
||||||
DEBIAN_FRONTEND=noninteractive apt install build-essential zlib1g-dev libexpat1-dev openssl libssl-dev libsasl2-dev libpcre3-dev git -y
|
DEBIAN_FRONTEND=noninteractive apt install build-essential zlib1g-dev libexpat1-dev openssl libssl-dev libsasl2-dev libpcre3-dev git -y
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
echo -e "Unknown OS: $Server_OS, attempting to install development tools..."
|
||||||
|
if [[ "$Server_OS" =~ ^(CentOS|RHEL|AlmaLinux|RockyLinux|CloudLinux|openEuler) ]]; then
|
||||||
|
dnf groupinstall "Development Tools" -y 2>/dev/null || yum groupinstall "Development Tools" -y 2>/dev/null || echo -e "Failed to install development tools"
|
||||||
|
else
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt install build-essential -y 2>/dev/null || echo -e "Failed to install development tools"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +339,7 @@ install_dev_tools() {
|
|||||||
install_php_packages() {
|
install_php_packages() {
|
||||||
local php_extension="$1"
|
local php_extension="$1"
|
||||||
case "$Server_OS" in
|
case "$Server_OS" in
|
||||||
"CentOS"|"openEuler")
|
"CentOS7"|"CloudLinux7"|"CloudLinux8"|"CloudLinux9")
|
||||||
# Find available PHP versions first
|
# Find available PHP versions first
|
||||||
available_php_versions=$(ls /usr/local/lsws/lsphp* 2>/dev/null | grep -o 'lsphp[0-9]*' | sort -u)
|
available_php_versions=$(ls /usr/local/lsws/lsphp* 2>/dev/null | grep -o 'lsphp[0-9]*' | sort -u)
|
||||||
if [[ -z "$available_php_versions" ]]; then
|
if [[ -z "$available_php_versions" ]]; then
|
||||||
@@ -316,7 +365,33 @@ install_php_packages() {
|
|||||||
log_warning "No matching ${php_extension} packages found for available PHP versions"
|
log_warning "No matching ${php_extension} packages found for available PHP versions"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"Ubuntu")
|
"CentOS8"|"CentOS9"|"CentOSStream8"|"CentOSStream9"|"RHEL8"|"RHEL9"|"AlmaLinux8"|"AlmaLinux9"|"AlmaLinux10"|"RockyLinux8"|"RockyLinux9"|"openEuler2003"|"openEuler2203"|"openEuler2403")
|
||||||
|
# Find available PHP versions first
|
||||||
|
available_php_versions=$(ls /usr/local/lsws/lsphp* 2>/dev/null | grep -o 'lsphp[0-9]*' | sort -u)
|
||||||
|
if [[ -z "$available_php_versions" ]]; then
|
||||||
|
log_warning "No PHP versions found, skipping ${php_extension} installation"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Try to install packages for each available PHP version
|
||||||
|
packages_to_install=""
|
||||||
|
for php_version in $available_php_versions; do
|
||||||
|
# Check if package exists before adding to install list
|
||||||
|
if dnf search ${php_version}-${php_extension} 2>/dev/null | grep -q "${php_version}-${php_extension}"; then
|
||||||
|
packages_to_install="${packages_to_install} ${php_version}-${php_extension}"
|
||||||
|
fi
|
||||||
|
if dnf search ${php_version}-pecl-${php_extension} 2>/dev/null | grep -q "${php_version}-pecl-${php_extension}"; then
|
||||||
|
packages_to_install="${packages_to_install} ${php_version}-pecl-${php_extension}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n "$packages_to_install" ]]; then
|
||||||
|
install_package "$packages_to_install"
|
||||||
|
else
|
||||||
|
log_warning "No matching ${php_extension} packages found for available PHP versions"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"Ubuntu1804"|"Ubuntu2004"|"Ubuntu2010"|"Ubuntu2204"|"Ubuntu2404"|"Ubuntu24043"|"Debian11"|"Debian12"|"Debian13")
|
||||||
# Find available PHP versions first
|
# Find available PHP versions first
|
||||||
available_php_versions=$(ls /usr/local/lsws/lsphp* 2>/dev/null | grep -o 'lsphp[0-9]*' | sort -u)
|
available_php_versions=$(ls /usr/local/lsws/lsphp* 2>/dev/null | grep -o 'lsphp[0-9]*' | sort -u)
|
||||||
if [[ -z "$available_php_versions" ]]; then
|
if [[ -z "$available_php_versions" ]]; then
|
||||||
@@ -629,26 +704,60 @@ if ! uname -m | grep -qE 'x86_64|aarch64' ; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q -E "CentOS Linux 7|CentOS Linux 8|CentOS Stream" /etc/os-release ; then
|
if grep -q "CentOS Linux 7" /etc/os-release ; then
|
||||||
Server_OS="CentOS"
|
Server_OS="CentOS7"
|
||||||
elif grep -q "Red Hat Enterprise Linux" /etc/os-release ; then
|
elif grep -q "CentOS Linux 8" /etc/os-release ; then
|
||||||
Server_OS="RedHat"
|
Server_OS="CentOS8"
|
||||||
|
elif grep -q "CentOS Linux 9" /etc/os-release ; then
|
||||||
|
Server_OS="CentOS9"
|
||||||
|
elif grep -q "CentOS Stream 8" /etc/os-release ; then
|
||||||
|
Server_OS="CentOSStream8"
|
||||||
|
elif grep -q "CentOS Stream 9" /etc/os-release ; then
|
||||||
|
Server_OS="CentOSStream9"
|
||||||
|
elif grep -q "Red Hat Enterprise Linux 8" /etc/os-release ; then
|
||||||
|
Server_OS="RHEL8"
|
||||||
|
elif grep -q "Red Hat Enterprise Linux 9" /etc/os-release ; then
|
||||||
|
Server_OS="RHEL9"
|
||||||
elif grep -q "AlmaLinux-8" /etc/os-release ; then
|
elif grep -q "AlmaLinux-8" /etc/os-release ; then
|
||||||
Server_OS="AlmaLinux"
|
Server_OS="AlmaLinux8"
|
||||||
elif grep -q "AlmaLinux-9" /etc/os-release ; then
|
elif grep -q "AlmaLinux-9" /etc/os-release ; then
|
||||||
Server_OS="AlmaLinux"
|
Server_OS="AlmaLinux9"
|
||||||
elif grep -q "AlmaLinux-10" /etc/os-release ; then
|
elif grep -q "AlmaLinux-10" /etc/os-release ; then
|
||||||
Server_OS="AlmaLinux"
|
Server_OS="AlmaLinux10"
|
||||||
elif grep -q -E "CloudLinux 7|CloudLinux 8|CloudLinux 9" /etc/os-release ; then
|
elif grep -q "Rocky Linux 8" /etc/os-release ; then
|
||||||
Server_OS="CloudLinux"
|
Server_OS="RockyLinux8"
|
||||||
elif grep -q -E "Rocky Linux" /etc/os-release ; then
|
elif grep -q "Rocky Linux 9" /etc/os-release ; then
|
||||||
Server_OS="RockyLinux"
|
Server_OS="RockyLinux9"
|
||||||
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10|Ubuntu 22.04|Ubuntu 24.04|Ubuntu 24.04.3" /etc/os-release ; then
|
elif grep -q "CloudLinux 7" /etc/os-release ; then
|
||||||
Server_OS="Ubuntu"
|
Server_OS="CloudLinux7"
|
||||||
elif grep -q -E "Debian GNU/Linux 11|Debian GNU/Linux 12|Debian GNU/Linux 13" /etc/os-release ; then
|
elif grep -q "CloudLinux 8" /etc/os-release ; then
|
||||||
Server_OS="Debian"
|
Server_OS="CloudLinux8"
|
||||||
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
|
elif grep -q "CloudLinux 9" /etc/os-release ; then
|
||||||
Server_OS="openEuler"
|
Server_OS="CloudLinux9"
|
||||||
|
elif grep -q "Ubuntu 18.04" /etc/os-release ; then
|
||||||
|
Server_OS="Ubuntu1804"
|
||||||
|
elif grep -q "Ubuntu 20.04" /etc/os-release ; then
|
||||||
|
Server_OS="Ubuntu2004"
|
||||||
|
elif grep -q "Ubuntu 20.10" /etc/os-release ; then
|
||||||
|
Server_OS="Ubuntu2010"
|
||||||
|
elif grep -q "Ubuntu 22.04" /etc/os-release ; then
|
||||||
|
Server_OS="Ubuntu2204"
|
||||||
|
elif grep -q "Ubuntu 24.04" /etc/os-release ; then
|
||||||
|
Server_OS="Ubuntu2404"
|
||||||
|
elif grep -q "Ubuntu 24.04.3" /etc/os-release ; then
|
||||||
|
Server_OS="Ubuntu24043"
|
||||||
|
elif grep -q "Debian GNU/Linux 11" /etc/os-release ; then
|
||||||
|
Server_OS="Debian11"
|
||||||
|
elif grep -q "Debian GNU/Linux 12" /etc/os-release ; then
|
||||||
|
Server_OS="Debian12"
|
||||||
|
elif grep -q "Debian GNU/Linux 13" /etc/os-release ; then
|
||||||
|
Server_OS="Debian13"
|
||||||
|
elif grep -q "openEuler 20.03" /etc/os-release ; then
|
||||||
|
Server_OS="openEuler2003"
|
||||||
|
elif grep -q "openEuler 22.03" /etc/os-release ; then
|
||||||
|
Server_OS="openEuler2203"
|
||||||
|
elif grep -q "openEuler 24.03" /etc/os-release ; then
|
||||||
|
Server_OS="openEuler2403"
|
||||||
else
|
else
|
||||||
echo -e "Unable to detect your system..."
|
echo -e "Unable to detect your system..."
|
||||||
echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, Ubuntu 24.04, Ubuntu 24.04.3, Debian 11, Debian 12, Debian 13, CentOS 7, CentOS 8, CentOS 9, RHEL 8, RHEL 9, AlmaLinux 8, AlmaLinux 9, AlmaLinux 10, RockyLinux 8, RockyLinux 9, CloudLinux 7, CloudLinux 8, CloudLinux 9, openEuler 20.03, openEuler 22.03...\n"
|
echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, Ubuntu 24.04, Ubuntu 24.04.3, Debian 11, Debian 12, Debian 13, CentOS 7, CentOS 8, CentOS 9, RHEL 8, RHEL 9, AlmaLinux 8, AlmaLinux 9, AlmaLinux 10, RockyLinux 8, RockyLinux 9, CloudLinux 7, CloudLinux 8, CloudLinux 9, openEuler 20.03, openEuler 22.03...\n"
|
||||||
@@ -2227,7 +2336,7 @@ echo "╚═══════════════════════
|
|||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗"
|
echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗"
|
||||||
echo "║ ║"
|
echo "║ ║"
|
||||||
echo "║ 📊 SYSTEM STATUS: ║"
|
echo "║ 📊 SYSTEM STATUS: ║"
|
||||||
echo "║ ║"
|
echo "║ ║"
|
||||||
echo "║ 💾 Disk Usage: $(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)", $3,$2,$5}') ║"
|
echo "║ 💾 Disk Usage: $(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)", $3,$2,$5}') ║"
|
||||||
echo "║ 🧠 RAM Usage: $(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)", $3,$2,$3*100/$2 }') ║"
|
echo "║ 🧠 RAM Usage: $(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)", $3,$2,$3*100/$2 }') ║"
|
||||||
|
|||||||
178
install.sh
178
install.sh
@@ -5,105 +5,131 @@ if echo $OUTPUT | grep -q "CentOS Linux 7" ; then
|
|||||||
echo "Checking and installing curl and wget"
|
echo "Checking and installing curl and wget"
|
||||||
yum install curl wget -y 1> /dev/null
|
yum install curl wget -y 1> /dev/null
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
SERVER_OS="CentOS"
|
SERVER_OS="CentOS7"
|
||||||
elif echo $OUTPUT | grep -q "CentOS Stream 9" ; then
|
elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then
|
||||||
echo -e "\nDetecting Centos Stream 9...\n"
|
echo -e "\nDetecting CentOS 8...\n"
|
||||||
SERVER_OS="CentOSStream9"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "AlmaLinux 8" ; then
|
|
||||||
echo -e "\nDetecting AlmaLinux 8...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "AlmaLinux 9" ; then
|
|
||||||
echo -e "\nDetecting AlmaLinux 9...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "AlmaLinux 10" ; then
|
|
||||||
echo -e "\nDetecting AlmaLinux 10...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "CloudLinux 8" ; then
|
|
||||||
echo "Checking and installing curl and wget"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
SERVER_OS="CloudLinux"
|
|
||||||
elif echo $OUTPUT | grep -q "CloudLinux 9" ; then
|
|
||||||
echo "Checking and installing curl and wget"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
SERVER_OS="CloudLinux"
|
|
||||||
elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Ubuntu 22.04" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Ubuntu 24.04" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Ubuntu 24.04.3" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Debian GNU/Linux 11" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Debian GNU/Linux 12" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Debian GNU/Linux 13" ; then
|
|
||||||
apt install -y -qq wget curl
|
|
||||||
SERVER_OS="Ubuntu"
|
|
||||||
elif echo $OUTPUT | grep -q "Rocky Linux 8" ; then
|
|
||||||
echo -e "\nDetecting Rocky Linux 8...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "Rocky Linux 9" ; then
|
|
||||||
echo -e "\nDetecting Rocky Linux 9...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "Red Hat Enterprise Linux 8" ; then
|
|
||||||
echo -e "\nDetecting RHEL 8...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
|
||||||
yum install curl wget -y 1> /dev/null
|
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
|
||||||
elif echo $OUTPUT | grep -q "Red Hat Enterprise Linux 9" ; then
|
|
||||||
echo -e "\nDetecting RHEL 9...\n"
|
|
||||||
SERVER_OS="CentOS8"
|
SERVER_OS="CentOS8"
|
||||||
yum install curl wget -y 1> /dev/null
|
yum install curl wget -y 1> /dev/null
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
elif echo $OUTPUT | grep -q "CentOS Linux 9" ; then
|
elif echo $OUTPUT | grep -q "CentOS Linux 9" ; then
|
||||||
echo -e "\nDetecting CentOS 9...\n"
|
echo -e "\nDetecting CentOS 9...\n"
|
||||||
SERVER_OS="CentOS8"
|
SERVER_OS="CentOS9"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "CentOS Stream 8" ; then
|
||||||
|
echo -e "\nDetecting CentOS Stream 8...\n"
|
||||||
|
SERVER_OS="CentOSStream8"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "CentOS Stream 9" ; then
|
||||||
|
echo -e "\nDetecting CentOS Stream 9...\n"
|
||||||
|
SERVER_OS="CentOSStream9"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "AlmaLinux 8" ; then
|
||||||
|
echo -e "\nDetecting AlmaLinux 8...\n"
|
||||||
|
SERVER_OS="AlmaLinux8"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "AlmaLinux 9" ; then
|
||||||
|
echo -e "\nDetecting AlmaLinux 9...\n"
|
||||||
|
SERVER_OS="AlmaLinux9"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "AlmaLinux 10" ; then
|
||||||
|
echo -e "\nDetecting AlmaLinux 10...\n"
|
||||||
|
SERVER_OS="AlmaLinux10"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "CloudLinux 7" ; then
|
||||||
|
echo "Checking and installing curl and wget"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
SERVER_OS="CloudLinux7"
|
||||||
|
elif echo $OUTPUT | grep -q "CloudLinux 8" ; then
|
||||||
|
echo "Checking and installing curl and wget"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
SERVER_OS="CloudLinux8"
|
||||||
|
elif echo $OUTPUT | grep -q "CloudLinux 9" ; then
|
||||||
|
echo "Checking and installing curl and wget"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
SERVER_OS="CloudLinux9"
|
||||||
|
elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Ubuntu1804"
|
||||||
|
elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Ubuntu2004"
|
||||||
|
elif echo $OUTPUT | grep -q "Ubuntu 20.10" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Ubuntu2010"
|
||||||
|
elif echo $OUTPUT | grep -q "Ubuntu 22.04" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Ubuntu2204"
|
||||||
|
elif echo $OUTPUT | grep -q "Ubuntu 24.04" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Ubuntu2404"
|
||||||
|
elif echo $OUTPUT | grep -q "Ubuntu 24.04.3" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Ubuntu24043"
|
||||||
|
elif echo $OUTPUT | grep -q "Debian GNU/Linux 11" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Debian11"
|
||||||
|
elif echo $OUTPUT | grep -q "Debian GNU/Linux 12" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Debian12"
|
||||||
|
elif echo $OUTPUT | grep -q "Debian GNU/Linux 13" ; then
|
||||||
|
apt install -y -qq wget curl
|
||||||
|
SERVER_OS="Debian13"
|
||||||
|
elif echo $OUTPUT | grep -q "Rocky Linux 8" ; then
|
||||||
|
echo -e "\nDetecting Rocky Linux 8...\n"
|
||||||
|
SERVER_OS="RockyLinux8"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "Rocky Linux 9" ; then
|
||||||
|
echo -e "\nDetecting Rocky Linux 9...\n"
|
||||||
|
SERVER_OS="RockyLinux9"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "Red Hat Enterprise Linux 8" ; then
|
||||||
|
echo -e "\nDetecting RHEL 8...\n"
|
||||||
|
SERVER_OS="RHEL8"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "Red Hat Enterprise Linux 9" ; then
|
||||||
|
echo -e "\nDetecting RHEL 9...\n"
|
||||||
|
SERVER_OS="RHEL9"
|
||||||
yum install curl wget -y 1> /dev/null
|
yum install curl wget -y 1> /dev/null
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
elif echo $OUTPUT | grep -q "openEuler 20.03" ; then
|
elif echo $OUTPUT | grep -q "openEuler 20.03" ; then
|
||||||
echo -e "\nDetecting openEuler 20.03...\n"
|
echo -e "\nDetecting openEuler 20.03...\n"
|
||||||
SERVER_OS="openEuler"
|
SERVER_OS="openEuler2003"
|
||||||
yum install curl wget -y 1> /dev/null
|
yum install curl wget -y 1> /dev/null
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
elif echo $OUTPUT | grep -q "openEuler 22.03" ; then
|
elif echo $OUTPUT | grep -q "openEuler 22.03" ; then
|
||||||
echo -e "\nDetecting openEuler 22.03...\n"
|
echo -e "\nDetecting openEuler 22.03...\n"
|
||||||
SERVER_OS="openEuler"
|
SERVER_OS="openEuler2203"
|
||||||
|
yum install curl wget -y 1> /dev/null
|
||||||
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
|
elif echo $OUTPUT | grep -q "openEuler 24.03" ; then
|
||||||
|
echo -e "\nDetecting openEuler 24.03...\n"
|
||||||
|
SERVER_OS="openEuler2403"
|
||||||
yum install curl wget -y 1> /dev/null
|
yum install curl wget -y 1> /dev/null
|
||||||
yum update curl wget ca-certificates -y 1> /dev/null
|
yum update curl wget ca-certificates -y 1> /dev/null
|
||||||
else
|
else
|
||||||
|
|
||||||
echo -e "\nUnable to detect your OS...\n"
|
echo -e "\nUnable to detect your OS...\n"
|
||||||
echo -e "\nCyberPanel is supported on:\n"
|
echo -e "\nCyberPanel is supported on:\n"
|
||||||
echo -e "Ubuntu: 20.04, 22.04, 24.04, 24.04.3\n"
|
echo -e "Ubuntu: 18.04, 20.04, 20.10, 22.04, 24.04, 24.04.3\n"
|
||||||
echo -e "Debian: 11, 12, 13\n"
|
echo -e "Debian: 11, 12, 13\n"
|
||||||
echo -e "AlmaLinux: 8, 9, 10\n"
|
echo -e "AlmaLinux: 8, 9, 10\n"
|
||||||
echo -e "RockyLinux: 8, 9\n"
|
echo -e "RockyLinux: 8, 9\n"
|
||||||
echo -e "RHEL: 8, 9\n"
|
echo -e "RHEL: 8, 9\n"
|
||||||
echo -e "CentOS: 7, 9, Stream 9\n"
|
echo -e "CentOS: 7, 8, 9, Stream 8, Stream 9\n"
|
||||||
echo -e "CloudLinux: 8, 9\n"
|
echo -e "CloudLinux: 7, 8, 9\n"
|
||||||
echo -e "openEuler: 20.03, 22.03\n"
|
echo -e "openEuler: 20.03, 22.03, 24.03\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -81,8 +81,24 @@ class preFlightsChecks:
|
|||||||
def get_service_name(self, service):
|
def get_service_name(self, service):
|
||||||
"""Get the correct service name for the current distribution"""
|
"""Get the correct service name for the current distribution"""
|
||||||
service_map = {
|
service_map = {
|
||||||
'pdns': 'pdns'
|
'pdns': 'pdns',
|
||||||
|
'powerdns': 'pdns',
|
||||||
|
'pure-ftpd': 'pure-ftpd',
|
||||||
|
'pureftpd': 'pure-ftpd'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Platform-specific service name mapping
|
||||||
|
if self.is_debian_family():
|
||||||
|
if service in ['pdns', 'powerdns']:
|
||||||
|
return 'pdns-server'
|
||||||
|
elif service in ['pure-ftpd', 'pureftpd']:
|
||||||
|
return 'pure-ftpd'
|
||||||
|
elif self.is_centos_family():
|
||||||
|
if service in ['pdns', 'powerdns']:
|
||||||
|
return 'pdns'
|
||||||
|
elif service in ['pure-ftpd', 'pureftpd']:
|
||||||
|
return 'pure-ftpd'
|
||||||
|
|
||||||
return service_map.get(service, service)
|
return service_map.get(service, service)
|
||||||
|
|
||||||
def manage_service(self, service_name, action="start"):
|
def manage_service(self, service_name, action="start"):
|
||||||
|
|||||||
Reference in New Issue
Block a user