mdserver-web/scripts/install_centos.sh

106 lines
3.2 KiB
Bash
Raw Permalink Normal View History

2018-12-10 06:37:38 -05:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
2019-03-04 21:04:05 -05:00
mkdir -p /www/server
mkdir -p /www/wwwroot
mkdir -p /www/wwwlogs
mkdir -p /www/backup/database
mkdir -p /www/backup/site
2018-12-10 06:37:38 -05:00
2019-02-02 09:14:57 -05:00
2019-03-04 21:04:05 -05:00
if [ ! -f /usr/bin/applydeltarpm ];then
yum -y provides '*/applydeltarpm'
yum -y install deltarpm
fi
2018-12-10 06:37:38 -05:00
2019-04-02 04:46:46 -04:00
setenforce 0
2019-09-13 12:26:03 -04:00
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
2019-04-02 04:42:44 -04:00
2020-07-11 10:07:35 -04:00
yum install -y wget curl vixie-cron lsof
2019-03-04 23:59:37 -05:00
#https need
2019-07-31 05:34:32 -04:00
if [ ! -f /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
2019-02-02 06:38:16 -05:00
2019-03-04 21:04:05 -05:00
if [ -f "/etc/init.d/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
2020-06-11 11:39:31 -04:00
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
2019-03-04 21:04:05 -05:00
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
2020-07-14 21:40:02 -04:00
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
2019-03-04 21:04:05 -05:00
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
fi
2019-05-18 02:35:40 -04:00
#安装时不开启
service iptables stop
2019-03-04 21:04:05 -05:00
if [ "${isVersion}" == '' ];then
if [ ! -f "/etc/init.d/iptables" ];then
yum 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
2020-06-11 11:39:31 -04:00
firewall-cmd --permanent --zone=public --add-port=443/tcp
2019-03-04 21:04:05 -05:00
firewall-cmd --permanent --zone=public --add-port=888/tcp
firewall-cmd --permanent --zone=public --add-port=7200/tcp
2020-07-14 21:40:02 -04:00
firewall-cmd --permanent --zone=public --add-port=3306/tcp
2019-03-04 21:04:05 -05:00
firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
firewall-cmd --reload
fi
fi
2019-05-18 02:34:38 -04:00
#安装时不开启
2019-05-18 02:34:56 -04:00
systemctl stop firewalld
2019-05-18 02:34:38 -04:00
2019-03-04 21:04:05 -05:00
2021-04-21 16:08:30 -04:00
yum install -y libevent libevent-devel mysql-devel libjpeg* libpng* gd* zip unzip libmcrypt libmcrypt-devel
2019-03-04 21:04:05 -05:00
2020-07-09 08:05:14 -04:00
if [ ! -d /www/server/mdserver-web ];then
2019-03-04 21:04:05 -05:00
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
2019-03-13 00:57:29 -04:00
fi
2019-03-04 21:04:05 -05:00
yum groupinstall -y "Development Tools"
2020-07-11 11:02:03 -04:00
paces="wget python-devel python-imaging libicu-devel zip unzip bzip2-devel gcc libxml2 libxml2-dev libxslt* libjpeg-devel libpng-devel libwebp libwebp-devel lsof pcre pcre-devel vixie-cron crontabs"
2019-03-04 21:04:05 -05:00
yum -y install $paces
yum -y lsof net-tools.x86_64
yum -y install ncurses-devel mysql-dev locate cmake
2020-07-09 06:54:16 -04:00
yum -y install python-devel.x86_64
2020-07-09 07:26:34 -04:00
yum -y install MySQL-python
2019-03-04 21:04:05 -05:00
yum -y install epel-release
if [ ! -f '/usr/bin/pip' ];then
2021-04-30 06:02:09 -04:00
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
2019-03-04 21:04:05 -05:00
python get-pip.py
pip install --upgrade pip
fi
2019-10-02 13:58:24 -04:00
cd /www/server/mdserver-web/scripts && ./lib.sh
2019-03-04 21:04:05 -05:00
2019-02-02 05:01:34 -05:00
pip install -r /www/server/mdserver-web/requirements.txt
cd /www/server/mdserver-web && ./cli.sh start
sleep 5
2019-03-04 21:04:05 -05:00
2019-03-13 05:19:33 -04:00
cd /www/server/mdserver-web && ./cli.sh stop
2019-02-02 05:01:34 -05:00
cd /www/server/mdserver-web && ./scripts/init.d/mw default
2019-03-04 21:04:05 -05:00
cd /www/server/mdserver-web && ./cli.sh start