Merge pull request #291 from hiCasper/dev

安装脚本等优化
pull/310/head
Mr Chen 2 years ago committed by GitHub
commit 589dfe6da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      class/core/firewall_api.py
  2. 1
      requirements.txt
  3. 4
      route/__init__.py
  4. 8
      scripts/install.sh
  5. 4
      scripts/install/alma.sh
  6. 4
      scripts/install/amazon.sh
  7. 4
      scripts/install/arch.sh
  8. 4
      scripts/install/centos.sh
  9. 192
      scripts/install/debian.sh
  10. 4
      scripts/install/fedora.sh
  11. 4
      scripts/install/freebsd.sh
  12. 4
      scripts/install/opensuse.sh
  13. 107
      scripts/install/rhel.sh
  14. 4
      scripts/install/rocky.sh
  15. 8
      scripts/install_dev.sh
  16. 28
      scripts/lib.sh

@ -352,8 +352,8 @@ class firewall_api:
elif self.__isMac:
pass
else:
mw.execShell('/etc/init.d/iptables save')
mw.execShell('/etc/init.d/iptables stop')
mw.execShell('service iptables save')
mw.execShell('service iptables stop')
else:
if self.__isUfw:
mw.execShell("echo 'y'| ufw enable")
@ -363,8 +363,8 @@ class firewall_api:
elif self.__isMac:
pass
else:
mw.execShell('/etc/init.d/iptables save')
mw.execShell('/etc/init.d/iptables restart')
mw.execShell('service iptables save')
mw.execShell('service iptables restart')
return mw.returnData(True, '设置成功!')
@ -437,8 +437,8 @@ class firewall_api:
elif self.__isMac:
pass
else:
mw.execShell('/etc/init.d/iptables save')
mw.execShell('/etc/init.d/iptables restart')
mw.execShell('service iptables save')
mw.execShell('service iptables restart')
def getFwStatus(self):
if self.__isUfw:

@ -27,3 +27,4 @@ Jinja2>=2.11.2
flask-caching>=1.10.1
bcrypt==3.1.3
PyMySQL==1.0.2
whitenoise==5.3.0

@ -27,6 +27,8 @@ from flask import render_template_string, abort
from flask_caching import Cache
from flask_session import Session
from whitenoise import WhiteNoise
sys.path.append(os.getcwd() + "/class/core")
import db
@ -36,6 +38,8 @@ import config_api
app = Flask(__name__, template_folder='templates/default')
app.config.version = config_api.config_api().getVersion()
app.wsgi_app = WhiteNoise(app.wsgi_app, root="route/static/", prefix="static/", max_age=604800)
cache = Cache(config={'CACHE_TYPE': 'simple'})
cache.init_app(app, config={'CACHE_TYPE': 'simple'})

