diff --git a/.gitignore b/.gitignore index 1f01fc2e6..aae13447a 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,4 @@ pyvenv.cfg include data/api_login.txt data/sessions -data/ssl.pl +data/ssl.pl diff --git a/mw-cli b/mw-cli new file mode 100644 index 000000000..8d5f63f10 --- /dev/null +++ b/mw-cli @@ -0,0 +1,81 @@ +#!/www/server/mdserver-web/bin/python +# description: mdserver-web cli tools +# ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli +import os +import sys + + +def mw_start(): + """ + Start mdserver-web + """ + os.system('systemctl start mw') + print("服务已启动") + + +def mw_stop(): + """ + stop mdserver-web + """ + os.system('systemctl stop mw') + print("服务已停止") + + +def mw_restart(): + """ + restart mdserver-web + """ + os.system('systemctl restart mw') + print("服务已重启") + + +def mw_reset_username(): + """ + reset mdserver-web username + """ + from tools import set_panel_username + user_name = input("请输入新的用户名: ") + set_panel_username(user_name) + + +def mw_reset_pwd(): + """ + reset mdserver-web password + """ + from tools import set_panel_pwd + pwd = input("请输入新的密码: ") + set_panel_pwd(pwd, True) + + +if __name__ == '__main__': + os.chdir("/www/server/mdserver-web") + sys.path.append(os.getcwd() + "/class/core") + + try: + str = ''' + ==== mdserver-web cli tools ==== + 1. 启动服务 2. 停止服务 + 3. 重启服务 4. 修改用户名 + 5. 修改密码 + ================================= + ''' + if len(sys.argv) == 2: + sw = sys.argv[1] + else: + print(str) + sw = input("请输入您要进行的操作: ") + + if sw == '1': + mw_start() + elif sw == '2': + mw_stop() + elif sw == '3': + mw_restart() + elif sw == '4': + mw_reset_username() + elif sw == '5': + mw_reset_pwd() + else: + print("操作不存在") + except KeyboardInterrupt: + print("\n操作已终止") diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 3676c3bc5..53ae30979 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -43,8 +43,7 @@ Install_openresty() --with-http_slice_module \ --with-http_stub_status_module && make && make install && \ echo "${VERSION}" > $serverPath/openresty/version.pl - - + echo "" > $serverPath/web_conf/nginx/enable-php-00.conf echo '安装完成' > $install_tmp } diff --git a/plugins/xhprof/install.sh b/plugins/xhprof/install.sh index 14af37c44..938a854d7 100755 --- a/plugins/xhprof/install.sh +++ b/plugins/xhprof/install.sh @@ -26,6 +26,7 @@ Uninstall_xh() { rm -rf ${serverPath}/xhprof cd /tmp/xhprof && rm -rf *.xhprof + rm -f /www/server/web_conf/nginx/vhost/xhprof.conf echo '卸载完成' > $install_tmp } diff --git a/scripts/init.d/mw.tpl b/scripts/init.d/mw.tpl index 4c5192f11..c59f86a7f 100755 --- a/scripts/init.d/mw.tpl +++ b/scripts/init.d/mw.tpl @@ -185,13 +185,14 @@ case "$1" in if [ -f $mw_path/data/admin_path.pl ];then auth_path=$(cat $mw_path/data/admin_path.pl) fi - if [ "$address" = "" ];then - address=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress) + if [ "$address" = "" ];then + address=$(curl -sS --connect-timeout 10 -m 60 https://v6r.ipip.net/?format=text) fi + echo -e "==================================================================" echo -e "\033[32mMW-Panel default info!\033[0m" echo -e "==================================================================" - echo "MW-Panel-URL: http://$address:$port$auth_path" + echo -e "MW-Panel-URL: http://$address:$port$auth_path" echo -e `python3 $mw_path/tools.py username` echo -e "password: $password" echo -e "\033[33mWarning:\033[0m" @@ -199,4 +200,4 @@ case "$1" in echo -e "\033[33mrelease the following port (7200|888|80|443|20|21) in the security group\033[0m" echo -e "==================================================================" ;; -esac \ No newline at end of file +esac diff --git a/scripts/install.sh b/scripts/install.sh index 44552dddb..c2de403f3 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,7 +1,7 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -LANG=en_US.UTF-8 +# LANG=en_US.UTF-8 is64bit=`getconf LONG_BIT` if [ -f /etc/motd ];then @@ -74,7 +74,9 @@ fi echo "use system version: ${OSNAME}" curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install/${OSNAME}.sh | bash +chmod +x /www/server/mdserver-web/mw-cli +ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli endTime=`date +%s` ((outTime=(${endTime}-${startTime})/60)) -echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" \ No newline at end of file +echo -e "Time consumed:\033[32m $outTime \033[0mMinute!" diff --git a/scripts/install/alma.sh b/scripts/install/alma.sh index c396c9792..c4e669562 100755 --- a/scripts/install/alma.sh +++ b/scripts/install/alma.sh @@ -69,50 +69,27 @@ fi systemctl stop firewalld yum groupinstall -y "Development Tools" +yum install -y epel-release yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel yum install -y wget python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev libjpeg-devel libpng-devel libwebp libwebp-devel pcre pcre-devel yum install -y lsof net-tools yum install -y ncurses-devel mysql-devel cmake yum install -y MySQL-python -yum install -y epel-release - -if [ ! -d /www/server/mdserver-web ];then - wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master - cd /tmp && unzip /tmp/master.zip - mv /tmp/mdserver-web-master /www/server/mdserver-web - rm -rf /tmp/master.zip - rm -rf /tmp/mdserver-web-master -fi -#if [ ! -f '/usr/bin/pip' ];then -# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -# python get-pip.py -# pip install --upgrade pip -# pip install pillow==6.2.2 -#fi - - -if [ ! -f /usr/local/bin/pip3 ];then - python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple -fi cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data -# if [ ! -f /www/server/mdserver-web/bin/activate ];then -# cd /www/server/mdserver-web && python3 -m venv . -# fi - -if [ -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +if [ ! -f /usr/local/bin/pip3 ];then + python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi +sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt pip install --upgrade pip +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt pip3 install gunicorn==20.1.0 pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 @@ -123,6 +100,21 @@ pip3 install psutil==5.9.1 pip3 install pymongo +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip3 install gunicorn==20.1.0 + pip3 install gevent==21.1.2 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + pip3 install flask-socketio==5.2.0 + pip3 install psutil==5.9.1 + pip3 install pymongo +fi + cd /www/server/mdserver-web && ./cli.sh start sleep 5 diff --git a/scripts/install/centos.sh b/scripts/install/centos.sh index 49ae894eb..1f51b4720 100755 --- a/scripts/install/centos.sh +++ b/scripts/install/centos.sh @@ -67,14 +67,23 @@ fi systemctl stop firewalld yum groupinstall -y "Development Tools" +yum install -y epel-release + +yum install -y oniguruma oniguruma-devel +#centos8 stream | use dnf +if [ "$?" != "0" ];then + yum install -y dnf dnf-plugins-core + dnf config-manager --set-enabled powertools + yum install -y oniguruma oniguruma-devel +fi -yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel +yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip yum install -y python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev pcre pcre-devel yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel yum install -y lsof net-tools yum install -y ncurses-devel mysql-devel cmake yum install -y MySQL-python -yum install -y epel-release + if [ ! -f /usr/local/bin/pip3 ];then @@ -82,38 +91,51 @@ if [ ! -f /usr/local/bin/pip3 ];then fi +# echo "start install lib" cd /www/server/mdserver-web/scripts && bash lib.sh +# echo "end install lib" + + chmod 755 /www/server/mdserver-web/data -if [ ! -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && python3 -m venv . -fi +# echo "start install python lib" -if [ -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt - pip install --upgrade pip - pip3 install gunicorn==20.1.0 - pip3 install gevent==21.1.2 - pip3 install gevent-websocket==0.10.1 - pip3 install requests==2.20.0 - pip3 install flask-caching==1.10.1 - pip3 install python-socketio==4.2.0 - pip3 install psutil==5.9.1 - pip3 install pymongo -else +pip install --upgrade pip +pip3 install gunicorn==20.1.0 +pip3 install gevent==21.1.2 +pip3 install gevent-websocket==0.10.1 +pip3 install requests==2.20.0 +pip3 install flask-caching==1.10.1 +pip3 install python-socketio==4.2.0 +pip3 install psutil==5.9.1 +pip3 install pymongo + +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt + + +# echo "start install python env lib" + +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + source /www/server/mdserver-web/bin/activate pip install --upgrade pip - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt - pip3 install gunicorn==20.1.0 + pip3 install -r /www/server/mdserver-web/requirements.txt + pip3 install gunicorn==20.1.0 pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 + pip3 install flask-session==0.3.2 + pip3 install flask-sqlalchemy==2.3.2 pip3 install python-socketio==4.2.0 - pip3 install psutil==5.9.1 + pip3 install psutil==5.9.1 pip3 install pymongo fi +# echo "end install python env lib" +# echo "end install python lib" + cd /www/server/mdserver-web && ./cli.sh start sleep 5 diff --git a/scripts/install/debian.sh b/scripts/install/debian.sh index c3f2a19a4..e5338111f 100644 --- a/scripts/install/debian.sh +++ b/scripts/install/debian.sh @@ -63,22 +63,14 @@ systemctl stop firewalld cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data -# if [ ! -f /www/server/mdserver-web/bin/activate ];then -# cd /www/server/mdserver-web && python3 -m venv . -# fi - -if [ -f /www/server/mdserver-web/bin/activate ];then - pip install --upgrade pip - pip install --upgrade setuptools - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -fi - if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi +pip install --upgrade pip +pip install --upgrade setuptools + +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt pip3 install gunicorn==20.1.0 pip3 install gevent==21.1.2 @@ -89,6 +81,22 @@ pip3 install flask-socketio==5.2.0 pip3 install pymongo pip3 install psutil +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip install --upgrade setuptools + pip3 install gunicorn==20.1.0 + pip3 install gevent==21.1.2 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + pip3 install flask-socketio==5.2.0 + pip3 install pymongo + pip3 install psutil +fi + cd /www/server/mdserver-web && ./cli.sh start sleep 5 diff --git a/scripts/install/fedora.sh b/scripts/install/fedora.sh index 1d75f4106..9074e7eef 100644 --- a/scripts/install/fedora.sh +++ b/scripts/install/fedora.sh @@ -66,6 +66,7 @@ systemctl stop firewalld yum groupinstall -y "Development Tools" +yum -y install epel-release yum install -y libevent libevent-devel libxslt* libjpeg* libpng* gd* zip libmcrypt libmcrypt-devel yum install -y gcc libffi-devel python-devel openssl-devel @@ -74,38 +75,29 @@ yum -y install wget python-devel python-imaging libicu-devel unzip bzip2-devel g yum -y install net-tools yum -y install ncurses-devel mysql-devel cmake yum -y install python-devel -yum -y install MySQL-python -yum -y install epel-release +yum -y install MySQL-python yum -y install python3-devel - -#if [ ! -f '/usr/bin/pip' ];then -# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -# python get-pip.py -# pip install --upgrade pip -# pip install pillow==6.2.2 -#fi - +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +cd /www/server/mdserver-web/scripts && bash lib.sh +chmod 755 /www/server/mdserver-web/data if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi - -cd /www/server/mdserver-web/scripts && bash lib.sh -chmod 755 /www/server/mdserver-web/data +pip install --upgrade pip +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt if [ ! -f /www/server/mdserver-web/bin/activate ];then cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt fi + - -if [ -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -fi cd /www/server/mdserver-web && ./cli.sh start sleep 5 diff --git a/scripts/install/rocky.sh b/scripts/install/rocky.sh index f816a499b..b4621abeb 100644 --- a/scripts/install/rocky.sh +++ b/scripts/install/rocky.sh @@ -68,42 +68,26 @@ fi systemctl stop firewalld yum groupinstall -y "Development Tools" +yum install -y epel-release yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel yum install -y wget python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev libjpeg-devel libpng-devel libwebp libwebp-devel pcre pcre-devel yum install -y lsof net-tools yum install -y ncurses-devel mysql-devel cmake yum install -y MySQL-python -yum install -y epel-release - -#if [ ! -f '/usr/bin/pip' ];then -# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -# python get-pip.py -# pip install --upgrade pip -# pip install pillow==6.2.2 -#fi - - -if [ ! -f /usr/local/bin/pip3 ];then - python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple -fi cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data -if [ ! -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && python3 -m venv . +if [ ! -f /usr/local/bin/pip3 ];then + python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi -if [ -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -fi pip install --upgrade pip +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt pip3 install gunicorn==20.1.0 pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 @@ -114,6 +98,21 @@ pip3 install psutil==5.9.1 pip3 install pymongo +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip3 install gunicorn==20.1.0 + pip3 install gevent==21.1.2 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + pip3 install python-socketio==4.2.0 + pip3 install psutil==5.9.1 + pip3 install pymongo +fi + cd /www/server/mdserver-web && ./cli.sh start sleep 5 diff --git a/scripts/install/ubuntu.sh b/scripts/install/ubuntu.sh index e31ddb5ea..9bec0dbdd 100644 --- a/scripts/install/ubuntu.sh +++ b/scripts/install/ubuntu.sh @@ -66,43 +66,41 @@ if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi -# cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -# pip install --upgrade pip -# pip install --upgrade setuptools -# pip3 install gunicorn==20.1.0 -# pip3 install gevent==21.1.2 -# pip3 install gevent-websocket==0.10.1 -# pip3 install requests==2.20.0 -# pip3 install flask-caching==1.10.1 -# pip3 install flask-socketio==5.2.0 -# pip3 install flask-session==0.3.2 -# pip3 install pymongo -# pip3 install psutil - - -# if [ ! -f /www/server/mdserver-web/bin/activate ];then -# cd /www/server/mdserver-web && python3 -m venv . -# fi - -if [ -f /www/server/mdserver-web/bin/activate ];then - python -m pip install --upgrade pip - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -fi - +pip install --upgrade pip +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +pip install --upgrade setuptools pip3 install gunicorn==20.1.0 -pip3 install gevent==20.9.0 +pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 -#ubuntu 20 need pip3 install flask-socketio==5.2.0 pip3 install flask-session==0.3.2 pip3 install pymongo pip3 install psutil +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . +fi + +if [ -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip3 install gunicorn==20.1.0 + pip3 install gevent==20.9.0 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + #ubuntu 20 need + pip3 install flask-socketio==5.2.0 + pip3 install flask-session==0.3.2 + pip3 install pymongo + pip3 install psutil +fi + + cd /www/server/mdserver-web && ./cli.sh start sleep 5 diff --git a/scripts/install_cn.sh b/scripts/install_cn.sh index eae9bc696..15e878001 100755 --- a/scripts/install_cn.sh +++ b/scripts/install_cn.sh @@ -1,7 +1,7 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -LANG=en_US.UTF-8 +# LANG=en_US.UTF-8 is64bit=`getconf LONG_BIT` if [ -f /etc/motd ];then diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index 643698616..4b914988f 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -1,7 +1,7 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -LANG=en_US.UTF-8 +# LANG=en_US.UTF-8 is64bit=`getconf LONG_BIT` if [ -f /etc/motd ];then @@ -72,7 +72,8 @@ if [ $OSNAME != "macos" ];then fi echo "use system version: ${OSNAME}" -curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install/${OSNAME}.sh | bash + +curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/${OSNAME}.sh | bash endTime=`date +%s` diff --git a/scripts/lib.sh b/scripts/lib.sh index 63d453d9c..7f33fc0e7 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -244,17 +244,19 @@ echo -e "Install_Curl" >> ${libPath}/lib.pl } -_os=`uname` if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then sudo ln -sf /bin/bash /bin/sh #sudo dpkg-reconfigure dash fi +_os=`uname` if [ ${_os} == "Darwin" ]; then OSNAME='macos' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' +elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then + OSNAME='rocky' elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then OSNAME='rhel' elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then @@ -292,7 +294,7 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then apt install -y libffi-dev apt install -y cmake automake make - apt install -y php-common webp scons + apt install -y webp scons apt install -y lzma lzma-dev libunwind-dev apt install -y libpcre3 libpcre3-dev @@ -328,19 +330,17 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then else yum install -y openldap openldap-devel libtirpc libtirpc-devel rpcgen - yum install -y bison re2c cmake yum install -y libmemcached libmemcached-devel yum install -y curl-devel yum install -y zlib zlib-devel + yum install -y libzip libzip-devel yum install -y pcre pcre-devel yum install -y icu libicu-devel autoconf yum install -y freetype freetype-devel yum install -y openssl openssl-devel - yum install -y libzip libzip-devel yum install -y graphviz libxml2 libxml2-devel - yum install -y sqlite-devel yum install -y oniguruma oniguruma-devel yum install -y ImageMagick ImageMagick-devel diff --git a/scripts/rememory.sh b/scripts/rememory.sh index eb55fcec4..1e09ee1d6 100755 --- a/scripts/rememory.sh +++ b/scripts/rememory.sh @@ -61,6 +61,14 @@ if [ -f $rootPath"/php/init.d/php74" ];then $rootPath"/php/init.d/php74" reload fi +if [ -f $rootPath"/php/init.d/php80" ];then + $rootPath"/php/init.d/php74" reload +fi + +if [ -f $rootPath"/php/init.d/php81" ];then + $rootPath"/php/init.d/php74" reload +fi + if [ -f $rootPath"/openresty/nginx/sbin/nginx" ];then $rootPath"/openresty/nginx/sbin/nginx" -s reload fi diff --git a/scripts/update.sh b/scripts/update.sh index 00fa5321d..8df4e7b61 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -1,7 +1,7 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -LANG=en_US.UTF-8 +# LANG=en_US.UTF-8 is64bit=`getconf LONG_BIT` startTime=`date +%s` diff --git a/scripts/update/alma.sh b/scripts/update/alma.sh index a5f2cf78f..5b8b20721 100755 --- a/scripts/update/alma.sh +++ b/scripts/update/alma.sh @@ -11,7 +11,6 @@ fi sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config -yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data @@ -21,27 +20,29 @@ if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi -#venv -# if [ ! -f /www/server/mdserver-web/bin/activate ];then -# cd /www/server/mdserver-web && python3 -m venv . -# fi +sed -i "/mysqlclient/d" /www/server/mdserver-web/requirements.txt +pip install --upgrade pip +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +pip3 install flask-socketio==5.2.0 -if [ -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +#venv +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + + pip3 install gunicorn==20.1.0 + pip3 install gevent==21.1.2 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + pip3 install flask-socketio==5.2.0 + pip3 install psutil==5.9.1 + pip3 install pymongo fi -pip install --upgrade pip -pip3 install gunicorn==20.1.0 -pip3 install gevent==21.1.2 -pip3 install gevent-websocket==0.10.1 -pip3 install requests==2.20.0 -pip3 install flask-caching==1.10.1 -pip3 install python-socketio==4.2.0 -pip3 install psutil==5.9.1 -pip3 install pymongo if [ -f /etc/init.d/mw ]; then diff --git a/scripts/update/debian.sh b/scripts/update/debian.sh index a3eb1d282..5029b36ca 100644 --- a/scripts/update/debian.sh +++ b/scripts/update/debian.sh @@ -10,24 +10,18 @@ cd /www/server/mdserver-web/scripts && bash lib.sh chmod 755 /www/server/mdserver-web/data #venv -# if [ ! -f /www/server/mdserver-web/bin/activate ];then -# cd /www/server/mdserver-web && python3 -m venv . -# fi +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . +fi if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi -if [ -f /www/server/mdserver-web/bin/activate ];then - pip install --upgrade pip - pip install --upgrade setuptools - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -fi - +pip install --upgrade pip +pip install --upgrade setuptools +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt pip3 install gunicorn==20.1.0 pip3 install gevent==21.1.2 @@ -35,9 +29,26 @@ pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 pip3 install flask-socketio==5.2.0 -pip3 install psutil pip3 install pymongo +pip3 install psutil + + +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip install --upgrade setuptools + pip3 install gunicorn==20.1.0 + pip3 install gevent==21.1.2 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + pip3 install flask-socketio==5.2.0 + pip3 install pymongo + pip3 install psutil +fi if [ -f /etc/init.d/mw ];then sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw diff --git a/scripts/update/rocky.sh b/scripts/update/rocky.sh index bca02d51a..71c725bc0 100755 --- a/scripts/update/rocky.sh +++ b/scripts/update/rocky.sh @@ -27,23 +27,23 @@ if [ ! -f /www/server/mdserver-web/bin/activate ];then cd /www/server/mdserver-web && python3 -m venv . fi +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -if [ -f /www/server/mdserver-web/bin/activate ];then - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip3 install gunicorn==20.1.0 + pip3 install gevent==21.1.2 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + pip3 install python-socketio==4.2.0 + pip3 install psutil==5.9.1 + pip3 install pymongo fi -pip install --upgrade pip -pip3 install gunicorn==20.1.0 -pip3 install gevent==21.1.2 -pip3 install gevent-websocket==0.10.1 -pip3 install requests==2.20.0 -pip3 install flask-caching==1.10.1 -pip3 install python-socketio==4.2.0 -pip3 install psutil==5.9.1 -pip3 install pymongo - if [ -f /etc/init.d/mw ]; then sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw diff --git a/scripts/update/ubuntu.sh b/scripts/update/ubuntu.sh index 1fb1bf7cc..fe9654068 100644 --- a/scripts/update/ubuntu.sh +++ b/scripts/update/ubuntu.sh @@ -13,34 +13,11 @@ if [ ! -f /usr/local/bin/pip3 ];then python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple fi -# cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt - -# pip install --upgrade pip -# pip install --upgrade setuptools -# pip3 install gunicorn==20.1.0 -# pip3 install gevent==21.1.2 -# pip3 install gevent-websocket==0.10.1 -# pip3 install requests==2.20.0 -# pip3 install flask-caching==1.10.1 -# pip3 install flask-socketio==5.2.0 -# pip3 install flask-session==0.3.2 -# pip3 install pymongo -# pip3 install psutil - -#venv -# if [ ! -f /www/server/mdserver-web/bin/activate ];then -# cd /www/server/mdserver-web && python3 -m venv . -# fi - -if [ -f /www/server/mdserver-web/bin/activate ];then - pip install --upgrade pip - cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt -else - cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -fi - +pip install --upgrade pip +cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt +pip install --upgrade setuptools pip3 install gunicorn==20.1.0 -pip3 install gevent==20.9.0 +pip3 install gevent==21.1.2 pip3 install gevent-websocket==0.10.1 pip3 install requests==2.20.0 pip3 install flask-caching==1.10.1 @@ -49,6 +26,28 @@ pip3 install flask-session==0.3.2 pip3 install pymongo pip3 install psutil + +if [ ! -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && python3 -m venv . +fi + +if [ -f /www/server/mdserver-web/bin/activate ];then + cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate + pip install --upgrade pip + pip3 install -r /www/server/mdserver-web/requirements.txt + pip3 install gunicorn==20.1.0 + pip3 install gevent==20.9.0 + pip3 install gevent-websocket==0.10.1 + pip3 install requests==2.20.0 + pip3 install flask-caching==1.10.1 + #ubuntu 20 need + pip3 install flask-socketio==5.2.0 + pip3 install flask-session==0.3.2 + pip3 install pymongo + pip3 install psutil +fi + + if [ -f /etc/init.d/mw ];then sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw fi diff --git a/scripts/update_cn.sh b/scripts/update_cn.sh index 76cf4ac30..095210cbc 100755 --- a/scripts/update_cn.sh +++ b/scripts/update_cn.sh @@ -1,7 +1,7 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -LANG=en_US.UTF-8 +# LANG=en_US.UTF-8 is64bit=`getconf LONG_BIT` startTime=`date +%s` diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh index 35285da74..5852e81c6 100755 --- a/scripts/update_dev.sh +++ b/scripts/update_dev.sh @@ -1,7 +1,7 @@ #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH -LANG=en_US.UTF-8 +# LANG=en_US.UTF-8 is64bit=`getconf LONG_BIT` startTime=`date +%s` @@ -52,7 +52,7 @@ rm -rf /tmp/mdserver-web-dev #pip uninstall public echo "use system version: ${OSNAME}" -curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update/${OSNAME}.sh | bash +curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update/${OSNAME}.sh | bash endTime=`date +%s` ((outTime=($endTime-$startTime)/60))