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

132 lines
3.9 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
mkdir -p /www/server
mkdir -p /www/wwwroot
mkdir -p /www/wwwlogs
mkdir -p /www/backup/database
mkdir -p /www/backup/site
7 years ago
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
#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
6 years ago
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
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
firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
firewall-cmd --reload
fi
6 years ago
3 years ago
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
3 years ago
3 years ago
systemctl restart firewalld
#安装时不开启
systemctl stop firewalld
3 years ago
yum groupinstall -y "Development Tools"
6 years ago
3 years ago
yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel
3 years ago
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
3 years ago
yum install -y lsof net-tools
yum install -y ncurses-devel mysql-devel cmake
yum install -y MySQL-python
yum install -y epel-release
6 years ago
if [ ! -d /www/server/mdserver-web ];then
6 years ago
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
3 years ago
fi
6 years ago
4 years ago
#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
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
cd /www/server/mdserver-web/scripts && bash lib.sh
6 years ago
chmod 755 /www/server/mdserver-web/data
4 years ago
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
3 years ago
3 years ago
pip install --upgrade pip
3 years ago
pip3 install gunicorn==20.1.0
3 years ago
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
3 years ago
pip3 install requests==2.20.0
3 years ago
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
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