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/ubuntu.sh

96 lines
2.3 KiB

3 years ago
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
3 years ago
3 years ago
3 years ago
mkdir -p /www/server
mkdir -p /www/wwwroot
mkdir -p /www/wwwlogs
mkdir -p /www/backup/database
mkdir -p /www/backup/site
3 years ago
apt update -y
3 years ago
3 years ago
apt install -y wget curl lsof iptables unzip
3 years ago
apt install -y python3-pip
apt install -y python3-venv
3 years ago
3 years ago
apt install -y cron
3 years ago
3 years ago
if [ ! -d /root/.acme.sh ];then
3 years ago
curl https://get.acme.sh | sh
fi
3 years ago
if [ -f /usr/sbin/ufw ];then
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 888/tcp
ufw allow 7200/tcp
ufw allow 3306/tcp
ufw allow 30000:40000/tcp
3 years ago
3 years ago
fi
3 years ago
3 years ago
ufw disable
if [ ! -f /usr/sbin/ufw ];then
apt install -y firewalld
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
firewall-cmd --reload
3 years ago
fi
3 years ago
#安装时不开启
3 years ago
systemctl stop firewalld
3 years ago
3 years ago
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
3 years ago
3 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
pip3 install gevent flask gunicorn flask_caching flask_session
3 years ago
pip3 install flask_socketio gevent-websocket psutil pymongo
3 years ago
cd /www/server/mdserver-web/scripts && ./lib.sh
chmod 755 /www/server/mdserver-web/data
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
cd /www/server/mdserver-web && ./cli.sh start
sleep 5
cd /www/server/mdserver-web && ./cli.sh stop
cd /www/server/mdserver-web && ./scripts/init.d/mw default
cd /www/server/mdserver-web && ./cli.sh start
3 years ago
systemctl daemon-reload