Add support for openEuler and bug fixes

1.Added install support for openEuler 20.03LTS and 22.03LTS with YARO(Yet Another Repository for openEuler).
2.Fixed the bug when install restic on CentOS 8, now it can be installed directly through EPEL.
3.Updated some text descriptions.
This commit is contained in:
Aaron
2022-06-25 02:14:01 +08:00
parent bb9f273246
commit a1f420fa6b
8 changed files with 204 additions and 83 deletions

View File

@@ -5,8 +5,8 @@
#set -u #set -u
#CyberPanel installer script for CentOS 7.X, CentOS 8.X, CloudLinux 7.X, RockyLinux 8.X, Ubuntu 18.04, Ubuntu 20.04 , Ubuntu 20.10 and AlmaLinux 8.X #CyberPanel installer script for CentOS 7, CentOS 8, CloudLinux 7, AlmaLinux 8, RockyLinux 8, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, openEuler 20.03 and openEuler 22.03
#For whoever may edit this script, please follow : #For whoever may edit this script, please follow:
#Please use Pre_Install_xxx() and Post_Install_xxx() if you want to something respectively before or after the panel installation #Please use Pre_Install_xxx() and Post_Install_xxx() if you want to something respectively before or after the panel installation
#and update below accordingly #and update below accordingly
#Please use variable/functions name as MySomething or My_Something, and please try not to use too-short abbreviation :) #Please use variable/functions name as MySomething or My_Something, and please try not to use too-short abbreviation :)
@@ -16,13 +16,13 @@
#Set_Default_Variables() ---> set some default variable for later use #Set_Default_Variables() ---> set some default variable for later use
#Check_Root() ---> check for root #Check_Root() ---> check for root
#Check_Server_IP() ---> check for server IP and geolocation at country level #Check_Server_IP() ---> check for server IP and geolocation at country level
#Check_OS() ---> check system , support on centos7/8, rockylinux 8.x , almalinux 8.x ubutnu18/20 and cloudlinux 7 , 8 is untested. #Check_OS() ---> check system , support on CentOS 7/8, RockyLinux 8, AlmaLinux 8, Ubuntu 18/20, openEuler 20.03/22.03 and CloudLinux 7, 8 is untested.
#Check_Virtualization() ---> check for virtualizaon , #LXC not supported# , some edit needed on OVZ #Check_Virtualization() ---> check for virtualizaon , #LXC not supported# , some edit needed on OVZ
#Check_Panel() ---> check to make sure no other panel is installed #Check_Panel() ---> check to make sure no other panel is installed
#Check_Process() ---> check no other process like Apache is running #Check_Process() ---> check no other process like Apache is running
#Check_Provider() ---> check the provider, certain provider like Alibaba or Tencent Yun may need some special change #Check_Provider() ---> check the provider, certain provider like Alibaba or Tencent Cloud may need some special change
#Check_Argument() ---> parse argument and go to Argument_Mode() or Interactive_Mode() respectively #Check_Argument() ---> parse argument and go to Argument_Mode() or Interactive_Mode() respectively
#Pre_Install_Setup_Repository() ---> setup/install repositories for centos system. #Pre_Install_Setup_Repository() ---> setup/install repositories for CentOS and openEuler system.
#go to Pre_Install_Setup_CN_Repository() if server is within China. #go to Pre_Install_Setup_CN_Repository() if server is within China.
#Pre_Install_Setup_Git_URL() ---> form up github URL , use Gitee for servers within China. #Pre_Install_Setup_Git_URL() ---> form up github URL , use Gitee for servers within China.
#Pre_Install_Required_Components() ---> install required softwares and git clone it #Pre_Install_Required_Components() ---> install required softwares and git clone it
@@ -33,7 +33,7 @@
#Post_Install_Required_Components() ---> install some required softwares. #Post_Install_Required_Components() ---> install some required softwares.
#Post_Install_PHP_Session_Setup() ---> set up PHP session #Post_Install_PHP_Session_Setup() ---> set up PHP session
#Post_Install_PHP_TimezoneDB() ---> set up PHP timezoneDB #Post_Install_PHP_TimezoneDB() ---> set up PHP timezoneDB
#Post_Install_Regenerate_Cert() ---> regenerate cert for :7080 and :8090 to avoid Chrome on MacOS blocking. #Post_Install_Regenerate_Cert() ---> regenerate cert for :7080 and :8090 to avoid Chrome on macOS blocking.
#Post_Install_Regenerate_Webadmin_Console_Passwd() ---> regenerate the webadmin console password #Post_Install_Regenerate_Webadmin_Console_Passwd() ---> regenerate the webadmin console password
#Post_Install_Setup_Watchdog() ---> set up watchdog script for webserver and MariaDB. #Post_Install_Setup_Watchdog() ---> set up watchdog script for webserver and MariaDB.
#Post_Install_Setup_Utility() ---> set up utility script for some handy features #Post_Install_Setup_Utility() ---> set up utility script for some handy features
@@ -252,7 +252,6 @@ else
exit exit
fi fi
if ! uname -m | grep -q x86_64 ; then if ! uname -m | grep -q x86_64 ; then
echo -e "x86_64 system is required...\n" echo -e "x86_64 system is required...\n"
exit exit
@@ -268,22 +267,24 @@ elif grep -q -E "Rocky Linux" /etc/os-release ; then
Server_OS="RockyLinux" Server_OS="RockyLinux"
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10|Ubuntu 22.04" /etc/os-release ; then elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10|Ubuntu 22.04" /etc/os-release ; then
Server_OS="Ubuntu" Server_OS="Ubuntu"
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
Server_OS="openEuler"
else else
echo -e "Unable to detect your system..." echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, Ubuntu 22.04 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x...\n" echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, Ubuntu 22.04 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x... [404]" Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]"
exit exit
fi fi
Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d . ) Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d . )
#to make 20.04 display as 20 #to make 20.04 display as 20, etc.
echo -e "System: $Server_OS $Server_OS_Version detected...\n" echo -e "System: $Server_OS $Server_OS_Version detected...\n"
if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then
Server_OS="CentOS" Server_OS="CentOS"
#CloudLinux gives version id like 7.8 , 7.9 , so cut it to show first number only #CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only
#treat CL , Rocky and Alma as CentOS #treat CloudLinux, Rocky and Alma as CentOS
fi fi
if [[ "$Debug" = "On" ]] ; then if [[ "$Debug" = "On" ]] ; then
@@ -830,12 +831,6 @@ if [[ $Server_OS = "CentOS" ]] ; then
rm -f /etc/yum.repos.d/epel.repo rm -f /etc/yum.repos.d/epel.repo
rm -f /etc/yum.repos.d/epel.repo.rpmsave rm -f /etc/yum.repos.d/epel.repo.rpmsave
yum install -y yum-plugin-copr
Check_Return "yum repo" "no_exit"
yum copr enable -y copart/restic
Check_Return "yum repo" "no_exit"
if [[ "$Server_OS_Version" = "8" ]]; then if [[ "$Server_OS_Version" = "8" ]]; then
rpm --import https://cyberpanel.sh/www.centos.org/keys/RPM-GPG-KEY-CentOS-Official rpm --import https://cyberpanel.sh/www.centos.org/keys/RPM-GPG-KEY-CentOS-Official
rpm --import https://cyberpanel.sh/dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8 rpm --import https://cyberpanel.sh/dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
@@ -865,6 +860,10 @@ if [[ $Server_OS = "CentOS" ]] ; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Check_Return "yum repo" "no_exit" Check_Return "yum repo" "no_exit"
yum install -y yum-plugin-copr
Check_Return "yum repo" "no_exit"
yum copr enable -y copart/restic
Check_Return "yum repo" "no_exit"
yum install -y yum-plugin-priorities yum install -y yum-plugin-priorities
Check_Return "yum repo" "no_exit" Check_Return "yum repo" "no_exit"
curl -o /etc/yum.repos.d/powerdns-auth-43.repo https://cyberpanel.sh/repo.powerdns.com/repo-files/centos-auth-43.repo curl -o /etc/yum.repos.d/powerdns-auth-43.repo https://cyberpanel.sh/repo.powerdns.com/repo-files/centos-auth-43.repo
@@ -890,6 +889,25 @@ EOF
Check_Return "yum repo" "no_exit" Check_Return "yum repo" "no_exit"
fi fi
fi fi
if [[ $Server_OS = "openEuler" ]]; then
rpm --import https://cyberpanel.sh/rpms.litespeedtech.com/centos/RPM-GPG-KEY-litespeed
#import the LiteSpeed GPG key
yum clean all
sed -i "s|gpgcheck=1|gpgcheck=0|g" /etc/yum.repos.d/openEuler.repo
sed -i "s|repo.openeuler.org|mirror.efaith.com.hk/openeuler|g" /etc/yum.repos.d/openEuler.repo
if [[ "$Server_OS_Version" = "20" ]]; then
dnf install --nogpg -y https://repo.yaro.ee/yaro-release-20.03LTS-latest.oe1.noarch.rpm
Check_Return "yum repo" "no_exit"
fi
if [[ "$Server_OS_Version" = "22" ]]; then
dnf install --nogpg -y https://repo.yaro.ee/yaro-release-22.03LTS-latest.oe2203.noarch.rpm
Check_Return "yum repo" "no_exit"
fi
fi
Debug_Log2 "Setting up repositories...,1" Debug_Log2 "Setting up repositories...,1"
if [[ "$Server_Country" = "CN" ]] ; then if [[ "$Server_Country" = "CN" ]] ; then
@@ -977,7 +995,7 @@ Pre_Install_Required_Components() {
Debug_Log2 "Installing necessary components..,3" Debug_Log2 "Installing necessary components..,3"
if [[ "$Server_OS" = "CentOS" ]] ; then if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]] ; then
yum update -y yum update -y
if [[ "$Server_OS_Version" = "7" ]] ; then if [[ "$Server_OS_Version" = "7" ]] ; then
yum install -y wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel gpgme-devel curl-devel git socat openssl-devel MariaDB-shared mariadb-devel yum-utils python36u python36u-pip python36u-devel zip unzip bind-utils yum install -y wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel gpgme-devel curl-devel git socat openssl-devel MariaDB-shared mariadb-devel yum-utils python36u python36u-pip python36u-devel zip unzip bind-utils
@@ -989,6 +1007,11 @@ if [[ "$Server_OS" = "CentOS" ]] ; then
Check_Return Check_Return
dnf install -y gpgme-devel dnf install -y gpgme-devel
Check_Return Check_Return
elif [[ "$Server_OS_Version" = "20" ]] || [[ "$Server_OS_Version" = "22" ]] ; then
dnf install -y libnsl zip wget strace net-tools curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git python3-devel tar socat python3 zip unzip bind-utils
Check_Return
dnf install -y gpgme-devel
Check_Return
fi fi
ln -s /usr/bin/pip3 /usr/bin/pip ln -s /usr/bin/pip3 /usr/bin/pip
else else
@@ -1124,7 +1147,7 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
fi fi
if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then
if [[ $Server_OS = "CentOS" ]] ; then if [[ $Server_OS = "CentOS" ]] || [[ $Server_OS = "openEuler" ]] ; then
echo "echo 1000000 > /proc/sys/kernel/pid_max echo "echo 1000000 > /proc/sys/kernel/pid_max
echo 1 > /sys/kernel/mm/ksm/run" >>/etc/rc.d/rc.local echo 1 > /sys/kernel/mm/ksm/run" >>/etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local chmod +x /etc/rc.d/rc.local
@@ -1425,7 +1448,7 @@ fi
} }
Post_Install_Addon_Mecached_LSMCD() { Post_Install_Addon_Mecached_LSMCD() {
if [[ $Server_OS = "CentOS" ]]; then if [[ $Server_OS = "CentOS" ]] || [[ $Server_OS = "openEuler" ]]; then
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
wget -O lsmcd-master.zip https://cyberpanel.sh/codeload.github.com/litespeedtech/lsmcd/zip/master wget -O lsmcd-master.zip https://cyberpanel.sh/codeload.github.com/litespeedtech/lsmcd/zip/master
@@ -1479,6 +1502,18 @@ if [[ $Server_OS = "Ubuntu" ]]; then
systemctl start memcached systemctl start memcached
fi fi
fi fi
if [[ $Server_OS = "openEuler" ]]; then
#yum install -y lsphp??-memcached lsphp??-pecl-memcached
if [[ $Total_RAM -eq "2048" ]] || [[ $Total_RAM -gt "2048" ]]; then
Post_Install_Addon_Mecached_LSMCD
else
yum install -y memcached
sed -i 's|OPTIONS=""|OPTIONS="-l 127.0.0.1 -U 0"|g' /etc/sysconfig/memcached
#turn off UDP and bind to 127.0.0.1 only
systemctl enable memcached
systemctl start memcached
fi
fi
if pgrep "lsmcd" ; then if pgrep "lsmcd" ; then
echo -e "\n\nLiteSpeed Memcached installed and running..." echo -e "\n\nLiteSpeed Memcached installed and running..."
@@ -1522,6 +1557,10 @@ else
systemctl start redis systemctl start redis
fi fi
if [[ "$Server_OS" = "openEuler" ]]; then
#yum install -y lsphp??-redis redis
fi
if pgrep "redis" ; then if pgrep "redis" ; then
echo -e "\n\nRedis installed and running..." echo -e "\n\nRedis installed and running..."
touch /home/cyberpanel/redis touch /home/cyberpanel/redis
@@ -1559,7 +1598,7 @@ for PHP_Version in /usr/local/lsws/lsphp?? ;
do do
PHP_INI_Path=$(find "$PHP_Version" -name php.ini) PHP_INI_Path=$(find "$PHP_Version" -name php.ini)
if [[ "$Server_OS" = "CentOS" ]]; then if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]]; then
if [[ ! -d "${PHP_Version}/tmp" ]]; then if [[ ! -d "${PHP_Version}/tmp" ]]; then
mkdir "${PHP_Version}/tmp" mkdir "${PHP_Version}/tmp"
fi fi
@@ -1627,7 +1666,7 @@ if [[ "$Watchdog" = "On" ]]; then
nohup watchdog mariadb >/dev/null 2>&1 & nohup watchdog mariadb >/dev/null 2>&1 &
fi fi
if [[ "$Server_OS" = "CentOS" ]]; then if [[ "$Server_OS" = "CentOS" ]] || [[ "$Server_OS" = "openEuler" ]]; then
echo "nohup watchdog lsws > /dev/null 2>&1 & echo "nohup watchdog lsws > /dev/null 2>&1 &
nohup watchdog mariadb > /dev/null 2>&1 &" >>/etc/rc.d/rc.local nohup watchdog mariadb > /dev/null 2>&1 &" >>/etc/rc.d/rc.local
else else
@@ -1832,7 +1871,7 @@ rm -f /usr/bin/php
ln -s /usr/local/lsws/lsphp74/bin/php /usr/bin/php ln -s /usr/local/lsws/lsphp74/bin/php /usr/bin/php
if [[ "$Server_OS" = "CentOS" ]] ; then if [[ "$Server_OS" = "CentOS" ]] ; then
#all centos7/8 post change goes here #all centos 7/8 post change goes here
sed -i 's|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini sed -i 's|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini
#fix php.ini & issue #fix php.ini & issue
@@ -1871,10 +1910,8 @@ if [[ "$Server_OS" = "CentOS" ]] ; then
fi fi
elif [[ "$Server_OS" = "Ubuntu" ]] ; then elif [[ "$Server_OS" = "Ubuntu" ]] ; then
#all ubuntu18/20 post change goes here #all ubuntu 18/20 post change goes here
sed -i 's|/usr/local/lsws/bin/lswsctrl restart|systemctl restart lsws|g' /var/spool/cron/crontabs/root sed -i 's|/usr/local/lsws/bin/lswsctrl restart|systemctl restart lsws|g' /var/spool/cron/crontabs/root
if [[ ! -f /usr/sbin/ipset ]] ; then if [[ ! -f /usr/sbin/ipset ]] ; then
ln -s /sbin/ipset /usr/sbin/ipset ln -s /sbin/ipset /usr/sbin/ipset
fi fi
@@ -1889,9 +1926,12 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
: :
fi fi
elif [[ "$Server_OS" = "openEuler" ]] ; then
sed -i 's|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_STRICT|g' /usr/local/lsws/{lsphp72,lsphp73}/etc/php.ini
#fix php.ini & issue
sed -i 's|/usr/local/lsws/bin/lswsctrl restart|systemctl restart lsws|g' /var/spool/cron/root
fi fi
if [[ "$Server_Edition" = "OLS" ]]; then if [[ "$Server_Edition" = "OLS" ]]; then
Word="OpenLiteSpeed" Word="OpenLiteSpeed"
else else

