From 2302fcbe89e831b7df7e9d3671dde9239d23a345 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Thu, 12 Dec 2019 14:26:54 +0500 Subject: [PATCH] update cyberpane.sh --- cyberpanel.sh | 343 +++++++++++++++++++++++++++++++++++---------- install/install.py | 3 + 2 files changed, 273 insertions(+), 73 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index d7d2ef9cf..6c2678e0f 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -1,7 +1,8 @@ #!/bin/bash #CyberPanel installer script for Ubuntu 18.04 and CentOS 7.X - +DEV="OFF" +BRANCH="stable" POSTFIX_VARIABLE="ON" POWERDNS_VARIABLE="ON" PUREFTPD_VARIABLE="ON" @@ -20,6 +21,49 @@ MEMCACHED="ON" REDIS="ON" TOTAL_RAM=$(free -m | awk '/Mem\:/ { print $2 }') +license_validation() { +CURRENT_DIR=$(pwd) + +if [ -f /root/cyberpanel-tmp ] ; then +rm -rf /root/cyberpanel-tmp +fi + +mkdir /root/cyberpanel-tmp +cd /root/cyberpanel-tmp +wget -q https://$DOWNLOAD_SERVER/litespeed/lsws-$LSWS_STABLE_VER-ent-x86_64-linux.tar.gz +tar xzvf lsws-$LSWS_STABLE_VER-ent-x86_64-linux.tar.gz > /dev/null +cd /root/cyberpanel-tmp/lsws-$LSWS_STABLE_VER/conf +if [[ $LICENSE_KEY == "TRIAL" ]] ; then +wget -q http://license.litespeedtech.com/reseller/trial.key +sed -i "s|writeSerial = open('lsws-5.4.2/serial.no', 'w')|command = 'wget -q --output-document=./lsws-$LSWS_STABLE_VER/trial.key http://license.litespeedtech.com/reseller/trial.key'|g" $CURRENT_DIR/installCyberPanel.py +sed -i 's|writeSerial.writelines(self.serial)|subprocess.call(command, shell=True)|g' $CURRENT_DIR/installCyberPanel.py +sed -i 's|writeSerial.close()||g' $CURRENT_DIR/installCyberPanel.py +else +echo $LICENSE_KEY > serial.no +fi + +cd /root/cyberpanel-tmp/lsws-$LSWS_STABLE_VER/bin + +if [[ $LICENSE_KEY == "TRIAL" ]] ; then + if ./lshttpd -V |& grep "ERROR" ; then + echo -e "\n\nIt apeears to have some issue with license , please check above result..." + exit + fi + LICENSE_KEY="1111-2222-3333-4444" +else + if ./lshttpd -r |& grep "ERROR" ; then + ./lshttpd -r + echo -e "\n\nIt apeears to have some issue with license , please check above result..." + exit + fi +fi +echo -e "License seems valid..." +cd /root/cyberpanel-tmp +rm -rf lsws-$LSWS_STABLE_VER* +cd $CURRENT_DIR +rm -rf /root/cyberpanel-tmp +} + special_change(){ sed -i 's|cyberpanel.sh|'$DOWNLOAD_SERVER'|g' install.py sed -i 's|mirror.cyberpanel.net|'$DOWNLOAD_SERVER'|g' install.py @@ -27,6 +71,12 @@ sed -i 's|git clone https://github.com/usmannasir/cyberpanel|echo downloaded|g' #change to CDN first, regardless country sed -i 's|http://|https://|g' install.py +LATEST_URL="https://update.litespeedtech.com/ws/latest.php" +#LATEST_URL="https://cyberpanel.sh/latest.php" +curl --silent -o /tmp/lsws_latest $LATEST_URL 2>/dev/null +LSWS_STABLE_LINE=`cat /tmp/lsws_latest | grep LSWS_STABLE` +LSWS_STABLE_VER=`expr "$LSWS_STABLE_LINE" : '.*LSWS_STABLE=\(.*\) BUILD .*'` + if [[ $SERVER_COUNTRY == "CN" ]] ; then #line1="$(grep -n "github.com/usmannasir/cyberpanel" install.py | head -n 1 | cut -d: -f1)" #line2=$((line1 - 1)) @@ -37,15 +87,18 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then sed -i 's|wget https://rpms.litespeedtech.com/debian/|wget --no-check-certificate https://rpms.litespeedtech.com/debian/|g' install.py sed -i 's|https://repo.powerdns.com/repo-files/centos-auth-42.repo|https://'$DOWNLOAD_SERVER'/powerdns/powerdns.repo|g' installCyberPanel.py sed -i 's|https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip|https://'$DOWNLOAD_SERVER'/misc/rainloop-community-latest.zip|g' install.py -sed -i 's|cmd.append("rpm")|command = '"'"'curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo'"'"'|g' install.py -sed -i 's|cmd.append("-ivh")|cmd = shlex.split(command)|g' install.py -sed -i 's|cmd.append("https://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm")||g' install.py + +sed -i 's|rpm -ivh https://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo|g' install.py + + +sed -i 's|https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo|https://'$DOWNLOAD_SERVER'/restic/restic.repo|g' install.py + sed -i 's|yum -y install https://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm|wget -O /etc/yum.repos.d/gf.repo https://'$DOWNLOAD_SERVER'/gf-plus/gf.repo|g' install.py sed -i 's|dovecot-2.3-latest|dovecot-2.3-latest-mirror|g' install.py sed -i 's|git clone https://github.com/usmannasir/cyberpanel|wget https://cyberpanel.sh/cyberpanel-git.tar.gz \&\& tar xzvf cyberpanel-git.tar.gz|g' install.py sed -i 's|https://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch|https://'$DOWNLOAD_SERVER'/dovecot/|g' install.py sed -i 's|'$DOWNLOAD_SERVER'|cyberpanel.sh|g' install.py - +sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.4.2-ent-x86_64-linux.tar.gz|https://'$DOWNLOAD_SERVER'/litespeed/lsws-'$LSWS_STABLE_VER'-ent-x86_64-linux.tar.gz|g' installCyberPanel.py # global change for CN , regardless provider and system if [[ $SERVER_OS == "CentOS" ]] ; then @@ -62,7 +115,7 @@ gpgcheck = 1" > MariaDB.repo mkdir /root/.pip cat << EOF > /root/.pip/pip.conf [global] -index-url = https://mirrors.aliyun.com/pypi/simple/ +index-url = https://mirrors.aliyun.com/pypi/simple/ EOF echo -e "\nSet to Aliyun pip repo..." cat << EOF > composer.sh @@ -94,7 +147,7 @@ echo '{ "repositories": { "packagist": { "type": "composer", - "url": "https://packagist.phpcomposer.com" + "url": "https://mirrors.aliyun.com/composer/" } } } @@ -110,7 +163,7 @@ EOF pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ cat << EOF > /root/.pip/pip.conf [global] -index-url = https://mirrors.aliyun.com/pypi/simple/ +index-url = https://mirrors.aliyun.com/pypi/simple/ EOF echo -e "\nSet to Aliyun pip repo..." if [[ $PROVIDER == "Tencent Cloud" ]] ; then @@ -246,18 +299,23 @@ TOTAL_SWAP=$(free -m | awk '/^Swap:/ { print $2 }') SET_SWAP=$((TOTAL_RAM - TOTAL_SWAP)) SWAP_FILE=/cyberpanel.swap -if [[ ! -f $SWAP_FILE ]] ; then +if [ ! -f $SWAP_FILE ] ; then if [[ $TOTAL_SWAP -gt $TOTAL_RAM ]] || [[ $TOTAL_SWAP -eq $TOTAL_RAM ]] ; then echo "SWAP check..." else - fallocate --length ${SET_SWAP}MiB $SWAP_FILE - chmod 600 $SWAP_FILE - mkswap $SWAP_FILE - swapon $SWAP_FILE - echo "${SWAP_FILE} swap swap sw 0 0" | sudo tee -a /etc/fstab - sysctl vm.swappiness=10 - echo "vm.swappiness = 10" >> /etc/sysctl.conf - echo "SWAP set..." + if [[ $SET_SWAP -gt "2049" ]] ; then + SET_SWAP="2048" + else + echo "Checking SWAP..." + fi + fallocate --length ${SET_SWAP}MiB $SWAP_FILE + chmod 600 $SWAP_FILE + mkswap $SWAP_FILE + swapon $SWAP_FILE + echo "${SWAP_FILE} swap swap sw 0 0" | sudo tee -a /etc/fstab + sysctl vm.swappiness=10 + echo "vm.swappiness = 10" >> /etc/sysctl.conf + echo "SWAP set..." fi fi } @@ -272,39 +330,54 @@ if [[ $SERVER_OS == "CentOS" ]] ; then rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 rpm --import https://$DOWNLOAD_SERVER/gf-plus/RPM-GPG-KEY-gf.el7 rpm --import https://repo.dovecot.org/DOVECOT-REPO-GPG + rpm --import https://copr-be.cloud.fedoraproject.org/results/copart/restic/pubkey.gpg yum autoremove epel-release -y rm -f /etc/yum.repos.d/epel.repo rm -f /etc/yum.repos.d/epel.repo.rpmsave yum clean all yum update -y yum install epel-release -y - yum install -y wget htop telnet curl which bc telnet htop libevent-devel gcc python-devel libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel python-pip git + yum install -y wget strace htop net-tools telnet curl which bc telnet htop libevent-devel gcc python-devel libattr-devel xz-devel gpgme-devel mariadb-devel curl-devel python-pip git + if [[ $DEV == "ON" ]] ; then + yum -y install yum-utils + yum -y groupinstall development + yum -y install https://centos7.iuscommunity.org/ius-release.rpm + yum -y install python36u python36u-pip python36u-devel + fi fi if [[ $SERVER_OS == "Ubuntu" ]] ; then apt update -y DEBIAN_FRONTEND=noninteractive apt upgrade -y DEBIAN_FRONTEND=noninteracitve apt install -y htop telnet python-mysqldb python-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev libattr1 libattr1-dev liblzma-dev libgpgme-dev libmariadbclient-dev libcurl4-gnutls-dev libssl-dev nghttp2 libnghttp2-dev idn2 libidn2-dev libidn2-0-dev librtmp-dev libpsl-dev nettle-dev libgnutls28-dev libldap2-dev libgssapi-krb5-2 libk5crypto3 libkrb5-dev libcomerr2 libldap2-dev python-gpg python python-minimal python-setuptools virtualenv python-dev python-pip git + if [[ $DEV == "ON" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y python3-pip + DEBIAN_FRONTEND=noninteractive apt install -y build-essential libssl-dev libffi-dev python3-dev + DEBIAN_FRONTEND=noninteractive apt install -y python3-venv + fi fi } memcached_installation() { if [[ $SERVER_OS == "CentOS" ]] ; then - yum install -y lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached lsphp56-pecl-memcached lsphp55-pecl-memcached lsphp54-pecl-memcached + yum install -y lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached lsphp56-pecl-memcached lsphp55-pecl-memcached lsphp54-pecl-memcached if [[ $TOTAL_RAM -eq "2048" ]] || [[ $TOTAL_RAM -gt "2048" ]] ; then yum groupinstall "Development Tools" -y yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y wget https://$DOWNLOAD_SERVER/litespeed/lsmcd.tar.gz tar xzvf lsmcd.tar.gz - cd lsmcd + DIR=$(pwd) + cd $DIR/lsmcd ./fixtimestamp.sh ./configure CFLAGS=" -O3" CXXFLAGS=" -O3" make make install systemctl enable lsmcd systemctl start lsmcd + cd $DIR else yum install -y memcached + sed -i 's|OPTIONS=""|OPTIONS="-l 127.0.0.1 -U 0"|g' /etc/sysconfig/memcached systemctl enable memcached systemctl start memcached fi @@ -371,23 +444,30 @@ if ps -aux | grep "redis" | grep -v grep ; then fi } -check_provider() -{ -if [ "$(cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" = 'EC2' ] && [ -d /home/ubuntu ]; then - PROVIDER='Amazon Web Service' -elif [ "$(dmidecode -s bios-vendor)" = 'Google' ];then - PROVIDER='Google Cloud Platform' -elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ];then - PROVIDER='Digital Ocean' -elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ];then - PROVIDER='Alibaba Cloud' -elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ];then - PROVIDER='Microsoft Azure' -elif [[ -d /usr/local/qcloud ]]; then - PROVIDER='Tencent Cloud' +check_provider() { + +if hash dmidecode > /dev/null 2>&1 ; then + if [ "$(dmidecode -s bios-vendor)" = 'Google' ] ; then + PROVIDER='Google Cloud Platform' + elif [ "$(dmidecode -s bios-vendor)" = 'DigitalOcean' ] ; then + PROVIDER='Digital Ocean' + elif [ "$(dmidecode -s system-product-name | cut -c 1-7)" = 'Alibaba' ] ; then + PROVIDER='Alibaba Cloud' + elif [ "$(dmidecode -s system-manufacturer)" = 'Microsoft Corporation' ] ; then + PROVIDER='Microsoft Azure' + elif [ -d /usr/local/qcloud ] ; then + PROVIDER='Tencent Cloud' + else + PROVIDER='undefined' + fi else - PROVIDER='undefined' + PROVIDER='undefined' fi + +if [ "$(cat /sys/devices/virtual/dmi/id/product_uuid | cut -c 1-3)" = 'EC2' ] && [ -d /home/ubuntu ]; then + PROVIDER='Amazon Web Service' +fi + } @@ -404,6 +484,7 @@ elif echo $OUTPUT | grep -q "Ubuntu 18.04" ; then echo -e "\nDetecting Ubuntu 18.04...\n" SERVER_OS="Ubuntu" else + cat /etc/*release echo -e "\nUnable to detect your OS...\n" echo -e "\nCyberPanel is supported on Ubuntu 18.04, CentOS 7.x and CloudLinux 7.x...\n" exit 1 @@ -477,9 +558,9 @@ echo -e "\n This will install everything default , which is OpenLiteSpeed and no license_input() { VERSION="ENT" -SERIAL_NO="--ent ent --serial " echo -e "\nPlease note that your server has \e[31m$TOTAL_RAM\e[39m RAM" echo -e "If you are using \e[31mFree Start\e[39m license, It will not start due to \e[31m2GB RAM limit\e[39m.\n" +echo -e "If you do not have any license, you can also use trial license (if server has not used trial license before), type \e[31mTRIAL\e[39m\n" printf "%s" "Please input your serial number for LiteSpeed WebServer Enterprise:" read LICENSE_KEY @@ -502,23 +583,26 @@ TMP2=$(echo $LICENSE_KEY | cut -c10) TMP3=$(echo $LICENSE_KEY | cut -c15) if [[ $TMP == "-" ]] && [[ $TMP2 == "-" ]] && [[ $TMP3 == "-" ]] && [[ $KEY_SIZE == "19" ]] ; then - echo -e "License key set..." + echo -e "\nLicense key set..." +elif [[ $LICENSE_KEY == "trial" ]] || [[ $LICENSE_KEY == "TRIAL" ]] || [[ $LICENSE_KEY == "Trial" ]] ; then + echo -e "\nTrial license set..." + LICENSE_KEY="TRIAL" else echo -e "\nLicense key seems incorrect, please verify\n" echo -e "\nIf you are copying/pasting, please make sure you didn't paste blank space...\n" exit -fi +fi } interactive_mode() { echo -e " CyberPanel Installer v$CP_VER1$CP_VER2 1. Install CyberPanel. - + 2. Addons and Miscellaneous - + 3. Exit. - + " read -p " Please enter the number[1-3]: " num echo "" @@ -548,14 +632,14 @@ fi echo -e " CyberPanel Addons v$CP_VER1$CP_VER2 1. Install Memcached extension and backend - + 2. Install Redis extension and backend - + 3. Return to main page. - + 4. Exit " - + echo && read -p "Please enter the number[1-4]: " num case "$num" in 1) @@ -584,16 +668,16 @@ DISK=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)\n", $3,$2,$5}') #clear echo -e " CyberPanel Installer v$CP_VER1$CP_VER2 - RAM check : $RAM - + RAM check : $RAM + Disk check : $DISK (Minimal \e[31m10GB\e[39m free space) 1. Install CyberPanel with \e[31mOpenLiteSpeed\e[39m. - + 2. Install Cyberpanel with \e[31mLiteSpeed Enterprise\e[39m. - + 3. Exit. - + " read -p " Please enter the number[1-3]: " num echo "" @@ -648,6 +732,27 @@ fi COMMENT #above comment for future use +if [[ $DEV_ARG == "ON" ]] ; then +echo -e "\nDo you want to specify which branch you want to install?" +echo -e "\nNOTE: this feature is only for developers " +echo -e "\nonly use this feature if you are a \e[31mdeveloper\e[39m" +#echo -e "\nPlease press Enter key or n to proceed as normal user" +#echo -e "\nPlease enter \e[31mdeveloper\e[39m to confirm you want to use this feature" +#printf "%s" "" +#read TMP_YN + +#if [[ $TMP_YN == "developer" ]] ; then + DEV="ON" + echo -e "\nPlease specify branch name" + printf "%s" "" + read TMP_YN + BRANCH_NAME=$TMP_YN + echo -e "Branch name set to $BRANCH_NAME" +#else +# DEV="OFF" +#fi +fi + echo -e "\nPlease choose to use default admin password \e[31m1234567\e[39m, randomly generate one \e[31m(recommended)\e[39m or specify the admin password?" printf "%s" "Choose [d]fault, [r]andom or [s]et password: [d/r/s] " read TMP_YN @@ -715,8 +820,21 @@ if [[ -e /usr/local/CyberCP ]] ; then echo -e "\n CyberPanel already installed, exiting..." exit fi - + special_change + +if [[ $VERSION == "ENT" ]] ; then + echo -e "\nValidating the license..." + echo -e "\nThis may take a minute..." + echo -e "\nplease be patient...\n\n" + license_validation + SERIAL_NO="--ent ent --serial " +fi + +sed -i 's|lsws-5.4.2|lsws-'$LSWS_STABLE_VER'|g' installCyberPanel.py +sed -i 's|lsws-5.3.5|lsws-'$LSWS_STABLE_VER'|g' installCyberPanel.py +#this sed must be done after license validation + echo -e "Preparing..." echo -e "Installation will start in 10 seconds, if you wish to stop please press CTRL + C" sleep 10 @@ -727,8 +845,13 @@ if [[ $debug == "0" ]] ; then fi if [[ $debug == "1" ]] ; then + if [[ $DEV == "ON" ]] ; then + /usr/local/CyberPanel/bin/python install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY + else /usr/local/CyberPanel/bin/python2 install.py $SERVER_IP $SERIAL_NO $LICENSE_KEY - if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then + fi + + if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then echo -e "\nCyberPanel installation sucessfully completed..." else echo -e "Oops, something went wrong..." @@ -746,12 +869,12 @@ fi } pip_virtualenv() { - +if [[ $DEV == "OFF" ]] ; then if [[ $SERVER_COUNTRY == "CN" ]] ; then mkdir /root/.pip cat << EOF > /root/.pip/pip.conf [global] -index-url = https://mirrors.aliyun.com/pypi/simple/ +index-url = https://mirrors.aliyun.com/pypi/simple/ EOF fi @@ -767,6 +890,23 @@ rm -rf requirements.txt wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/1.8.0/requirments.txt pip install --ignore-installed -r requirements.txt virtualenv --system-site-packages /usr/local/CyberPanel +fi + +if [[ $DEV == "ON" ]] ; then + #install dev branch + #wget https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt + cd /usr/local/ + python3.6 -m venv CyberPanel + source /usr/local/CyberPanel/bin/activate + wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt + pip3.6 install --ignore-installed -r requirements.txt + cd - +fi + +if [ -f requirements.txt ] && [ -d cyberpanel ] ; then + rm -rf cyberpanel + rm -f requirements.txt +fi if [[ $SERVER_COUNTRY == "CN" ]] ; then wget https://cyberpanel.sh/cyberpanel-git.tar.gz @@ -774,13 +914,20 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then cp -r cyberpanel /usr/local/cyberpanel cd cyberpanel/install else + if [[ $DEV == "ON" ]] ; then + git clone https://github.com/usmannasir/cyberpanel + cd cyberpanel + git checkout $BRANCH_NAME + cd - + cp -r cyberpanel /usr/local/cyberpanel + cd cyberpanel/install + else git clone https://github.com/usmannasir/cyberpanel cp -r cyberpanel /usr/local/cyberpanel cd cyberpanel/install + fi fi - curl https://cyberpanel.sh/?version - } after_install() { @@ -794,13 +941,33 @@ fi chmod 1733 /var/lib/php/session -if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then +if grep "\[ERROR\] We are not able to run ./install.sh return code: 1. Fatal error, see /var/log/installLogs.txt for full details" /var/log/installLogs.txt > /dev/null; then + cd ${DIR}/cyberpanel/install/lsws-* + ./install.sh + echo -e "\n\n\nIt seems LiteSpeed Enterprise has failed to install, please check your license key is valid" + echo -e "\nIf this license key has been used before, you may need to go to store to release it first." + exit +fi -for version in $(ls /usr/local/lsws | grep lsphp); + +if grep "CyberPanel installation successfully completed" /var/log/installLogs.txt > /dev/null; then + +if [[ $DEV == "ON" ]] ; then +python3.6 -m venv /usr/local/CyberCP +source /usr/local/CyberCP/bin/activate +wget -O requirements.txt https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/requirments.txt +pip3.6 install --ignore-installed -r requirements.txt +systemctl restart lscpd +fi + +for version in $(ls /usr/local/lsws | grep lsphp); do php_ini=$(find /usr/local/lsws/$version/ -name php.ini) version2=${version:5:2} version2=$(awk "BEGIN { print "${version2}/10" }") + if [[ $version2 = "7" ]] ; then + version2="7.0" + fi if [[ $SERVER_OS == "CentOS" ]] ; then yum remove -y $version-mysql yum install -y $version-mysqlnd @@ -808,7 +975,7 @@ for version in $(ls /usr/local/lsws | grep lsphp); if [[ ! -d /usr/local/lsws/$version/tmp ]] ; then mkdir /usr/local/lsws/$version/tmp fi - /usr/local/lsws/${version}/bin/pecl channel-update pecl.php.net; + /usr/local/lsws/${version}/bin/pecl channel-update pecl.php.net; /usr/local/lsws/${version}/bin/pear config-set temp_dir /usr/local/lsws/${version}/tmp /usr/local/lsws/${version}/bin/pecl install timezonedb echo "extension=timezonedb.so" > /usr/local/lsws/${version}/etc/php.d/20-timezone.ini @@ -816,7 +983,7 @@ for version in $(ls /usr/local/lsws | grep lsphp); sed -i 's|mail.add_x_header = On|mail.add_x_header = Off|g' $php_ini sed -i 's|;session.save_path = "/tmp"|session.save_path = "/var/lib/php/session"|g' $php_ini fi - + if [[ $SERVER_OS == "Ubuntu" ]] ; then if [[ ! -d /usr/local/lsws/cyberpanel-tmp ]] ; then echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone @@ -836,9 +1003,7 @@ for version in $(ls /usr/local/lsws | grep lsphp); make clean fi done -sed -i 's|maxConnections 2000|maxConnections 20000|g' /usr/local/lsws/conf/httpd_config.conf -sed -i 's|maxSSLConnections 1000|maxSSLConnections 10000|g' /usr/local/lsws/conf/httpd_config.conf -/usr/local/lsws/bin/lswsctrl restart + rm -rf /etc/profile.d/cyberpanel* curl --silent -o /etc/profile.d/cyberpanel.sh https://cyberpanel.sh/?banner 2>/dev/null chmod +x /etc/profile.d/cyberpanel.sh @@ -855,14 +1020,33 @@ echo "systemctl restart lscpd" >> /usr/bin/adminPass chmod +x /usr/bin/adminPass if [[ $VERSION = "OLS" ]] ; then WORD="OpenLiteSpeed" +# sed -i 's|maxConnections 10000|maxConnections 100000|g' /usr/local/lsws/conf/httpd_config.conf +# OLS_LATEST=$(curl https://openlitespeed.org/packages/release) +# wget https://openlitespeed.org/packages/openlitespeed-$OLS_LATEST.tgz +# tar xzvf openlitespeed-$OLS_LATEST.tgz +# cd openlitespeed +# ./install.sh + /usr/local/lsws/bin/lswsctrl stop + /usr/local/lsws/bin/lswsctrl start +# rm -f openlitespeed-$OLS_LATEST.tgz +# rm -rf openlitespeed +# cd .. fi if [[ $VERSION = "ENT" ]] ; then WORD="LiteSpeed Enterprise" if [[ $SERVER_COUNTRY != "CN" ]] ; then - LSWS_VER=$(curl -s http://update.litespeedtech.com/ws/latest.php | grep LSWS | sed 's/LSWS=//' | head -n 1) - /usr/local/lsws/admin/misc/lsup.sh -f -v ${LSWS_VER} + /usr/local/lsws/admin/misc/lsup.sh -f -v $LSWS_STABLE_VER fi fi + +systemctl status lsws 2>&1>/dev/null +if [[ $? == "0" ]] ; then + echo "LSWS service is running..." +else + systemctl stop lsws + systemctl start lsws +fi + clear echo "###################################################################" echo " CyberPanel Successfully Installed " @@ -908,7 +1092,7 @@ fi if [[ $SERVER_COUNTRY = CN ]] ; then if [[ $PROVIDER == "Tencent Cloud" ]] ; then if [[ $SERVER_OS == "Ubuntu" ]] ; then - rm -f /etc/apt/sources.list + rm -f /etc/apt/sources.list mv /etc/apt/sources.list-backup /etc/apt/sources.list echo > "nameserver 127.0.0.53 options edns0" /run/systemd/resolve/stub-resolv.conf @@ -921,9 +1105,15 @@ options edns0" /etc/resolv.conf if [[ $VERSION = "ENT" ]] ; then sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|https://cyberpanel.sh/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz|g' /usr/local/CyberCP/install/installCyberPanel.py sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz|https://cyberpanel.sh/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py + sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz|https://'$DOWNLOAD_SERVER'/litespeed/lsws-'$LSWS_STABLE_VER'-ent-x86_64-linux.tar.gz|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py echo -e "If you have install LiteSpeed Enterprise, please run \e[31m/usr/local/lsws/admin/misc/lsup.sh\033[39m to update it to latest." fi fi + +sed -i 's|lsws-5.3.8|lsws-'$LSWS_STABLE_VER'|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py +sed -i 's|lsws-5.4.2|lsws-'$LSWS_STABLE_VER'|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py +sed -i 's|lsws-5.3.5|lsws-'$LSWS_STABLE_VER'|g' /usr/local/CyberCP/serverStatus/serverStatusUtil.py + if [[ $SILENT != "ON" ]] ; then printf "%s" "Would you like to restart your server now? [y/N]: " read TMP_YN @@ -953,10 +1143,15 @@ TMP=$(echo $VERSION | cut -c5) TMP2=$(echo $VERSION | cut -c10) TMP3=$(echo $VERSION | cut -c15) if [[ $VERSION == "OLS" || $VERSION == "ols" ]] ; then - VERSION=OLS + VERSION="OLS" echo -e "\nSet to OpenLiteSpeed..." +elif [[ $VERSION == "Trial" ]] || [[ $VERSION == "TRIAL" ]] || [[ $VERSION == "trial" ]] ; then + VERSION="ENT" + LICENSE_KEY="TRIAL" + echo -e "\nLiteSpeed Enterprise trial license set..." elif [[ $TMP == "-" ]] && [[ $TMP2 == "-" ]] && [[ $TMP3 == "-" ]] && [[ $KEY_SIZE == "19" ]] ; then LICENSE_KEY=$VERSION + VERSION="ENT" echo -e "\nLiteSpeed Enterprise license key set..." else echo -e "\nCan not recognize the input value \e[31m$VERSION\e[39m " @@ -975,7 +1170,6 @@ elif [[ $ADMIN_PASS == "r" ]] ; then echo -e "\nAdmin password will be set to \e[31m$ADMIN_PASS\e[39m" echo $ADMIN_PASS else - echo -e "\nManual input password..." echo -e "\nAdmin password will be set to \e[31m$ADMIN_PASS\e[39m" fi } @@ -985,6 +1179,11 @@ if [ $# -eq 0 ] ; then else if [[ $1 == "help" ]] ; then show_help + exit + elif [[ $1 == "dev" ]] ; then + DEV="ON" + DEV_ARG="ON" + SILENT="OFF" elif [[ $1 == "default" ]] ; then echo -e "\nThis will start default installation...\n" SILENT="ON" @@ -1045,7 +1244,7 @@ fi -SERVER_IP=$(curl --silent --max-time 5 -4 https://cyberpanel.sh/?ip) +SERVER_IP=$(curl --silent --max-time 10 -4 https://cyberpanel.sh/?ip) if [[ $SERVER_IP =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then echo -e "Valid IP detected..." else @@ -1065,7 +1264,7 @@ fi if [[ $SERVER_COUNTRY == "CN" ]] ; then DOWNLOAD_SERVER="cyberpanel.sh" else -DOWNLOAD_SERVER="cyberpanelsh.b-cdn.net" +DOWNLOAD_SERVER="cdn.cyberpanel.sh" fi check_OS @@ -1091,6 +1290,4 @@ pip_virtualenv system_tweak -main_install - - +main_install \ No newline at end of file diff --git a/install/install.py b/install/install.py index 36386ffa3..279c6293d 100755 --- a/install/install.py +++ b/install/install.py @@ -1562,6 +1562,9 @@ imap_folder_list_limit = 0 command = "make" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + if not os.path.exists('/usr/local/CyberCP/bin/'): + os.mkdir('/usr/local/CyberCP/bin/') + command = "cp lswsgi /usr/local/CyberCP/bin/" preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)