Refactor CyberPanel installer for improved user experience and compatibility

- Renamed the installer to "CyberPanel Simple Installer" and simplified the banner and menu displays for better clarity.
- Removed color codes for output to enhance compatibility across different terminal environments.
- Updated status messages to provide clearer feedback during the installation process.
- Streamlined prompts and logging for a more user-friendly experience.
This commit is contained in:
Master3395
2025-09-25 13:10:20 +02:00
parent a0e1201691
commit 846fa79606
3 changed files with 2477 additions and 247 deletions

View File

@@ -1,23 +1,10 @@
#!/bin/bash #!/bin/bash
# CyberPanel Complete Standalone Installer # CyberPanel Simple Installer
# Full-featured installer with interactive menus and all options # Ultra-simple version that works reliably in all terminals
# This version works when downloaded via curl
set -e set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
BOLD='\033[1m'
DIM='\033[2m'
NC='\033[0m' # No Color
# Global variables # Global variables
SERVER_OS="" SERVER_OS=""
OS_FAMILY="" OS_FAMILY=""
@@ -26,7 +13,6 @@ ARCHITECTURE=""
BRANCH_NAME="" BRANCH_NAME=""
DEBUG_MODE=false DEBUG_MODE=false
AUTO_INSTALL=false AUTO_INSTALL=false
INTERACTIVE_MODE=true
INSTALLATION_TYPE="" INSTALLATION_TYPE=""
# Logging function # Logging function
@@ -34,11 +20,10 @@ log_message() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] [CYBERPANEL] $1" | tee -a "/var/log/cyberpanel_install.log" 2>/dev/null || echo "[$(date '+%Y-%m-%d %H:%M:%S')] [CYBERPANEL] $1" echo "[$(date '+%Y-%m-%d %H:%M:%S')] [CYBERPANEL] $1" | tee -a "/var/log/cyberpanel_install.log" 2>/dev/null || echo "[$(date '+%Y-%m-%d %H:%M:%S')] [CYBERPANEL] $1"
} }
# Print colored output # Print status
print_status() { print_status() {
local color=$1 local message="$1"
local message=$2 echo "$message"
echo -e "${color}${message}${NC}"
log_message "$message" log_message "$message"
} }
@@ -46,34 +31,34 @@ print_status() {
show_banner() { show_banner() {
clear clear
echo "" echo ""
echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" echo "==============================================================================================================="
echo " " echo " CYBERPANEL COMPLETE INSTALLER"
echo "║ 🚀 CYBERPANEL COMPLETE INSTALLER 🚀 ║" echo "==============================================================================================================="
echo "║ ║" echo ""
echo " The Ultimate Web Hosting Control Panel" echo " The Ultimate Web Hosting Control Panel"
echo " Powered by OpenLiteSpeed • Fast • Secure • Scalable" echo " Powered by OpenLiteSpeed • Fast • Secure • Scalable"
echo "║ ║" echo ""
echo " Interactive Menus • Version Selection • Advanced Options ✨ ║" echo " Interactive Menus • Version Selection • Advanced Options"
echo "║ ║" echo ""
echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" echo "==============================================================================================================="
echo "" echo ""
} }
# Function to detect OS # Function to detect OS
detect_os() { detect_os() {
print_status "$BLUE" "🔍 Detecting operating system..." print_status "Detecting operating system..."
# Detect architecture # Detect architecture
ARCHITECTURE=$(uname -m) ARCHITECTURE=$(uname -m)
case $ARCHITECTURE in case $ARCHITECTURE in
x86_64) x86_64)
print_status "$GREEN" "Architecture: x86_64 (Supported)" print_status "Architecture: x86_64 (Supported)"
;; ;;
aarch64|arm64) aarch64|arm64)
print_status "$YELLOW" "Architecture: $ARCHITECTURE (Limited support)" print_status "Architecture: $ARCHITECTURE (Limited support)"
;; ;;
*) *)
print_status "$RED" "Architecture: $ARCHITECTURE (Not supported)" print_status "Architecture: $ARCHITECTURE (Not supported)"
return 1 return 1
;; ;;
esac esac
@@ -81,7 +66,7 @@ detect_os() {
# Get OS release information # Get OS release information
local OUTPUT=$(cat /etc/*release 2>/dev/null) local OUTPUT=$(cat /etc/*release 2>/dev/null)
if [ -z "$OUTPUT" ]; then if [ -z "$OUTPUT" ]; then
print_status "$RED" "❌ Cannot read OS release information" print_status "ERROR: Cannot read OS release information"
return 1 return 1
fi fi
@@ -90,55 +75,55 @@ detect_os() {
SERVER_OS="AlmaLinux9" SERVER_OS="AlmaLinux9"
OS_FAMILY="rhel" OS_FAMILY="rhel"
PACKAGE_MANAGER="dnf" PACKAGE_MANAGER="dnf"
print_status "$GREEN" "Detected: AlmaLinux 9" print_status "Detected: AlmaLinux 9"
elif echo $OUTPUT | grep -q "AlmaLinux 8" ; then elif echo $OUTPUT | grep -q "AlmaLinux 8" ; then
SERVER_OS="AlmaLinux8" SERVER_OS="AlmaLinux8"
OS_FAMILY="rhel" OS_FAMILY="rhel"
PACKAGE_MANAGER="yum" PACKAGE_MANAGER="yum"
print_status "$GREEN" "Detected: AlmaLinux 8" print_status "Detected: AlmaLinux 8"
elif echo $OUTPUT | grep -q "CentOS Linux 9" ; then elif echo $OUTPUT | grep -q "CentOS Linux 9" ; then
SERVER_OS="CentOS9" SERVER_OS="CentOS9"
OS_FAMILY="rhel" OS_FAMILY="rhel"
PACKAGE_MANAGER="dnf" PACKAGE_MANAGER="dnf"
print_status "$GREEN" "Detected: CentOS Linux 9" print_status "Detected: CentOS Linux 9"
elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then
SERVER_OS="CentOS8" SERVER_OS="CentOS8"
OS_FAMILY="rhel" OS_FAMILY="rhel"
PACKAGE_MANAGER="yum" PACKAGE_MANAGER="yum"
print_status "$GREEN" "Detected: CentOS Linux 8" print_status "Detected: CentOS Linux 8"
elif echo $OUTPUT | grep -q "Rocky Linux 9" ; then elif echo $OUTPUT | grep -q "Rocky Linux 9" ; then
SERVER_OS="RockyLinux9" SERVER_OS="RockyLinux9"
OS_FAMILY="rhel" OS_FAMILY="rhel"
PACKAGE_MANAGER="dnf" PACKAGE_MANAGER="dnf"
print_status "$GREEN" "Detected: Rocky Linux 9" print_status "Detected: Rocky Linux 9"
elif echo $OUTPUT | grep -q "Rocky Linux 8" ; then elif echo $OUTPUT | grep -q "Rocky Linux 8" ; then
SERVER_OS="RockyLinux8" SERVER_OS="RockyLinux8"
OS_FAMILY="rhel" OS_FAMILY="rhel"
PACKAGE_MANAGER="yum" PACKAGE_MANAGER="yum"
print_status "$GREEN" "Detected: Rocky Linux 8" print_status "Detected: Rocky Linux 8"
elif echo $OUTPUT | grep -q "Ubuntu 22.04" ; then elif echo $OUTPUT | grep -q "Ubuntu 22.04" ; then
SERVER_OS="Ubuntu2204" SERVER_OS="Ubuntu2204"
OS_FAMILY="debian" OS_FAMILY="debian"
PACKAGE_MANAGER="apt" PACKAGE_MANAGER="apt"
print_status "$GREEN" "Detected: Ubuntu 22.04" print_status "Detected: Ubuntu 22.04"
elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then
SERVER_OS="Ubuntu2004" SERVER_OS="Ubuntu2004"
OS_FAMILY="debian" OS_FAMILY="debian"
PACKAGE_MANAGER="apt" PACKAGE_MANAGER="apt"
print_status "$GREEN" "Detected: Ubuntu 20.04" print_status "Detected: Ubuntu 20.04"
elif echo $OUTPUT | grep -q "Debian GNU/Linux 12" ; then elif echo $OUTPUT | grep -q "Debian GNU/Linux 12" ; then
SERVER_OS="Debian12" SERVER_OS="Debian12"
OS_FAMILY="debian" OS_FAMILY="debian"
PACKAGE_MANAGER="apt" PACKAGE_MANAGER="apt"
print_status "$GREEN" "Detected: Debian GNU/Linux 12" print_status "Detected: Debian GNU/Linux 12"
elif echo $OUTPUT | grep -q "Debian GNU/Linux 11" ; then elif echo $OUTPUT | grep -q "Debian GNU/Linux 11" ; then
SERVER_OS="Debian11" SERVER_OS="Debian11"
OS_FAMILY="debian" OS_FAMILY="debian"
PACKAGE_MANAGER="apt" PACKAGE_MANAGER="apt"
print_status "$GREEN" "Detected: Debian GNU/Linux 11" print_status "Detected: Debian GNU/Linux 11"
else else
print_status "$RED" "❌ Unsupported OS detected" print_status "ERROR: Unsupported OS detected"
print_status "$YELLOW" "Supported OS: AlmaLinux 8/9, CentOS 8/9, Rocky Linux 8/9, Ubuntu 20.04/22.04, Debian 11/12" print_status "Supported OS: AlmaLinux 8/9, CentOS 8/9, Rocky Linux 8/9, Ubuntu 20.04/22.04, Debian 11/12"
return 1 return 1
fi fi
@@ -147,7 +132,7 @@ detect_os() {
# Function to install dependencies # Function to install dependencies
install_dependencies() { install_dependencies() {
print_status "$BLUE" "📦 Installing dependencies..." print_status "Installing dependencies..."
case $OS_FAMILY in case $OS_FAMILY in
"rhel") "rhel")
@@ -163,8 +148,8 @@ install_dependencies() {
if [ "$SERVER_OS" = "AlmaLinux9" ] || [ "$SERVER_OS" = "CentOS9" ] || [ "$SERVER_OS" = "RockyLinux9" ]; then if [ "$SERVER_OS" = "AlmaLinux9" ] || [ "$SERVER_OS" = "CentOS9" ] || [ "$SERVER_OS" = "RockyLinux9" ]; then
# AlmaLinux 9 / CentOS 9 / Rocky Linux 9 # AlmaLinux 9 / CentOS 9 / Rocky Linux 9
$PACKAGE_MANAGER install -y ImageMagick gd libicu oniguruma python3 python3-pip python3-devel 2>/dev/null || true $PACKAGE_MANAGER install -y ImageMagick gd libicu oniguruma python3 python3-pip python3-devel 2>/dev/null || true
$PACKAGE_MANAGER install -y aspell 2>/dev/null || print_status "$YELLOW" "aspell not available, skipping..." $PACKAGE_MANAGER install -y aspell 2>/dev/null || print_status "WARNING: aspell not available, skipping..."
$PACKAGE_MANAGER install -y libc-client-devel 2>/dev/null || print_status "$YELLOW" "libc-client-devel not available, skipping..." $PACKAGE_MANAGER install -y libc-client-devel 2>/dev/null || print_status "WARNING: libc-client-devel not available, skipping..."
else else
# AlmaLinux 8 / CentOS 8 / Rocky Linux 8 # AlmaLinux 8 / CentOS 8 / Rocky Linux 8
$PACKAGE_MANAGER install -y ImageMagick gd libicu oniguruma aspell libc-client-devel python3 python3-pip python3-devel 2>/dev/null || true $PACKAGE_MANAGER install -y ImageMagick gd libicu oniguruma aspell libc-client-devel python3 python3-pip python3-devel 2>/dev/null || true
@@ -182,17 +167,17 @@ install_dependencies() {
# Install core packages # Install core packages
apt install -y -qq imagemagick php-gd libicu-dev libonig-dev 2>/dev/null || true apt install -y -qq imagemagick php-gd libicu-dev libonig-dev 2>/dev/null || true
apt install -y -qq aspell 2>/dev/null || print_status "$YELLOW" "aspell not available, skipping..." apt install -y -qq aspell 2>/dev/null || print_status "WARNING: aspell not available, skipping..."
apt install -y -qq libc-client-dev 2>/dev/null || print_status "$YELLOW" "libc-client-dev not available, skipping..." apt install -y -qq libc-client-dev 2>/dev/null || print_status "WARNING: libc-client-dev not available, skipping..."
;; ;;
esac esac
print_status "$GREEN" "✅ Dependencies installed successfully" print_status "SUCCESS: Dependencies installed successfully"
} }
# Function to install CyberPanel # Function to install CyberPanel
install_cyberpanel() { install_cyberpanel() {
print_status "$BLUE" "🚀 Installing CyberPanel..." print_status "Installing CyberPanel..."
# Download and run the original installer # Download and run the original installer
if [ -n "$BRANCH_NAME" ]; then if [ -n "$BRANCH_NAME" ]; then
@@ -205,17 +190,17 @@ install_cyberpanel() {
# Run the installer # Run the installer
if ./cyberpanel.sh $([ "$DEBUG_MODE" = true ] && echo "--debug") > /tmp/cyberpanel_install_output.log 2>&1; then if ./cyberpanel.sh $([ "$DEBUG_MODE" = true ] && echo "--debug") > /tmp/cyberpanel_install_output.log 2>&1; then
print_status "$GREEN" "✅ CyberPanel installed successfully" print_status "SUCCESS: CyberPanel installed successfully"
return 0 return 0
else else
print_status "$RED" "❌ CyberPanel installation failed. Check /tmp/cyberpanel_install_output.log for details" print_status "ERROR: CyberPanel installation failed. Check /tmp/cyberpanel_install_output.log for details"
return 1 return 1
fi fi
} }
# Function to apply fixes # Function to apply fixes
apply_fixes() { apply_fixes() {
print_status "$BLUE" "🔧 Applying installation fixes..." print_status "Applying installation fixes..."
# Fix database issues # Fix database issues
systemctl start mariadb 2>/dev/null || true systemctl start mariadb 2>/dev/null || true
@@ -277,68 +262,66 @@ EOF
systemctl daemon-reload systemctl daemon-reload
systemctl enable cyberpanel systemctl enable cyberpanel
print_status "$GREEN" "✅ All fixes applied successfully" print_status "SUCCESS: All fixes applied successfully"
} }
# Function to show status summary # Function to show status summary
show_status_summary() { show_status_summary() {
echo "" echo ""
echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" echo "==============================================================================================================="
echo " " echo " CYBERPANEL INSTALLATION STATUS"
echo "║ 📊 CYBERPANEL INSTALLATION STATUS 📊 ║" echo "==============================================================================================================="
echo "║ ║"
echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝"
echo "" echo ""
echo "🔧 CORE SERVICES STATUS:" echo "CORE SERVICES STATUS:"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "--------------------------------------------------------------------------------"
# Check services # Check services
if systemctl is-active --quiet mariadb; then if systemctl is-active --quiet mariadb; then
echo " MariaDB Database: RUNNING" echo "SUCCESS: MariaDB Database - RUNNING"
else else
echo " MariaDB Database: NOT RUNNING" echo "ERROR: MariaDB Database - NOT RUNNING"
fi fi
if systemctl is-active --quiet lsws; then if systemctl is-active --quiet lsws; then
echo " LiteSpeed Web Server: RUNNING" echo "SUCCESS: LiteSpeed Web Server - RUNNING"
else else
echo " LiteSpeed Web Server: NOT RUNNING" echo "ERROR: LiteSpeed Web Server - NOT RUNNING"
fi fi
if systemctl is-active --quiet cyberpanel; then if systemctl is-active --quiet cyberpanel; then
echo " CyberPanel Application: RUNNING" echo "SUCCESS: CyberPanel Application - RUNNING"
else else
echo " CyberPanel Application: NOT RUNNING" echo "ERROR: CyberPanel Application - NOT RUNNING"
fi fi
echo "" echo ""
echo "🌐 NETWORK PORTS STATUS:" echo "NETWORK PORTS STATUS:"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "--------------------------------------------------------------------------------"
# Check ports # Check ports
if netstat -tlnp | grep -q ":8090 "; then if netstat -tlnp | grep -q ":8090 "; then
echo " Port 8090 (CyberPanel): LISTENING" echo "SUCCESS: Port 8090 (CyberPanel) - LISTENING"
else else
echo " Port 8090 (CyberPanel): NOT LISTENING" echo "ERROR: Port 8090 (CyberPanel) - NOT LISTENING"
fi fi
if netstat -tlnp | grep -q ":80 "; then if netstat -tlnp | grep -q ":80 "; then
echo " Port 80 (HTTP): LISTENING" echo "SUCCESS: Port 80 (HTTP) - LISTENING"
else else
echo " Port 80 (HTTP): NOT LISTENING" echo "ERROR: Port 80 (HTTP) - NOT LISTENING"
fi fi
echo "" echo ""
echo "📊 SUMMARY:" echo "SUMMARY:"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "--------------------------------------------------------------------------------"
print_status "$GREEN" "🎉 INSTALLATION COMPLETED SUCCESSFULLY!" print_status "SUCCESS: INSTALLATION COMPLETED SUCCESSFULLY!"
echo "" echo ""
echo "🌐 Access CyberPanel at: http://your-server-ip:8090" echo "Access CyberPanel at: http://your-server-ip:8090"
echo "👤 Default username: admin" echo "Default username: admin"
echo "🔑 Default password: 1234567" echo "Default password: 1234567"
echo "" echo ""
echo "⚠️ IMPORTANT: Change the default password immediately!" echo "IMPORTANT: Change the default password immediately!"
echo "" echo ""
} }
@@ -346,18 +329,18 @@ show_status_summary() {
show_main_menu() { show_main_menu() {
show_banner show_banner
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo " SELECT INSTALLATION TYPE" echo " SELECT INSTALLATION TYPE"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
echo " 1. 🚀 Fresh Installation (Recommended)" echo " 1. Fresh Installation (Recommended)"
echo " 2. 🔄 Update Existing Installation" echo " 2. Update Existing Installation"
echo " 3. 🔧 Reinstall CyberPanel" echo " 3. Reinstall CyberPanel"
echo " 4. 📊 Check System Status" echo " 4. Check System Status"
echo " 5. 🛠️ Advanced Options" echo " 5. Advanced Options"
echo " 6. Exit" echo " 6. Exit"
echo "" echo ""
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
while true; do while true; do
@@ -395,7 +378,7 @@ show_main_menu() {
;; ;;
*) *)
echo "" echo ""
echo " Invalid choice. Please enter 1-6." echo "ERROR: Invalid choice. Please enter 1-6."
echo "" echo ""
;; ;;
esac esac
@@ -405,14 +388,14 @@ show_main_menu() {
# Function to show fresh installation menu # Function to show fresh installation menu
show_fresh_install_menu() { show_fresh_install_menu() {
echo "" echo ""
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo " 🚀 FRESH INSTALLATION SETUP" echo " FRESH INSTALLATION SETUP"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
# Check if CyberPanel is already installed # Check if CyberPanel is already installed
if [ -d "/usr/local/CyberCP" ] && [ -f "/usr/local/CyberCP/manage.py" ]; then if [ -d "/usr/local/CyberCP" ] && [ -f "/usr/local/CyberCP/manage.py" ]; then
echo "⚠️ WARNING: CyberPanel appears to be already installed on this system." echo "WARNING: CyberPanel appears to be already installed on this system."
echo " Consider using 'Update' or 'Reinstall' options instead." echo " Consider using 'Update' or 'Reinstall' options instead."
echo "" echo ""
echo -n "Do you want to continue with fresh installation anyway? (y/n): " echo -n "Do you want to continue with fresh installation anyway? (y/n): "
@@ -429,13 +412,13 @@ show_fresh_install_menu() {
echo "Select installation option:" echo "Select installation option:"
echo "" echo ""
echo " 1. 📦 Install Latest Stable Version" echo " 1. Install Latest Stable Version"
echo " 2. 🔬 Install Development Version (v2.5.5-dev)" echo " 2. Install Development Version (v2.5.5-dev)"
echo " 3. 🏷️ Install Specific Version/Branch" echo " 3. Install Specific Version/Branch"
echo " 4. Quick Install (Auto-configure everything)" echo " 4. Quick Install (Auto-configure everything)"
echo " 5. 🔙 Back to Main Menu" echo " 5. Back to Main Menu"
echo "" echo ""
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
while true; do while true; do
@@ -469,7 +452,7 @@ show_fresh_install_menu() {
;; ;;
*) *)
echo "" echo ""
echo " Invalid choice. Please enter 1-5." echo "ERROR: Invalid choice. Please enter 1-5."
echo "" echo ""
;; ;;
esac esac
@@ -479,9 +462,9 @@ show_fresh_install_menu() {
# Function to show version selection # Function to show version selection
show_version_selection() { show_version_selection() {
echo "" echo ""
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo " 🏷️ VERSION SELECTION" echo " VERSION SELECTION"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
echo "Available versions:" echo "Available versions:"
echo "" echo ""
@@ -490,7 +473,7 @@ show_version_selection() {
echo " 3. v2.5.4 (Previous Stable)" echo " 3. v2.5.4 (Previous Stable)"
echo " 4. Custom Branch/Commit" echo " 4. Custom Branch/Commit"
echo "" echo ""
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
while true; do while true; do
@@ -517,7 +500,7 @@ show_version_selection() {
;; ;;
*) *)
echo "" echo ""
echo " Invalid choice. Please enter 1-4." echo "ERROR: Invalid choice. Please enter 1-4."
echo "" echo ""
;; ;;
esac esac
@@ -529,9 +512,9 @@ show_version_selection() {
# Function to show installation preferences # Function to show installation preferences
show_installation_preferences() { show_installation_preferences() {
echo "" echo ""
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo " ⚙️ INSTALLATION PREFERENCES" echo " INSTALLATION PREFERENCES"
echo "═══════════════════════════════════════════════════════════════════════════════════════════════════════════════" echo "==============================================================================================================="
echo "" echo ""
# Debug mode # Debug mode
@@ -554,15 +537,16 @@ show_installation_preferences() {
# Show summary # Show summary
echo "" echo ""
echo "╔═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╗" echo "==============================================================================================================="
echo " INSTALLATION SUMMARY" echo " INSTALLATION SUMMARY"
echo "║ ║" echo "==============================================================================================================="
echo "║ Type: $INSTALLATION_TYPE" echo ""
echo " Version: ${BRANCH_NAME:-'Latest Stable'}" echo " Type: $INSTALLATION_TYPE"
echo " Debug Mode: $DEBUG_MODE" echo " Version: ${BRANCH_NAME:-'Latest Stable'}"
echo " Auto Install: $AUTO_INSTALL" echo " Debug Mode: $DEBUG_MODE"
echo "║ ║" echo " Auto Install: $AUTO_INSTALL"
echo "╚═══════════════════════════════════════════════════════════════════════════════════════════════════════════════╝" echo ""
echo "==============================================================================================================="
echo "" echo ""
echo -n "Proceed with installation? (y/n) [y]: " echo -n "Proceed with installation? (y/n) [y]: "
@@ -580,12 +564,14 @@ show_installation_preferences() {
# Function to show update menu # Function to show update menu
show_update_menu() { show_update_menu() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🔄 Update Installation${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " UPDATE INSTALLATION"
echo "==============================================================================================================="
echo ""
if [ ! -d "/usr/local/CyberCP" ] || [ ! -f "/usr/local/CyberCP/manage.py" ]; then if [ ! -d "/usr/local/CyberCP" ] || [ ! -f "/usr/local/CyberCP/manage.py" ]; then
echo -e "${RED} CyberPanel is not installed on this system.${NC}" echo "ERROR: CyberPanel is not installed on this system."
echo -e "${RED}Please use 'Fresh Installation' instead.${NC}" echo " Please use 'Fresh Installation' instead."
echo "" echo ""
read -p "Press Enter to return to main menu..." read -p "Press Enter to return to main menu..."
show_main_menu show_main_menu
@@ -598,28 +584,23 @@ show_update_menu() {
current_version=$(cat /usr/local/CyberCP/version.txt 2>/dev/null) current_version=$(cat /usr/local/CyberCP/version.txt 2>/dev/null)
fi fi
echo -e "${GREEN}Current Installation:${NC}" echo "Current Installation:"
echo -e "Version: $current_version" echo "Version: $current_version"
echo -e "Path: /usr/local/CyberCP" echo "Path: /usr/local/CyberCP"
echo "" echo ""
local options=( echo "Select update option:"
"📈 Update to Latest Stable"
"🔬 Update to Development Version"
"🏷️ Update to Specific Version"
"🔙 Back to Main Menu"
)
echo -e "${WHITE}${BOLD}Update Options:${NC}"
echo "" echo ""
for i in "${!options[@]}"; do echo " 1. Update to Latest Stable"
local option_num=$((i + 1)) echo " 2. Update to Development Version"
echo -e "${BLUE}${option_num}.${NC} ${options[i]}" echo " 3. Update to Specific Version"
done echo " 4. Back to Main Menu"
echo ""
echo "==============================================================================================================="
echo "" echo ""
while true; do while true; do
echo -e "${CYAN}Select update option${NC} [1-4]: " echo -n "Select update option [1-4]: "
read -r choice read -r choice
case $choice in case $choice in
@@ -640,12 +621,14 @@ show_update_menu() {
return return
;; ;;
*) *)
echo -e "${RED}Invalid choice. Please enter 1-4.${NC}" echo ""
echo "ERROR: Invalid choice. Please enter 1-4."
echo ""
;; ;;
esac esac
done done
echo -e "${CYAN}Proceed with update? (This will backup your current installation) (y/n)${NC} [y]: " echo -n "Proceed with update? (This will backup your current installation) (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
@@ -660,23 +643,25 @@ show_update_menu() {
# Function to show reinstall menu # Function to show reinstall menu
show_reinstall_menu() { show_reinstall_menu() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🔧 Reinstall CyberPanel${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " REINSTALL CYBERPANEL"
echo "==============================================================================================================="
echo ""
if [ ! -d "/usr/local/CyberCP" ] || [ ! -f "/usr/local/CyberCP/manage.py" ]; then if [ ! -d "/usr/local/CyberCP" ] || [ ! -f "/usr/local/CyberCP/manage.py" ]; then
echo -e "${RED} CyberPanel is not installed on this system.${NC}" echo "ERROR: CyberPanel is not installed on this system."
echo -e "${RED}Please use 'Fresh Installation' instead.${NC}" echo " Please use 'Fresh Installation' instead."
echo "" echo ""
read -p "Press Enter to return to main menu..." read -p "Press Enter to return to main menu..."
show_main_menu show_main_menu
return return
fi fi
echo -e "${YELLOW}⚠️ WARNING: This will completely remove the existing CyberPanel installation${NC}" echo "WARNING: This will completely remove the existing CyberPanel installation"
echo -e "${YELLOW}and install a fresh copy. All data will be lost!${NC}" echo " and install a fresh copy. All data will be lost!"
echo "" echo ""
echo -e "${CYAN}Are you sure you want to reinstall? (y/n)${NC} [n]: " echo -n "Are you sure you want to reinstall? (y/n) [n]: "
read -r response read -r response
case $response in case $response in
[yY]|[yY][eE][sS]) [yY]|[yY][eE][sS])
@@ -687,23 +672,18 @@ show_reinstall_menu() {
;; ;;
esac esac
local options=( echo "Select reinstall option:"
"📦 Reinstall Latest Stable"
"🔬 Reinstall Development Version"
"🏷️ Reinstall Specific Version"
"🔙 Back to Main Menu"
)
echo -e "${WHITE}${BOLD}Reinstall Options:${NC}"
echo "" echo ""
for i in "${!options[@]}"; do echo " 1. Reinstall Latest Stable"
local option_num=$((i + 1)) echo " 2. Reinstall Development Version"
echo -e "${BLUE}${option_num}.${NC} ${options[i]}" echo " 3. Reinstall Specific Version"
done echo " 4. Back to Main Menu"
echo ""
echo "==============================================================================================================="
echo "" echo ""
while true; do while true; do
echo -e "${CYAN}Select reinstall option${NC} [1-4]: " echo -n "Select reinstall option [1-4]: "
read -r choice read -r choice
case $choice in case $choice in
@@ -724,12 +704,14 @@ show_reinstall_menu() {
return return
;; ;;
*) *)
echo -e "${RED}Invalid choice. Please enter 1-4.${NC}" echo ""
echo "ERROR: Invalid choice. Please enter 1-4."
echo ""
;; ;;
esac esac
done done
echo -e "${CYAN}Proceed with reinstall? (This will delete all existing data) (y/n)${NC} [n]: " echo -n "Proceed with reinstall? (This will delete all existing data) (y/n) [n]: "
read -r response read -r response
case $response in case $response in
[yY]|[yY][eE][sS]) [yY]|[yY][eE][sS])
@@ -744,12 +726,14 @@ show_reinstall_menu() {
# Function to show system status # Function to show system status
show_system_status() { show_system_status() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}📊 System Status Check${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " SYSTEM STATUS CHECK"
echo "==============================================================================================================="
echo ""
# Check OS # Check OS
local os_info=$(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2 2>/dev/null || echo 'Unknown') local os_info=$(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2 2>/dev/null || echo 'Unknown')
echo -e "${WHITE}Operating System:${NC} $os_info" echo "Operating System: $os_info"
# Check CyberPanel installation # Check CyberPanel installation
if [ -d "/usr/local/CyberCP" ] && [ -f "/usr/local/CyberCP/manage.py" ]; then if [ -d "/usr/local/CyberCP" ] && [ -f "/usr/local/CyberCP/manage.py" ]; then
@@ -757,47 +741,49 @@ show_system_status() {
if [ -f "/usr/local/CyberCP/version.txt" ]; then if [ -f "/usr/local/CyberCP/version.txt" ]; then
version=$(cat /usr/local/CyberCP/version.txt 2>/dev/null) version=$(cat /usr/local/CyberCP/version.txt 2>/dev/null)
fi fi
echo -e "${GREEN}CyberPanel:${NC} Installed (Version: $version)" echo "CyberPanel: Installed (Version: $version)"
else else
echo -e "${RED}CyberPanel:${NC} Not Installed" echo "CyberPanel: Not Installed"
fi fi
# Check services # Check services
echo -e "\n${WHITE}Services Status:${NC}" echo ""
echo "Services Status:"
if systemctl is-active --quiet mariadb; then if systemctl is-active --quiet mariadb; then
echo -e " ${GREEN}${NC} MariaDB: Running" echo " SUCCESS: MariaDB - Running"
else else
echo -e " ${RED}${NC} MariaDB: Not Running" echo " ERROR: MariaDB - Not Running"
fi fi
if systemctl is-active --quiet lsws; then if systemctl is-active --quiet lsws; then
echo -e " ${GREEN}${NC} LiteSpeed: Running" echo " SUCCESS: LiteSpeed - Running"
else else
echo -e " ${RED}${NC} LiteSpeed: Not Running" echo " ERROR: LiteSpeed - Not Running"
fi fi
if systemctl is-active --quiet cyberpanel; then if systemctl is-active --quiet cyberpanel; then
echo -e " ${GREEN}${NC} CyberPanel: Running" echo " SUCCESS: CyberPanel - Running"
else else
echo -e " ${RED}${NC} CyberPanel: Not Running" echo " ERROR: CyberPanel - Not Running"
fi fi
# Check ports # Check ports
echo -e "\n${WHITE}Port Status:${NC}" echo ""
echo "Port Status:"
if netstat -tlnp | grep -q ":8090 "; then if netstat -tlnp | grep -q ":8090 "; then
echo -e " ${GREEN}${NC} Port 8090 (CyberPanel): Listening" echo " SUCCESS: Port 8090 (CyberPanel) - Listening"
else else
echo -e " ${RED}${NC} Port 8090 (CyberPanel): Not Listening" echo " ERROR: Port 8090 (CyberPanel) - Not Listening"
fi fi
if netstat -tlnp | grep -q ":80 "; then if netstat -tlnp | grep -q ":80 "; then
echo -e " ${GREEN}${NC} Port 80 (HTTP): Listening" echo " SUCCESS: Port 80 (HTTP) - Listening"
else else
echo -e " ${RED}${NC} Port 80 (HTTP): Not Listening" echo " ERROR: Port 80 (HTTP) - Not Listening"
fi fi
echo "" echo ""
echo -e "${CYAN}Return to main menu? (y/n)${NC} [y]: " echo -n "Return to main menu? (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
@@ -812,27 +798,21 @@ show_system_status() {
# Function to show advanced menu # Function to show advanced menu
show_advanced_menu() { show_advanced_menu() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🛠️ Advanced Options${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " ADVANCED OPTIONS"
echo "==============================================================================================================="
local options=(
"🔧 Fix Installation Issues"
"🧹 Clean Installation Files"
"📋 View Installation Logs"
"🔍 System Diagnostics"
"🔙 Back to Main Menu"
)
echo -e "${WHITE}${BOLD}Advanced Options:${NC}"
echo "" echo ""
for i in "${!options[@]}"; do echo " 1. Fix Installation Issues"
local option_num=$((i + 1)) echo " 2. Clean Installation Files"
echo -e "${BLUE}${option_num}.${NC} ${options[i]}" echo " 3. View Installation Logs"
done echo " 4. System Diagnostics"
echo " 5. Back to Main Menu"
echo ""
echo "==============================================================================================================="
echo "" echo ""
while true; do while true; do
echo -e "${CYAN}Select advanced option${NC} [1-5]: " echo -n "Select advanced option [1-5]: "
read -r choice read -r choice
case $choice in case $choice in
@@ -857,7 +837,9 @@ show_advanced_menu() {
return return
;; ;;
*) *)
echo -e "${RED}Invalid choice. Please enter 1-5.${NC}" echo ""
echo "ERROR: Invalid choice. Please enter 1-5."
echo ""
;; ;;
esac esac
done done
@@ -866,26 +848,27 @@ show_advanced_menu() {
# Function to show fix menu # Function to show fix menu
show_fix_menu() { show_fix_menu() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🔧 Fix Installation Issues${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " FIX INSTALLATION ISSUES"
echo "==============================================================================================================="
echo -e "${YELLOW}This will attempt to fix common CyberPanel installation issues:${NC}" echo ""
echo "This will attempt to fix common CyberPanel installation issues:"
echo "• Database connection problems" echo "• Database connection problems"
echo "• Service configuration issues" echo "• Service configuration issues"
echo "• SSL certificate problems" echo "• SSL certificate problems"
echo "• File permission issues" echo "• File permission issues"
echo "" echo ""
echo -e "${CYAN}Proceed with fixing installation issues? (y/n)${NC} [y]: " echo -n "Proceed with fixing installation issues? (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
show_advanced_menu show_advanced_menu
;; ;;
*) *)
print_status "$BLUE" "🔧 Applying fixes..." print_status "Applying fixes..."
apply_fixes apply_fixes
print_status "$GREEN" "✅ Fixes applied successfully" print_status "SUCCESS: Fixes applied successfully"
echo "" echo ""
read -p "Press Enter to return to advanced menu..." read -p "Press Enter to return to advanced menu..."
show_advanced_menu show_advanced_menu
@@ -896,25 +879,26 @@ show_fix_menu() {
# Function to show clean menu # Function to show clean menu
show_clean_menu() { show_clean_menu() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🧹 Clean Installation Files${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " CLEAN INSTALLATION FILES"
echo "==============================================================================================================="
echo -e "${YELLOW}⚠️ WARNING: This will remove temporary installation files and logs.${NC}" echo ""
echo -e "${YELLOW}This action cannot be undone!${NC}" echo "WARNING: This will remove temporary installation files and logs."
echo " This action cannot be undone!"
echo "" echo ""
echo -e "${CYAN}Proceed with cleaning? (y/n)${NC} [n]: " echo -n "Proceed with cleaning? (y/n) [n]: "
read -r response read -r response
case $response in case $response in
[yY]|[yY][eE][sS]) [yY]|[yY][eE][sS])
rm -rf /tmp/cyberpanel_* rm -rf /tmp/cyberpanel_*
rm -rf /var/log/cyberpanel_install.log rm -rf /var/log/cyberpanel_install.log
echo -e "${GREEN} Cleanup complete! Temporary files and logs have been removed.${NC}" echo "SUCCESS: Cleanup complete! Temporary files and logs have been removed."
;; ;;
esac esac
echo "" echo ""
echo -e "${CYAN}Return to advanced menu? (y/n)${NC} [y]: " echo -n "Return to advanced menu? (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
@@ -929,32 +913,35 @@ show_clean_menu() {
# Function to show logs menu # Function to show logs menu
show_logs_menu() { show_logs_menu() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}📋 View Installation Logs${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " VIEW INSTALLATION LOGS"
echo "==============================================================================================================="
echo ""
local log_file="/var/log/cyberpanel_install.log" local log_file="/var/log/cyberpanel_install.log"
if [ -f "$log_file" ]; then if [ -f "$log_file" ]; then
echo -e "${WHITE}Installation Log:${NC} $log_file" echo "Installation Log: $log_file"
echo -e "${WHITE}Log Size:${NC} $(du -h "$log_file" | cut -f1)" echo "Log Size: $(du -h "$log_file" | cut -f1)"
echo "" echo ""
echo -e "${CYAN}View recent log entries? (y/n)${NC} [y]: " echo -n "View recent log entries? (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
;; ;;
*) *)
echo -e "${CYAN}Recent log entries:${NC}" echo ""
echo "Recent log entries:"
tail -n 20 "$log_file" tail -n 20 "$log_file"
;; ;;
esac esac
else else
echo -e "${YELLOW}No installation logs found at $log_file${NC}" echo "No installation logs found at $log_file"
fi fi
echo "" echo ""
echo -e "${CYAN}Return to advanced menu? (y/n)${NC} [y]: " echo -n "Return to advanced menu? (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
@@ -969,30 +956,35 @@ show_logs_menu() {
# Function to show diagnostics # Function to show diagnostics
show_diagnostics() { show_diagnostics() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🔍 System Diagnostics${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " SYSTEM DIAGNOSTICS"
echo "==============================================================================================================="
echo ""
echo -e "${WHITE}Running system diagnostics...${NC}" echo "Running system diagnostics..."
echo "" echo ""
# Disk space # Disk space
echo -e "${WHITE}Disk Usage:${NC}" echo "Disk Usage:"
df -h | grep -E '^/dev/' df -h | grep -E '^/dev/'
# Memory usage # Memory usage
echo -e "\n${WHITE}Memory Usage:${NC}" echo ""
echo "Memory Usage:"
free -h free -h
# Load average # Load average
echo -e "\n${WHITE}System Load:${NC}" echo ""
echo "System Load:"
uptime uptime
# Network interfaces # Network interfaces
echo -e "\n${WHITE}Network Interfaces:${NC}" echo ""
echo "Network Interfaces:"
ip addr show | grep -E '^[0-9]+:|inet ' ip addr show | grep -E '^[0-9]+:|inet '
echo "" echo ""
echo -e "${CYAN}Return to advanced menu? (y/n)${NC} [y]: " echo -n "Return to advanced menu? (y/n) [y]: "
read -r response read -r response
case $response in case $response in
[nN]|[nN][oO]) [nN]|[nN][oO])
@@ -1007,12 +999,14 @@ show_diagnostics() {
# Function to start installation # Function to start installation
start_installation() { start_installation() {
echo "" echo ""
echo -e "${PURPLE}${BOLD}🚀 Starting Installation${NC}" echo "==============================================================================================================="
echo -e "${PURPLE}═══════════════════════════════════════════════════════════════════════════════════════════════════════════════${NC}" echo " STARTING INSTALLATION"
echo "==============================================================================================================="
echo ""
# Detect OS # Detect OS
if ! detect_os; then if ! detect_os; then
print_status "$RED" "❌ Failed to detect operating system" print_status "ERROR: Failed to detect operating system"
exit 1 exit 1
fi fi
@@ -1021,7 +1015,7 @@ start_installation() {
# Install CyberPanel # Install CyberPanel
if ! install_cyberpanel; then if ! install_cyberpanel; then
print_status "$RED" "❌ CyberPanel installation failed" print_status "ERROR: CyberPanel installation failed"
exit 1 exit 1
fi fi
@@ -1031,7 +1025,7 @@ start_installation() {
# Show status summary # Show status summary
show_status_summary show_status_summary
print_status "$GREEN" "🎉 Installation completed successfully!" print_status "SUCCESS: Installation completed successfully!"
} }
# Function to parse command line arguments # Function to parse command line arguments
@@ -1049,7 +1043,6 @@ parse_arguments() {
;; ;;
--auto) --auto)
AUTO_INSTALL=true AUTO_INSTALL=true
INTERACTIVE_MODE=false
shift shift
;; ;;
-h|--help) -h|--help)
@@ -1068,7 +1061,7 @@ parse_arguments() {
exit 0 exit 0
;; ;;
*) *)
print_status "$YELLOW" "Unknown option: $1" print_status "WARNING: Unknown option: $1"
shift shift
;; ;;
esac esac
@@ -1081,8 +1074,8 @@ main() {
mkdir -p /var/log mkdir -p /var/log
touch "/var/log/cyberpanel_install.log" touch "/var/log/cyberpanel_install.log"
print_status "$BLUE" "🚀 CyberPanel Complete Installer Starting..." print_status "CyberPanel Simple Installer Starting..."
print_status "$BLUE" "Log file: /var/log/cyberpanel_install.log" print_status "Log file: /var/log/cyberpanel_install.log"
# Parse command line arguments # Parse command line arguments
parse_arguments "$@" parse_arguments "$@"
@@ -1090,11 +1083,11 @@ main() {
# Check if auto mode is requested # Check if auto mode is requested
if [ "$AUTO_INSTALL" = true ]; then if [ "$AUTO_INSTALL" = true ]; then
# Run auto mode # Run auto mode
print_status "$BLUE" "🤖 Starting auto mode..." print_status "Starting auto mode..."
# Detect OS # Detect OS
if ! detect_os; then if ! detect_os; then
print_status "$RED" "❌ Failed to detect operating system" print_status "ERROR: Failed to detect operating system"
exit 1 exit 1
fi fi
@@ -1103,7 +1096,7 @@ main() {
# Install CyberPanel # Install CyberPanel
if ! install_cyberpanel; then if ! install_cyberpanel; then
print_status "$RED" "❌ CyberPanel installation failed" print_status "ERROR: CyberPanel installation failed"
exit 1 exit 1
fi fi
@@ -1113,7 +1106,7 @@ main() {
# Show status summary # Show status summary
show_status_summary show_status_summary
print_status "$GREEN" "🎉 Installation completed successfully!" print_status "SUCCESS: Installation completed successfully!"
else else
# Run interactive mode # Run interactive mode
show_main_menu show_main_menu

1120
cyberpanel_clean.sh Normal file

File diff suppressed because it is too large Load Diff

1117
cyberpanel_simple.sh Normal file

File diff suppressed because it is too large Load Diff