View File

@@ -4,8 +4,8 @@
#set -x #set -x
#set -u #set -u
#CyberPanel installer script for CentOS 7.X, CentOS 8.X, CloudLinux 7.X, Ubuntu 18.04 and Ubuntu 20.04 #CyberPanel installer script for CentOS 7, CentOS 8, CloudLinux 7, AlmaLinux 8, RockyLinux 8, Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, openEuler 20.03 and openEuler 22.03
#For whoever may edit this script, please follow : #For whoever may edit this script, please follow:
#Please use Pre_Install_xxx() and Post_Install_xxx() if you want to something respectively before or after the panel installation #Please use Pre_Install_xxx() and Post_Install_xxx() if you want to something respectively before or after the panel installation
#and update below accordingly #and update below accordingly
#Please use variable/functions name as MySomething or My_Something, and please try not to use too-short abbreviation :) #Please use variable/functions name as MySomething or My_Something, and please try not to use too-short abbreviation :)
@@ -121,22 +121,24 @@ elif grep -q "AlmaLinux-8" /etc/os-release ; then
Server_OS="AlmaLinux" Server_OS="AlmaLinux"
elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10" /etc/os-release ; then elif grep -q -E "Ubuntu 18.04|Ubuntu 20.04|Ubuntu 20.10" /etc/os-release ; then
Server_OS="Ubuntu" Server_OS="Ubuntu"
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
Server_OS="openEuler"
else else
echo -e "Unable to detect your system..." echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, CloudLinux 7.x and AlmaLinux 8.x...\n" echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x... [404]" Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]"
exit exit
fi fi
Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d . ) Server_OS_Version=$(grep VERSION_ID /etc/os-release | awk -F[=,] '{print $2}' | tr -d \" | head -c2 | tr -d . )
#to make 20.04 display as 20 #to make 20.04 display as 20, etc.
echo -e "System: $Server_OS $Server_OS_Version detected...\n" echo -e "System: $Server_OS $Server_OS_Version detected...\n"
if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] ; then if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] ; then
Server_OS="CentOS" Server_OS="CentOS"
#CloudLinux gives version id like 7.8 , 7.9 , so cut it to show first number only #CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only
#treat CL and Alma as CentOS #treat CloudLinux, Rocky and Alma as CentOS
fi fi
if [[ "$Debug" = "On" ]] ; then if [[ "$Debug" = "On" ]] ; then
@@ -446,6 +448,18 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
fi fi
#all pre-upgrade operation for Ubuntu 20 #all pre-upgrade operation for Ubuntu 20
fi fi
if [[ "$Server_OS" = "openEuler" ]] ; then
rm -f /etc/yum.repos.d/CyberPanel.repo
rm -f /etc/yum.repos.d/litespeed.repo
yum clean all
yum update -y
dnf install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc libattr-devel xz-devel mariadb-devel curl-devel git python3-devel tar socat bind-utils
dnf install gpgme-devel -y
dnf install python3 -y
fi
#all pre-upgrade operation for openEuler
} }
Download_Requirement() { Download_Requirement() {
@@ -506,6 +520,11 @@ elif [[ "$Server_OS" = "Ubuntu" ]] ; then
Check_Return Check_Return
pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments.txt pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments.txt
Check_Return Check_Return
elif [[ "$Server_OS" = "openEuler" ]] ; then
pip3 install --default-timeout=3600 virtualenv==16.7.9
Check_Return
pip3 install --default-timeout=3600 --ignore-installed -r /usr/local/requirments.txt
Check_Return
fi fi
#virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel #virtualenv -p /usr/bin/python3 --system-site-packages /usr/local/CyberPanel

View File

@@ -23,10 +23,12 @@ check_OS() {
Server_OS="Ubuntu" Server_OS="Ubuntu"
elif grep -q -E "Rocky Linux" /etc/os-release ; then elif grep -q -E "Rocky Linux" /etc/os-release ; then
Server_OS="RockyLinux" Server_OS="RockyLinux"
elif grep -q -E "openEuler 20.03|openEuler 22.03" /etc/os-release ; then
Server_OS="openEuler"
else else
echo -e "Unable to detect your system..." echo -e "Unable to detect your system..."
echo -e "\nCyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x...\n" echo -e "\nCyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03...\n"
Debug_Log2 "CyberPanel is supported on Ubuntu 18.04 x86_64, Ubuntu 20.04 x86_64, Ubuntu 20.10 x86_64, CentOS 7.x, CentOS 8.x, AlmaLinux 8.x, RockyLinux 8.x, CloudLinux 7.x, CloudLinux 8.x... [404]" Debug_Log2 "CyberPanel is supported on x86_64 based Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 22.04, CentOS 7, CentOS 8, AlmaLinux 8, RockyLinux 8, CloudLinux 7, CloudLinux 8, openEuler 20.03, openEuler 22.03... [404]"
exit exit
fi fi
@@ -37,8 +39,8 @@ check_OS() {
if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then if [[ $Server_OS = "CloudLinux" ]] || [[ "$Server_OS" = "AlmaLinux" ]] || [[ "$Server_OS" = "RockyLinux" ]] ; then
Server_OS="CentOS" Server_OS="CentOS"
#CloudLinux gives version id like 7.8 , 7.9 , so cut it to show first number only #CloudLinux gives version id like 7.8, 7.9, so cut it to show first number only
#treat CL , Rocky and Alma as CentOS #treat CloudLinux, Rocky and Alma as CentOS
fi fi
} }
@@ -212,7 +214,7 @@ phpmyadmin_limits() {
read TMP_YN read TMP_YN
if [[ $TMP_YN == "Y" ]] || [[ $TMP_YN == "y" ]] ; then if [[ $TMP_YN == "Y" ]] || [[ $TMP_YN == "y" ]] ; then
if [[ "$SERVER_OS" == "CentOS" ]] ; then if [[ "$SERVER_OS" == "CentOS" ]] || [[ "$SERVER_OS" == "openEuler" ]] ; then
php_ini_path="/usr/local/lsws/lsphp73/etc/php.ini" php_ini_path="/usr/local/lsws/lsphp73/etc/php.ini"
fi fi
@@ -238,6 +240,9 @@ install_php_redis() {
if [[ $SERVER_OS == "Ubuntu" ]] ; then if [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis
fi fi
if [[ $SERVER_OS == "openEuler" ]] ; then
#dnf install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis
fi
echo -e "\nRedis extension for PHP has been installed..." echo -e "\nRedis extension for PHP has been installed..."
exit exit
} }
@@ -252,6 +257,9 @@ install_redis() {
if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install -y redis DEBIAN_FRONTEND=noninteractive apt install -y redis
fi fi
if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "openEuler" ]] ; then
yum install -y redis
fi
if ifconfig -a | grep inet6 ; then if ifconfig -a | grep inet6 ; then
echo -e "\n IPv6 detected..." echo -e "\n IPv6 detected..."
else else
@@ -288,7 +296,7 @@ read TMP_YN
if [[ -f /usr/local/lsmcd/bin/lsmcd ]] ; then if [[ -f /usr/local/lsmcd/bin/lsmcd ]] ; then
echo -e "\nLiteSpeed Memcached is already installed..." echo -e "\nLiteSpeed Memcached is already installed..."
else else
if [[ $SERVER_OS == "CentOS" ]] ; then if [[ $SERVER_OS == "CentOS" ]] || [[ $SERVER_OS == "openEuler" ]] ; then
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
elif [[ $SERVER_OS == "Ubuntu" ]] ; then elif [[ $SERVER_OS == "Ubuntu" ]] ; then
@@ -329,6 +337,11 @@ read TMP_YN
if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install memcached -y DEBIAN_FRONTEND=noninteractive apt install memcached -y
fi fi
if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "openEuler" ]] ; then
yum install memcached -y
sed -i 's|OPTIONS=""|OPTIONS="-l 127.0.0.1 -U 0"|g' /etc/sysconfig/memcached
#this will disbale UDP and bind to 127.0.0.1 to prevent UDP amplification attack
fi
if systemctl is-active --quiet memcached ; then if systemctl is-active --quiet memcached ; then
systemctl status memcached systemctl status memcached
else else
@@ -351,6 +364,9 @@ install_php_memcached() {
if [[ $SERVER_OS == "Ubuntu" ]] ; then if [[ $SERVER_OS == "Ubuntu" ]] ; then
DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached
fi fi
if [[ $SERVER_OS == "openEuler" ]] ; then
#yum install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached
fi
echo -e "\nMemcached extension for PHP has been installed..." echo -e "\nMemcached extension for PHP has been installed..."
exit exit
} }