@ -28,16 +28,16 @@ elif grep -Eq "openSUSE" /etc/*-release; then
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
OSNAME='rhel'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
OSNAME='rhel'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
OSNAME='rhel'
yum install -y wget zip unzip
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
OSNAME='amazon'
@ -48,7 +48,7 @@ elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
OSNAME='debian'
apt install -y wget zip unzip
else
OSNAME='unknow'

@ -20,7 +20,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -41,7 +41,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld

@ -28,7 +28,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -49,7 +49,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
#取消服务锁定

@ -59,7 +59,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -80,7 +80,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
echo y | pacman -Sy firewalld
systemctl enable firewalld
systemctl start firewalld

@ -29,7 +29,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -50,7 +50,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
#取消服务锁定

@ -2,19 +2,17 @@
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
export LANG=en_US.UTF-8
export DEBIAN_FRONTEND=noninteractive
# RED='\e[1;31m' # 红色
# GREEN='\e[1;32m' # 绿色
# YELLOW='\e[1;33m' # 黄色
# BLUE='\e[1;34m' # 蓝色
# PURPLE='\e[1;35m' # 紫色
# CYAN='\e[1;36m' # 蓝绿色
# WHITE='\e[1;37m' # 白色
# NC='\e[0m' # 没有颜色
if grep -Eq "Debian" /etc/*-release; then
ln -sf /bin/bash /bin/sh
DISTRO=''
if grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
DISTRO='debian'
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
DISTRO='ubuntu'
fi
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
ln -sf /bin/bash /bin/sh
__GET_BIT=`getconf LONG_BIT`
if [ "$__GET_BIT" == "32" ];then
@ -27,22 +25,13 @@ fi
apt-get install ntpdate -y
ntpdate time.nist.gov | logger -t NTP
apt update -y
apt-get update -y
apt install -y wget curl lsof unzip
apt install -y python3-pip
apt install -y python3-dev
apt install -y python3-venv
apt install -y cron
apt install -y expect
apt install -y locate
apt-get update -y
apt install -y wget curl lsof unzip cron expect locate
apt install -y python3-pip python3-dev python3-venv
locale-gen en_US.UTF-8
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
if [ ! -d /root/.acme.sh ];then
if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
@ -59,12 +48,9 @@ if [ -f /usr/sbin/ufw ];then
fi
if [ -f /usr/sbin/ufw ];then
ufw disable
fi
if [ ! -f /usr/sbin/ufw ];then
apt install -y firewalld
systemctl enable firewalld
@ -88,92 +74,63 @@ fi
#安装时不开启
systemctl stop firewalld
#fix zlib1g-dev fail
echo -e "\e[0;32mfix zlib1g-dev install question start\e[0m"
Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt
apt install -y zlib1g-dev > ${Install_TmpFile}
if [ "$?" != "0" ];then
ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
# echo "1${ZLIB1G_BASE_VER}1"
echo -e "\e[1;31mapt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m"
echo "Y" | apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev
fi
rm -rf ${Install_TmpFile}
echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m"
#fix libunwind-dev fail
echo -e "\e[0;32mfix libunwind-dev install question start\e[0m"
Install_TmpFile=/tmp/debian-fix-libunwind-dev.txt
apt install -y libunwind-dev > ${Install_TmpFile}
if [ "$?" != "0" ];then
liblzma5_BASE_VER=$(cat ${Install_TmpFile} | grep liblzma-dev | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
liblzma5_BASE_VER=`echo ${liblzma5_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
echo -e "\e[1;31mapt install liblzma5=${liblzma5_BASE_VER} libunwind-dev\e[0m"
echo "Y" | apt install liblzma5=${liblzma5_BASE_VER} libunwind-dev
if [ "$DISTRO" == 'debian' ]; then
#fix zlib1g-dev fail
echo -e "\e[0;32mfix zlib1g-dev install question start\e[0m"
Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt
apt install -y zlib1g-dev > ${Install_TmpFile}
if [ "$?" != "0" ];then
ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
# echo "1${ZLIB1G_BASE_VER}1"
echo -e "\e[1;31mapt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m"
echo "Y" | apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev
fi
rm -rf ${Install_TmpFile}
echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m"
#fix libunwind-dev fail
echo -e "\e[0;32mfix libunwind-dev install question start\e[0m"
Install_TmpFile=/tmp/debian-fix-libunwind-dev.txt
apt install -y libunwind-dev > ${Install_TmpFile}
if [ "$?" != "0" ];then
liblzma5_BASE_VER=$(cat ${Install_TmpFile} | grep liblzma-dev | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
liblzma5_BASE_VER=`echo ${liblzma5_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
echo -e "\e[1;31mapt install liblzma5=${liblzma5_BASE_VER} libunwind-dev\e[0m"
echo "Y" | apt install liblzma5=${liblzma5_BASE_VER} libunwind-dev
fi
rm -rf ${Install_TmpFile}
echo -e "\e[0;32mfix libunwind-dev install question end\e[0m"
apt install -y libvpx-dev
apt install -y libxpm-dev
apt install -y libwebp-dev
apt install -y libfreetype6-dev
localedef -i en_US -f UTF-8 en_US.UTF-8
if [ "$VERSION_ID" == "9" ];then
sed "s/flask==2.0.3/flask==1.1.1/g" -i /www/server/mdserver-web/requirements.txt
sed "s/cryptography==3.3.2/cryptography==2.5/g" -i /www/server/mdserver-web/requirements.txt
sed "s/configparser==5.2.0/configparser==4.0.2/g" -i /www/server/mdserver-web/requirements.txt
sed "s/flask-socketio==5.2.0/flask-socketio==4.2.0/g" -i /www/server/mdserver-web/requirements.txt
sed "s/python-engineio==4.3.2/python-engineio==3.9.0/g" -i /www/server/mdserver-web/requirements.txt
# pip3 install -r /www/server/mdserver-web/requirements.txt
fi
fi
rm -rf ${Install_TmpFile}
echo -e "\e[0;32mfix libunwind-dev install question end\e[0m"
apt install -y build-essential devscripts
apt install -y libvpx-dev
apt install -y libxpm-dev
apt install -y libwebp-dev
apt install -y libfreetype6-dev
apt install --ignore-missing -y autoconf automake cmake curl dia gcc imagemagick libbz2-dev libcurl4-gnutls-dev\
libcurl4-openssl-dev libevent-dev libffi-dev libfreetype6 libfreetype6-dev libgmp-dev libgmp3-dev libicu-dev \
libjpeg-dev libjpeg62-turbo-dev libldap2-dev libmagickwand-dev libmcrypt-dev libmemcached-dev libncurses5-dev \
libpcre3 libpcre3-dev libpng-dev libpspell-dev libreadline-dev librecode-dev libsasl2-dev libssl-dev \
libunwind-dev libwebp-dev libxml2 libxml2-dev libxpm-dev libzip-dev lzma lzma-dev make net-tools openssl \
pkg-config python3-dev scons webp zlib1g-dev
sudo localedef -i en_US -f UTF-8 en_US.UTF-8
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
if [ "$VERSION_ID" == "9" ];then
sed "s/flask==2.0.3/flask==1.1.1/g" -i /www/server/mdserver-web/requirements.txt
sed "s/cryptography==3.3.2/cryptography==2.5/g" -i /www/server/mdserver-web/requirements.txt
sed "s/configparser==5.2.0/configparser==4.0.2/g" -i /www/server/mdserver-web/requirements.txt
sed "s/flask-socketio==5.2.0/flask-socketio==4.2.0/g" -i /www/server/mdserver-web/requirements.txt
sed "s/python-engineio==4.3.2/python-engineio==3.9.0/g" -i /www/server/mdserver-web/requirements.txt
# pip3 install -r /www/server/mdserver-web/requirements.txt
fi
apt install -y devscripts
apt install -y net-tools
apt install -y python3-dev
apt install -y autoconf
apt install -y gcc
apt install -y libffi-dev
apt install -y cmake automake make
apt install -y webp scons
apt install -y libwebp-dev
apt install -y lzma lzma-dev
apt install -y libunwind-dev
apt install -y libpcre3 libpcre3-dev
apt install -y openssl
apt install -y libssl-dev
apt install -y libmemcached-dev
apt install -y libsasl2-dev
apt install -y imagemagick
apt install -y libmagickwand-dev
apt install -y libxml2 libxml2-dev libbz2-dev libmcrypt-dev libpspell-dev librecode-dev
apt install -y libgmp-dev libgmp3-dev libreadline-dev libxpm-dev
apt install -y dia pkg-config
apt install -y zlib1g-dev
apt install -y libjpeg-dev libpng-dev
apt install -y libfreetype6
apt install -y libjpeg62-turbo-dev
apt install -y libfreetype6-dev
apt install -y libevent-dev libncurses5-dev libldap2-dev
apt install -y libzip-dev
apt install -y libicu-dev
apt install -y build-essential
apt install -y libcurl4-openssl-dev
apt install -y curl libcurl4-gnutls-dev
#https://blog.csdn.net/qq_36228377/article/details/123154344
# ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
if [ ! -d /usr/include/curl ];then
@ -181,18 +138,17 @@ if [ ! -d /usr/include/curl ];then
fi
apt install -y graphviz bison re2c flex
apt install -y libsqlite3-dev
apt install -y libonig-dev
apt install -y perl g++ libtool
apt install -y libxslt1-dev
apt install -y graphviz bison re2c flex libsqlite3-dev libonig-dev perl g++ libtool libxslt1-dev
apt install -y libmariadb-dev libmariadb-dev-compat
apt install -y libmariadb-dev
#apt install -y libmysqlclient-dev
apt install -y libmariadb-dev-compat
#apt install -y libmysqlclient-dev
#apt install -y libmariadbclient-dev
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
if [ "$DISTRO" == 'ubuntu' ] && [ "${VERSION_ID}" == "22.04" ]; then
apt install -y patchelf
apt install -y python3-cffi
pip3 install -U --force-reinstall --no-binary :all: gevent
fi

@ -23,7 +23,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -46,7 +46,7 @@ fi
if [ "${isVersion}" == '' ];then
if [ ! -f "/etc/init.d/iptables" ];then
if [ ! -f "/usr/sbin/iptables" ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld

@ -45,7 +45,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -66,7 +66,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
pkg install -y firewalld
systemctl enable firewalld
systemctl start firewalld

@ -56,7 +56,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -77,7 +77,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
zypper install -y firewalld
systemctl enable firewalld
systemctl start firewalld

@ -0,0 +1,107 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=C.UTF-8
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
VERSION_ID=`grep -o -i 'release *[[:digit:]]\+\.*' /etc/redhat-release | grep -o '[[:digit:]]\+' `
isStream=$(grep -o -i 'stream' /etc/redhat-release)
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
# CentOS Stream
if [ ! -z "$stream" ];then
yum install -y dnf dnf-plugins-core
dnf upgrade -y libmodulemd
fi
PKGMGR='yum'
if [ $VERSION_ID -ge 8 ];then
PKGMGR='dnf'
if [ ! -z "$cn" ];then
dnf install -y http://mirrors.cloud.tencent.com/epel/epel-release-latest-$VERSION_ID.noarch.rpm
else
dnf install -y epel-release
fi
if [ $VERSION_ID -ge 9 ];then
REPOS='--enablerepo=appstream,baseos,epel,extras,crb'
else
REPOS='--enablerepo=appstream,baseos,epel,extras,powertools'
fi
dnf $REPOS makecache
dnf groupinstall -y "Development Tools"
dnf $REPOS install -y --allowerasing --skip-broken autoconf bzip2 bzip2-devel c-ares-devel \
ca-certificates cairo-devel cmake crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel \
expat-devel expect file flex gcc gcc-c++ gd gd-devel gettext gettext-devel glib2 glib2-devel glibc.i686 \
gmp-devel kernel-devel libXpm-devel libaio-devel libcap libcurl libcurl-devel libevent libevent-devel \
libicu-devel libidn libidn-devel libmcrypt libmcrypt-devel libmemcached libmemcached-devel \
libpng libpng-devel libstdc++.so.6 libtirpc libtirpc-devel libtool libtool-libs libwebp libwebp-devel \
libxml2 libxml2-devel libxslt libxslt-devel lsof make mysql-devel ncurses ncurses-devel net-tools \
oniguruma oniguruma-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel procps psmisc python3-devel \
readline-devel rpcgen sqlite-devel tar unzip vim-minimal wget zip zlib zlib-devel
else
# CentOS 7
yum makecache
yum groupinstall -y "Development Tools"
yum install -y --skip-broken autoconf bison bzip2 bzip2-devel c-ares-devel ca-certificates cairo-devel \
cmake cmake3 crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel expat-devel expect file \
flex freetype freetype-devel gcc gcc-c++ gd gd-devel gettext gettext-devel git-core glib2 glib2-devel \
glibc.i686 gmp-devel graphviz icu kernel-devel libXpm-devel libaio-devel libcap libcurl libcurl-devel \
libevent libevent-devel libicu-devel libidn libidn-devel libjpeg-devel libmcrypt libmcrypt-devel \
libmemcached libmemcached-devel libpng-devel libstdc++.so.6 libtirpc libtirpc-devel libtool libtool-libs \
libwebp libwebp-devel libxml2 libxml2-devel libxslt libxslt-devel libzip libzip-devel libzstd-devel lsof \
make mysql-devel ncurses ncurses-devel net-tools oniguruma oniguruma-devel openldap openldap-devel \
openssl openssl-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel psmisc python-devel \
python3-devel python3-pip re2c readline-devel rpcgen sqlite-devel tar unzip vim-minimal vixie-cron \
wget zip zlib zlib-devel ImageMagick ImageMagick-devel
fi
#https need
if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /usr/sbin/iptables ];then
$PKGMGR install -y iptables-services
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
service iptables save
iptables_status=`service iptables status | grep 'not running'`
if [ "${iptables_status}" == '' ];then
service iptables restart
fi
#安装时不开启
service iptables stop
fi
if [ ! -f /usr/sbin/iptables ];then
$PKGMGR install firewalld -y
systemctl enable firewalld
systemctl start firewalld
firewall-cmd --permanent --zone=public --add-port=22/tcp
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=443/tcp
firewall-cmd --permanent --zone=public --add-port=888/tcp
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
firewall-cmd --reload
#安装时不开启
systemctl stop firewalld
fi
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data

@ -24,7 +24,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
if [ -f /etc/init.d/iptables ];then
if [ -f /usr/sbin/iptables ];then
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
@ -45,7 +45,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld

@ -27,16 +27,16 @@ elif grep -Eq "openSUSE" /etc/*-release; then
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
OSNAME='rhel'
yum install -y wget zip unzip
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
yum install -y wget zip unzip
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
OSNAME='rhel'
yum install -y wget zip unzip
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
OSNAME='rhel'
yum install -y wget zip unzip
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
OSNAME='amazon'
@ -47,7 +47,7 @@ elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
OSNAME='debian'
apt install -y wget zip unzip
else
OSNAME='unknow'

@ -47,24 +47,24 @@ else
echo "OK"
fi
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
PIPSRC="https://pypi.python.org/simple"
if [ ! -z "$cn" ];then
PIPSRC="https://pypi.tuna.tsinghua.edu.cn/simple"
fi
#面板需要的库
if [ ! -f /usr/local/bin/pip3 ];then
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
if [ ! -z "$cn" ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
else
python3 -m pip install --upgrade pip setuptools wheel -i https://pypi.python.org/pypi
fi
if [ ! -f /usr/local/bin/pip3 ] && [ ! -f /usr/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i $PIPSRC
fi
which pip && pip install --upgrade pip
pip3 install --upgrade setuptools
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
which pip && pip install --upgrade pip -i $PIPSRC
pip3 install --upgrade setuptools -i $PIPSRC
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC
# pip3 install flask-caching==1.10.1
# pip3 install mysqlclient
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
@ -72,9 +72,9 @@ else
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
fi
pip install --upgrade pip
pip3 install --upgrade setuptools
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
pip install --upgrade pip -i $PIPSRC
pip3 install --upgrade setuptools -i $PIPSRC
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC
echo "lib ok!"
# pip3 install flask-caching==1.10.1

Loading…
Cancel
Save