diff --git a/.DS_Store b/.DS_Store index 7aa1d3f5d..76aef38aa 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/cyberpanel.sh b/cyberpanel.sh index 38550d5d4..e5a8c855c 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -44,20 +44,23 @@ wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_uti chmod 700 /usr/bin/cyberpanel_utility fi -if ! cat /etc/bash.bashrc | grep -q cyberpanel_utility ; then +#<< --COMMENTOUT-- +BASH_PATH="/root/.bashrc" +if ! cat $BASH_PATH | grep -q cyberpanel_utility ; then echo -e "\n\ncyberpanel() { -if [[ $1 == "utility" ]] ; then -/usr/bin/cyberpanel_utility ${@:2:99} -elif [[ $1 == "help" ]] ; then +if [[ \$1 == \"utility\" ]] ; then +/usr/bin/cyberpanel_utility \${@:2:99} +elif [[ \$1 == \"help\" ]] ; then /usr/bin/cyberpanel_utility --help -elif [[ $1 == "upgrade" ]] || [[ $1 == "update" ]] ; then +elif [[ \$1 == \"upgrade\" ]] || [[ \$1 == \"update\" ]] ; then /usr/bin/cyberpanel_utility --upgrade else -/usr/bin/cyberpanel "$@" +/usr/bin/cyberpanel \"\$@\" fi -}" >> /etc/bash.bashrc -source /etc/bash.bashrc +}" >> $BASH_PATH fi +#--COMMENTOUT-- + } watchdog_setup() { @@ -1251,7 +1254,7 @@ webadmin_passwd watchdog_setup -#install_utility +install_utility clear echo "###################################################################" diff --git a/cyberpanel_upgrade.sh b/cyberpanel_upgrade.sh index 8fc2c6cc5..f3f2990fd 100644 --- a/cyberpanel_upgrade.sh +++ b/cyberpanel_upgrade.sh @@ -12,19 +12,23 @@ wget -q -O /usr/bin/cyberpanel_utility https://cyberpanel.sh/misc/cyberpanel_uti chmod 700 /usr/bin/cyberpanel_utility fi -if ! cat /etc/bash.bashrc | grep -q cyberpanel_utility ; then +BASH_PATH="/root/.bashrc" + +if ! cat $BASH_PATH | grep -q cyberpanel_utility ; then echo -e "\n\ncyberpanel() { -if [[ $1 == "utility" ]] ; then -/usr/bin/cyberpanel_utility ${@:2:99} -elif [[ $1 == "help" ]] ; then +if [[ \$1 == \"utility\" ]] ; then +/usr/bin/cyberpanel_utility \${@:2:99} +elif [[ \$1 == \"help\" ]] ; then /usr/bin/cyberpanel_utility --help -elif [[ $1 == "upgrade" ]] || [[ $1 == "update" ]] ; then +elif [[ \$1 == \"upgrade\" ]] || [[ \$1 == \"update\" ]] ; then /usr/bin/cyberpanel_utility --upgrade else -/usr/bin/cyberpanel "$@" +/usr/bin/cyberpanel \"\$@\" fi -}" >> /etc/bash.bashrc -source /etc/bash.bashrc +}" >> $BASH_PATH + + +source $BASH_PATH fi } diff --git a/cyberpanel_utility.sh b/cyberpanel_utility.sh index 91758476f..c9e0e98bf 100644 --- a/cyberpanel_utility.sh +++ b/cyberpanel_utility.sh @@ -5,6 +5,29 @@ export LC_CTYPE=en_US.UTF-8 SUDO_TEST=$(set) BRANCH_NAME="stable" +check_OS() { +echo -e "\nChecking OS..." +OUTPUT=$(cat /etc/*release) +if echo $OUTPUT | grep -q "CentOS Linux 7" ; then + echo -e "\nDetecting CentOS 7.X...\n" + SERVER_OS="CentOS" +elif echo $OUTPUT | grep -q "CloudLinux 7" ; then + echo -e "\nDetecting CloudLinux 7.X...\n" + SERVER_OS="CentOS" +elif echo $OUTPUT | grep -q "CentOS Linux 8" ; then + echo -e "\nDetecting CentOS 8.X...\n" + SERVER_OS="CentOS" + CENTOS_8="True" +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, CentOS 8.x and CloudLinux 7.x...\n" + exit 1 +fi +} set_watchdog() { echo -e "\nPlease choose:" @@ -102,6 +125,9 @@ rm -f /tmp/cyberpanel_utility.sh } cyberpanel_upgrade() { +echo -e "CyberPanel Upgrade will start in 10 seconds" +echo -e "If you want to cancel, please press CTRL + C to cancel it" +sleep 10 echo -e "CyberPanel upgrading..." rm -f /usr/local/cyberpanel_upgrade.sh wget -O /usr/local/cyberpanel_upgrade.sh -q https://raw.githubusercontent.com/usmannasir/cyberpanel/$BRANCH_NAME/cyberpanel_upgrade.sh @@ -113,12 +139,158 @@ exit show_help() { echo -e "\nFetching information...\n" -curl https://cyberpanel.sh/misc/faq.txt +curl --silent https://cyberpanel.sh/misc/faq.sh | sudo -u nobody bash exit } addons() { -echo -e "place holder" + echo -e "\nPlease choose:" + echo -e "\n1. Install Memcached extension for PHP." + echo -e "\n2. Install Memcached server." + echo -e "\n3. Install Redis extension for PHP." + echo -e "\n4. Install Redis server." + echo -e "\n5. Back to Main Menu.\n" + printf "%s" "Please enter number [1-5]: " + read TMP_YN + + if [[ $TMP_YN == "1" ]] ; then + install_php_memcached + elif [[ $TMP_YN == "2" ]] ; then + install_memcached + elif [[ $TMP_YN == "3" ]]; then + install_php_redis + elif [[ $TMP_YN == "4" ]] ; then + install_redis + elif [[ $TMP_YN == "5" ]] ; then + main_page + else + echo -e " Please enter the right number [1-5]\n" + exit + fi +} + +install_php_redis() { + if [[ $SERVER_OS == "CentOS" ]] ; then + yum install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis lsphp56-redis lsphp55-redis lsphp54-redis + fi + if [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-redis lsphp73-redis lsphp72-redis lsphp71-redis lsphp70-redis + fi + echo -e "\nRedis extension for PHP has been installed..." + exit +} + +install_redis() { + if [[ -f /usr/bin/redis-cli ]] ; then + echo -e "\nRedis is already installed..." + fi + if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "CentOS" ]] ; then + yum install -y redis + fi + if [[ ! -f /usr/bin/redis-cli ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y redis + fi + if ifconfig -a | grep inet6 ; then + echo -e "\n IPv6 detected..." + else + if [[ $SERVER_OS == "Ubuntu" ]] ; then + sed -i 's|bind 127.0.0.1 ::1|bind 127.0.0.1|g' /etc/redis/redis.conf + #remove ipv6 binding to prevent Redis fail to start. + fi + echo -e "\n no IPv6 detected..." + fi + + if systemctl is-active --quiet redis ; then + systemctl status redis + else + systemctl enable redis + systemctl start redis + systemctl status redis + fi +} + +install_memcached() { +echo -e "\n Would you like to install Memcached or LiteSpeed Mmecached ?" +echo -e "\n 1. LiteSpeed Memcached" +echo -e "\n 2. Memcached" +echo -e "\n 3. Back to Main Menu\n" +printf "%s" "Please enter number [1-3]: " +read TMP_YN + + if [[ $TMP_YN == "1" ]] ; then + if systemctl is-active --quiet memcached ; then + echo -e "\nIt seems Memcached server is already running..." + systemctl status memcached + exit + fi + if [[ -f /usr/local/lsmcd/bin/lsmcd ]] ; then + echo -e "\nLiteSpeed Memcached is already installed..." + else + if [[ $SERVER_OS == "CentOS" ]] ; then + yum groupinstall "Development Tools" -y + yum install autoconf automake zlib-devel openssl-devel expat-devel pcre-devel libmemcached-devel cyrus-sasl* -y + elif [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install build-essential zlib1g-dev libexpat1-dev openssl libssl-dev libsasl2-dev libpcre3-dev git -y + fi + wget https://cdn.cyberpanel.sh/litespeed/lsmcd.tar.gz + tar xzvf lsmcd.tar.gz + DIR=$(pwd) + cd $DIR/lsmcd + ./fixtimestamp.sh + ./configure CFLAGS=" -O3" CXXFLAGS=" -O3" + make + make install + cd $DIR + fi + if systemctl is-active --quiet lsmcd ; then + systemctl status lsmcd + else + systemctl enable lsmcd + systemctl start lsmcd + systemctl status lsmcd + fi + + elif [[ $TMP_YN == "2" ]] ; then + if systemctl is-active --quiet lsmcd ; then + echo -e "\nIt seems LiteSpeed Memcached server is already running..." + systemctl status lsmcd + exit + fi + if [[ -f /usr/bin/memcached ]] ; then + echo -e "\nMemcached is already installed..." + fi + if [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "CentOS" ]] ; 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 [[ ! -f /usr/bin/memcached ]] && [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install memcached -y + fi + if systemctl is-active --quiet memcached ; then + systemctl status memcached + else + systemctl enable memcached + systemctl start memcached + systemctl status memcached + fi + elif [[ $TMP_YN == "3" ]] ; then + main_page + else + echo -e " Please enter the right number [1-3]\n" + exit + fi +} + +install_php_memcached() { + if [[ $SERVER_OS == "CentOS" ]] ; then + yum install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached lsphp56-pecl-memcached lsphp55-pecl-memcached lsphp54-pecl-memcached + fi + if [[ $SERVER_OS == "Ubuntu" ]] ; then + DEBIAN_FRONTEND=noninteractive apt install -y lsphp74-memcached lsphp73-memcached lsphp72-memcached lsphp71-memcached lsphp70-memcached + fi + echo -e "\nMemcached extension for PHP has been installed..." + exit } main_page() { @@ -148,7 +320,7 @@ case "$num" in set_watchdog ;; 4) - get_faq + show_help ;; 5) exit @@ -189,6 +361,8 @@ panel_check sudo_check +check_OS + self_check diff --git a/faq.sh b/faq.sh new file mode 100644 index 000000000..414ea980d --- /dev/null +++ b/faq.sh @@ -0,0 +1,77 @@ +#!/bin/bash + + +RED='\033[0;31m' +GREEN='\033[0;32m' +BLUE='\033[0;34m' +PURPLE='\033[0;35m' +NC='\033[0m' # No Color + +#${RED}text${NC} +#${GREEN} ${BLUE} + + +echo -e "Frequently Asked Question + +${PURPLE}1.${NC} How to reset CyberPanel admin password? + +execute command ${RED}adminPass YOUR_NEW_PASSWORD${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}2.${NC} How to reset LiteSpeed WebAdmin Console user/password ? + +execute command ${RED}/usr/local/lsws/admin/misc/admpass.sh${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}3.${NC} How to access LiteSpeed webadmin console ? + +Please check this post: ${GREEN}https://forums.cyberpanel.net/discussion/87/tutorial-how-to-setup-and-login-to-openlitespeed-webadmin-console/p1${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}4.${NC} What is MariaDB root password ? + +execute command ${RED}cat /etc/cyberpanel/mysqlPassword${NC} will show you the root password + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}5.${NC} Can I change MariaDB root passwod ? + +Yes , but after you changed , please make sure you have updated the password in following 2 files as well + +${RED}/etc/cyberpanel/mysqlPassword${NC} + +${RED}/usr/local/CyberCP/CyberCP/settings.py${NC} + +otherwise CyberPanel will not have access to database. + +${BLUE}------------------------------------------------------------${NC} + +${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 + +${RED}/usr/local/lsws/lsphp73/etc/php/7.3/litespeed/php.ini${NC} for Ubbuntu + +find 2 configurations: + +${RED}post_max_size${NC} and ${RED}upload_max_filesize${NC} , change from to higher number, e.g. ${RED}100M${NC} (don't miss the M) + +and then run ${RED}pkill lsphp${NC} to kill all current php process for new configuration to take effect. + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}7.${NC} How to add more IPs to my website(s) ? + +For OpenLiteSpeed, please check this post: ${GREEN}https://forums.cyberpanel.net/discussion/126/tutorial-how-to-add-2nd-ip-for-websites/p1${NC} + +For LiteSpeed Enterprise, please check this post: ${GREEN}https://forums.cyberpanel.net/discussion/3745/tutorial-how-to-add-2nd-ip-for-litespeed-enterprise/p1${NC} + +${BLUE}------------------------------------------------------------${NC} + +${PURPLE}8.${NC} How to remove 8090 port in CyberPanel URL ? + +Please check this post ${GREEN}https://blog.cyberpanel.net/2018/12/25/how-to-remove-port-8090-from-cyberpanel/${NC} +"