2
faq.sh
View File

@@ -52,7 +52,7 @@ ${BLUE}------------------------------------------------------------${NC}
${PURPLE}6.${NC} How to raise upload limit for cyberpanel's phpMyAdmin and File Manager? ${PURPLE}6.${NC} How to raise upload limit for cyberpanel's phpMyAdmin and File Manager?
edit file ${RED}/usr/local/lsws/lsphp73/etc/php.ini${NC} for CentOS edit file ${RED}/usr/local/lsws/lsphp73/etc/php.ini${NC} for CentOS or openEuler
${RED}/usr/local/lsws/lsphp73/etc/php/7.3/litespeed/php.ini${NC} for Ubbuntu ${RED}/usr/local/lsws/lsphp73/etc/php/7.3/litespeed/php.ini${NC} for Ubbuntu

View File

@@ -22,6 +22,16 @@ apt install -y -qq wget curl
elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then elif echo $OUTPUT | grep -q "Ubuntu 20.04" ; then
apt install -y -qq wget curl apt install -y -qq wget curl
SERVER_OS="Ubuntu" SERVER_OS="Ubuntu"
elif echo $OUTPUT | grep -q "openEuler 20.03" ; then
echo -e "\nDetecting openEuler 20.03...\n"
SERVER_OS="openEuler"
yum install curl wget -y 1> /dev/null
yum update curl wget ca-certificates -y 1> /dev/null
elif echo $OUTPUT | grep -q "openEuler 22.03" ; then
echo -e "\nDetecting openEuler 22.03...\n"
SERVER_OS="openEuler"
yum install curl wget -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"

