Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/scripts/install/centos.sh

145 lines
4.2 KiB

7 years ago
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
3 years ago
export PATH
7 years ago
LANG=en_US.UTF-8
6 years ago
if [ ! -f /usr/bin/applydeltarpm ];then
yum -y provides '*/applydeltarpm'
yum -y install deltarpm
fi
7 years ago
setenforce 0
6 years ago
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
6 years ago
3 years ago
yum install -y wget lsof crontabs
3 years ago
yum install -y python3-devel
3 years ago
yum install -y python-devel
3 years ago
yum install -y vixie-cron
3 years ago
yum install -y curl-devel libmcrypt libmcrypt-devel
3 years ago
#https need
3 years ago
if [ ! -d /root/.acme.sh ];then
3 years ago
curl https://get.acme.sh | sh
fi
3 years ago
if [ -f /etc/init.d/iptables ];then
6 years ago
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
6 years ago
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
5 years ago
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
3 years ago
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
6 years ago
service iptables save
iptables_status=`service iptables status | grep 'not running'`
if [ "${iptables_status}" == '' ];then
service iptables restart
fi
3 years ago
#安装时不开启
service iptables stop
6 years ago
fi
3 years ago
3 years ago
if [ ! -f /etc/init.d/iptables ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld
3 years ago
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
3 years ago
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
3 years ago
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
3 years ago
firewall-cmd --reload
fi
6 years ago
3 years ago
3 years ago
#安装时不开启
systemctl stop firewalld
3 years ago
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
3 years ago
yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip
3 years ago
yum install -y python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev pcre pcre-devel
3 years ago
yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel
3 years ago
yum install -y lsof net-tools
yum install -y ncurses-devel mysql-devel cmake
yum install -y MySQL-python
6 years ago
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
3 years ago
# echo "start install lib"
3 years ago
cd /www/server/mdserver-web/scripts && bash lib.sh
3 years ago
# echo "end install lib"
3 years ago
chmod 755 /www/server/mdserver-web/data
3 years ago
3 years ago
# echo "start install python lib"
3 years ago
3 years ago
pip install --upgrade pip
3 years ago
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
3 years ago
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
3 years ago
3 years ago
# echo "start install python env lib"
3 years ago
3 years ago
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
3 years ago
pip3 install -r /www/server/mdserver-web/requirements.txt
3 years ago
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
3 years ago
pip3 install flask-session==0.3.2
pip3 install flask-sqlalchemy==2.3.2
3 years ago
pip3 install python-socketio==4.2.0
pip3 install psutil==5.9.1
pip3 install pymongo
4 years ago
fi
3 years ago
3 years ago
# echo "end install python env lib"
# echo "end install python lib"
3 years ago
3 years ago
cd /www/server/mdserver-web && ./cli.sh start
sleep 5
6 years ago
6 years ago
cd /www/server/mdserver-web && ./cli.sh stop
cd /www/server/mdserver-web && ./scripts/init.d/mw default
6 years ago
cd /www/server/mdserver-web && ./cli.sh start