View File

@@ -33,6 +33,7 @@ def generate_pass(length=14):
centos = 0 centos = 0
ubuntu = 1 ubuntu = 1
cent8 = 2 cent8 = 2
openeuler = 3
def get_distro(): def get_distro():
@@ -45,8 +46,8 @@ def get_distro():
if line == "DISTRIB_ID=Ubuntu\n": if line == "DISTRIB_ID=Ubuntu\n":
distro = ubuntu distro = ubuntu
elif exists("/etc/os-release"): elif exists("/etc/redhat-release"):
distro_file = "/etc/os-release" distro_file = "/etc/redhat-release"
distro = centos distro = centos
data = open('/etc/redhat-release', 'r').read() data = open('/etc/redhat-release', 'r').read()
@@ -57,6 +58,10 @@ def get_distro():
return cent8 return cent8
if data.find('Rocky Linux release 8') > -1 or data.find('Rocky Linux 8') > -1 or data.find('rocky:8') > -1: if data.find('Rocky Linux release 8') > -1 or data.find('Rocky Linux 8') > -1 or data.find('rocky:8') > -1:
return cent8 return cent8
elif exists("/etc/openEuler-release"):
distro_file = "/etc/openEuler-release"
distro = openeuler
else: else:
logging.InstallLog.writeToFile("Can't find linux release file - fatal error") logging.InstallLog.writeToFile("Can't find linux release file - fatal error")
@@ -268,7 +273,7 @@ class preFlightsChecks:
def setup_account_cyberpanel(self): def setup_account_cyberpanel(self):
try: try:
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = "yum install sudo -y" command = "yum install sudo -y"
preFlightsChecks.call(command, self.distro, command, preFlightsChecks.call(command, self.distro, command,
command, command,
@@ -359,7 +364,7 @@ class preFlightsChecks:
def install_psmisc(self): def install_psmisc(self):
self.stdOut("Install psmisc") self.stdOut("Install psmisc")
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = "yum -y install psmisc" command = "yum -y install psmisc"
else: else:
command = "apt-get -y install psmisc" command = "apt-get -y install psmisc"
@@ -642,7 +647,7 @@ password="%s"
command = "find /usr/local/CyberCP/ -name '*.pyc' -delete" command = "find /usr/local/CyberCP/ -name '*.pyc' -delete"
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == cent8 or self.distro == centos: if self.distro == cent8 or self.distro == centos or self.distro == openeuler:
command = 'chown root:pdns /etc/pdns/pdns.conf' command = 'chown root:pdns /etc/pdns/pdns.conf'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@@ -691,7 +696,7 @@ password="%s"
def install_unzip(self): def install_unzip(self):
self.stdOut("Install unzip") self.stdOut("Install unzip")
try: try:
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum -y install unzip' command = 'yum -y install unzip'
else: else:
command = 'apt-get -y install unzip' command = 'apt-get -y install unzip'
@@ -703,7 +708,7 @@ password="%s"
def install_zip(self): def install_zip(self):
self.stdOut("Install zip") self.stdOut("Install zip")
try: try:
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum -y install zip' command = 'yum -y install zip'
else: else:
command = 'apt-get -y install zip' command = 'apt-get -y install zip'
@@ -813,12 +818,14 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre' command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
elif self.distro == cent8: elif self.distro == cent8:
command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm' command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql -y' command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
elif self.distro == openeuler:
command = 'dnf install postfix -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else: else:
command = 'apt-get -y install debconf-utils' command = 'apt-get -y install debconf-utils'
@@ -842,6 +849,8 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
command = 'yum --enablerepo=gf-plus -y install dovecot23 dovecot23-mysql' command = 'yum --enablerepo=gf-plus -y install dovecot23 dovecot23-mysql'
elif self.distro == cent8: elif self.distro == cent8:
command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y' command = 'dnf install --enablerepo=gf-plus dovecot23 dovecot23-mysql -y'
elif self.distro == openeuler:
command = 'dnf install dovecot -y'
else: else:
command = 'apt-get -y install dovecot-mysql dovecot-imapd dovecot-pop3d' command = 'apt-get -y install dovecot-mysql dovecot-imapd dovecot-pop3d'
@@ -1464,14 +1473,14 @@ autocreate_system_folders = On
except: except:
pass pass
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'adduser lscpd -M -d /usr/local/lscp' command = 'adduser lscpd -M -d /usr/local/lscp'
else: else:
command = 'useradd lscpd -M -d /usr/local/lscp' command = 'useradd lscpd -M -d /usr/local/lscp'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'groupadd lscpd' command = 'groupadd lscpd'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
# Added group in useradd for Ubuntu # Added group in useradd for Ubuntu
@@ -1691,21 +1700,21 @@ autocreate_system_folders = On
try: try:
## first install crontab ## first install crontab
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum install cronie -y' command = 'yum install cronie -y'
else: else:
command = 'apt-get -y install cron' command = 'apt-get -y install cron'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl enable crond' command = 'systemctl enable crond'
else: else:
command = 'systemctl enable cron' command = 'systemctl enable cron'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl start crond' command = 'systemctl start crond'
else: else:
command = 'systemctl start cron' command = 'systemctl start cron'
@@ -1715,8 +1724,9 @@ autocreate_system_folders = On
## ##
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath): if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
cronPath = '/var/spool/cron/root' cronPath = '/var/spool/cron/root'
else: else:
cronPath = '/var/spool/cron/crontabs/root' cronPath = '/var/spool/cron/crontabs/root'
@@ -1754,11 +1764,11 @@ autocreate_system_folders = On
writeToFile.close() writeToFile.close()
if not os.path.exists(CentOSPath): if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'chmod 600 %s' % (cronPath) command = 'chmod 600 %s' % (cronPath)
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl restart crond.service' command = 'systemctl restart crond.service'
else: else:
command = 'systemctl restart cron.service' command = 'systemctl restart cron.service'
@@ -1785,7 +1795,7 @@ autocreate_system_folders = On
def install_rsync(self): def install_rsync(self):
try: try:
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
command = 'yum -y install rsync' command = 'yum -y install rsync'
else: else:
command = 'apt-get -y install rsync' command = 'apt-get -y install rsync'
@@ -1843,14 +1853,14 @@ autocreate_system_folders = On
try: try:
if self.distro == centos: if self.distro == centos:
command = 'yum -y install opendkim' command = 'yum -y install opendkim'
elif self.distro == cent8: elif self.distro == cent8 or self.distro == openeuler:
command = 'dnf install opendkim -y' command = 'dnf install opendkim -y'
else: else:
command = 'apt-get -y install opendkim' command = 'apt-get -y install opendkim'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if self.distro == cent8: if self.distro == cent8 or self.distro == openeuler:
command = 'dnf install opendkim-tools -y' command = 'dnf install opendkim-tools -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
@@ -2086,12 +2096,15 @@ milter_default_action = accept
try: try:
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
if self.distro == centos:
command = 'yum install -y yum-plugin-copr'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum copr enable -y copart/restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
if os.path.exists(CentOSPath):
command = 'yum install -y yum-plugin-copr'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum copr enable -y copart/restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'yum install -y restic' command = 'yum install -y restic'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'restic self-update' command = 'restic self-update'
@@ -2114,8 +2127,9 @@ milter_default_action = accept
try: try:
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath): if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
command = 'mkdir -p /opt/cpvendor/etc/' command = 'mkdir -p /opt/cpvendor/etc/'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)

View File

@@ -14,6 +14,7 @@ import time
centos = 0 centos = 0
ubuntu = 1 ubuntu = 1
cent8 = 2 cent8 = 2
openeuler = 3
def get_Ubuntu_release(): def get_Ubuntu_release():
@@ -71,7 +72,7 @@ class InstallCyberPanel:
command = 'yum install -y openlitespeed' command = 'yum install -y openlitespeed'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else: else:
command = 'yum install -y openlitespeed' command = 'dnf install -y openlitespeed'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else: else:
@@ -250,6 +251,10 @@ class InstallCyberPanel:
if self.distro == cent8: if self.distro == cent8:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* --exclude lsphp73-pecl-zip --exclude *imagick* -y' command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* --exclude lsphp73-pecl-zip --exclude *imagick* -y'
subprocess.call(command, shell=True) subprocess.call(command, shell=True)
if self.distro == openeuler:
command = 'dnf install lsphp71* lsphp72* lsphp73* lsphp74* lsphp80* -y'
subprocess.call(command, shell=True)
def installMySQL(self, mysql): def installMySQL(self, mysql):
@@ -272,7 +277,7 @@ class InstallCyberPanel:
command = "apt-get -y install mariadb-server" command = "apt-get -y install mariadb-server"
elif self.distro == centos: elif self.distro == centos:
command = 'yum --enablerepo=mariadb -y install MariaDB-server MariaDB-client' command = 'yum --enablerepo=mariadb -y install MariaDB-server MariaDB-client'
elif self.distro == cent8: elif self.distro == cent8 or self.distro == openeuler:
command = 'dnf -y install mariadb-server' command = 'dnf -y install mariadb-server'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
@@ -369,7 +374,7 @@ class InstallCyberPanel:
elif self.distro == centos: elif self.distro == centos:
command = "yum install -y pure-ftpd" command = "yum install -y pure-ftpd"
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
elif self.distro == cent8: elif self.distro == cent8 or self.distro == openeuler:
command = 'dnf install pure-ftpd -y' command = 'dnf install pure-ftpd -y'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR) install.preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
@@ -405,7 +410,7 @@ class InstallCyberPanel:
except: except:
logging.InstallLog.writeToFile("[ERROR] Could not create directory for FTP SSL") logging.InstallLog.writeToFile("[ERROR] Could not create directory for FTP SSL")
if (self.distro == centos or self.distro == cent8) or ( if (self.distro == centos or self.distro == cent8 or self.distro == openeuler) or (
self.distro == ubuntu and get_Ubuntu_release() == 18.14): self.distro == ubuntu and get_Ubuntu_release() == 18.14):
command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem' command = 'openssl req -newkey rsa:1024 -new -nodes -x509 -days 3650 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem'
else: else:
@@ -502,7 +507,7 @@ class InstallCyberPanel:
def installPowerDNS(self): def installPowerDNS(self):
try: try:
if self.distro == ubuntu or self.distro == cent8: if self.distro == ubuntu or self.distro == cent8 or self.distro == openeuler:
command = 'systemctl stop systemd-resolved' command = 'systemctl stop systemd-resolved'
install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) install.preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'systemctl disable systemd-resolved.service' command = 'systemctl disable systemd-resolved.service'
@@ -555,7 +560,7 @@ class InstallCyberPanel:
InstallCyberPanel.stdOut("Configuring PowerDNS..", 1) InstallCyberPanel.stdOut("Configuring PowerDNS..", 1)
os.chdir(self.cwd) os.chdir(self.cwd)
if self.distro == centos or self.distro == cent8: if self.distro == centos or self.distro == cent8 or self.distro == openeuler:
dnsPath = "/etc/pdns/pdns.conf" dnsPath = "/etc/pdns/pdns.conf"
else: else:
dnsPath = "/etc/powerdns/pdns.conf" dnsPath = "/etc/powerdns/pdns.conf"

View File

@@ -25,6 +25,8 @@ Ubuntu18 = 2
Ubuntu20 = 3 Ubuntu20 = 3
CloudLinux7 = 4 CloudLinux7 = 4
CloudLinux8 = 5 CloudLinux8 = 5
openEuler20 = 6
openEuler22 = 7
class Upgrade: class Upgrade:
@@ -33,6 +35,7 @@ class Upgrade:
installedOutput = '' installedOutput = ''
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
UbuntuPath = '/etc/lsb-release' UbuntuPath = '/etc/lsb-release'
openEulerPath = '/etc/openEuler-release'
FromCloud = 0 FromCloud = 0
SnappyVersion = '2.15.3' SnappyVersion = '2.15.3'
@@ -81,6 +84,15 @@ class Upgrade:
return CENTOS8 return CENTOS8
else: else:
return CENTOS7 return CENTOS7
elif os.path.exists(Upgrade.openEulerPath):
result = open(Upgrade.openEulerPath, 'r').read()
if result.find('20.03') > -1:
return openEuler20
elif result.find('22.03') > -1:
return openEuler22
else: else:
result = open(Upgrade.UbuntuPath, 'r').read() result = open(Upgrade.UbuntuPath, 'r').read()
@@ -89,7 +101,6 @@ class Upgrade:
else: else:
return Ubuntu18 return Ubuntu18
@staticmethod @staticmethod
def stdOut(message, do_exit=0): def stdOut(message, do_exit=0):
print("\n\n") print("\n\n")
@@ -2152,7 +2163,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = "find /usr/local/CyberCP/ -name '*.pyc' -delete" command = "find /usr/local/CyberCP/ -name '*.pyc' -delete"
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
if os.path.exists(Upgrade.CentOSPath): if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath):
command = 'chown root:pdns /etc/pdns/pdns.conf' command = 'chown root:pdns /etc/pdns/pdns.conf'
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
@@ -2180,8 +2191,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
### ###
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if not os.path.exists(CentOSPath): if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
group = 'nobody' group = 'nobody'
else: else:
group = 'nogroup' group = 'nogroup'
@@ -2262,8 +2274,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
os.system(command) os.system(command)
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if not os.path.exists(CentOSPath): if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/' command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/'
Upgrade.executioner(command, 'Set default PHP 7.0, 0') Upgrade.executioner(command, 'Set default PHP 7.0, 0')
@@ -2280,6 +2293,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
try: try:
Upgrade.stdOut("Upgrading Dovecot..") Upgrade.stdOut("Upgrading Dovecot..")
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
dovecotConfPath = '/etc/dovecot/' dovecotConfPath = '/etc/dovecot/'
postfixConfPath = '/etc/postfix/' postfixConfPath = '/etc/postfix/'
@@ -2297,7 +2311,7 @@ echo $oConfig->Save() ? 'Done' : 'Error';
command = 'cp -pR %s %s' % (postfixConfPath, configbackups) command = 'cp -pR %s %s' % (postfixConfPath, configbackups)
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
if Upgrade.FindOperatingSytem() == CENTOS8 or Upgrade.FindOperatingSytem() == CENTOS7: if Upgrade.FindOperatingSytem() == CENTOS8 or Upgrade.FindOperatingSytem() == CENTOS7 or Upgrade.FindOperatingSytem() == openEuler22 or Upgrade.FindOperatingSytem() == openEuler20:
command = "yum makecache -y" command = "yum makecache -y"
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
@@ -2419,8 +2433,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
@staticmethod @staticmethod
def installRestic(): def installRestic():
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath): if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
if Upgrade.installedOutput.find('restic') == -1: if Upgrade.installedOutput.find('restic') == -1:
command = 'yum install restic -y' command = 'yum install restic -y'
Upgrade.executioner(command, 'Install Restic') Upgrade.executioner(command, 'Install Restic')
@@ -2451,8 +2466,9 @@ echo $oConfig->Save() ? 'Done' : 'Error';
try: try:
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath): if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
command = 'mkdir -p /opt/cpvendor/etc/' command = 'mkdir -p /opt/cpvendor/etc/'
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
@@ -2517,8 +2533,9 @@ vmail
# Install findBWUsage cron if missing # Install findBWUsage cron if missing
CentOSPath = '/etc/redhat-release' CentOSPath = '/etc/redhat-release'
openEulerPath = '/etc/openEuler-release'
if os.path.exists(CentOSPath): if os.path.exists(CentOSPath) or os.path.exists(openEulerPath):
cronPath = '/var/spool/cron/root' cronPath = '/var/spool/cron/root'
else: else:
cronPath = '/var/spool/cron/crontabs/root' cronPath = '/var/spool/cron/crontabs/root'
@@ -2581,7 +2598,7 @@ vmail
writeToFile.close() writeToFile.close()
if not os.path.exists(CentOSPath): if not os.path.exists(CentOSPath) or not os.path.exists(openEulerPath):
command = 'chmod 600 %s' % (cronPath) command = 'chmod 600 %s' % (cronPath)
Upgrade.executioner(command, 0) Upgrade.executioner(command, 0)
@@ -2615,7 +2632,7 @@ vmail
# Upgrade.stdOut("Upgrades are currently disabled") # Upgrade.stdOut("Upgrades are currently disabled")
# return 0 # return 0
if os.path.exists(Upgrade.CentOSPath): if os.path.exists(Upgrade.CentOSPath) or os.path.exists(Upgrade.openEulerPath):
command = 'yum list installed' command = 'yum list installed'
Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode() Upgrade.installedOutput = subprocess.check_output(shlex.split(command)).decode()
else: else: