mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 02:29:26 +08:00
@@ -10,7 +10,7 @@
|
||||
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
@@ -103,6 +103,11 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
### 版本更新 0.16.1
|
||||
|
||||
* 给防盗链增加禁止空来源。
|
||||
* OpenResty安装兼容。
|
||||
* Debian10安装优化。
|
||||
* 安装时默认监控开启。
|
||||
* MySQL/MYSQL-YUM/MySQL-APT添加重置master功能。
|
||||
* 支持华为欧拉系统。
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ from flask import redirect
|
||||
|
||||
|
||||
def init():
|
||||
initSystemControl()
|
||||
initDB()
|
||||
initDBSshPort()
|
||||
initUserInfo()
|
||||
@@ -145,10 +146,22 @@ def initInitTask():
|
||||
api.createCertCron()
|
||||
|
||||
|
||||
def initSystemControl():
|
||||
path = 'data/default.db'
|
||||
if os.path.exists(path):
|
||||
return False
|
||||
|
||||
import system_api
|
||||
sapi = system_api.system_api()
|
||||
r = sapi.setControl(1, 30)
|
||||
print(r)
|
||||
|
||||
|
||||
def initUserInfo():
|
||||
|
||||
data = mw.M('users').where('id=?', (1,)).getField('password')
|
||||
if data == '21232f297a57a5a743894a0e4a801fc3':
|
||||
|
||||
pwd = mw.getRandomString(8).lower()
|
||||
file_pw = mw.getRunDir() + '/data/default.pl'
|
||||
mw.writeFile(file_pw, pwd)
|
||||
|
||||
@@ -27,7 +27,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.16.0'
|
||||
__version = '0.16.1'
|
||||
__api_addr = 'data/api.json'
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"ps": "Gogs是一款极易搭建的自助Git服务",
|
||||
"name": "gogs",
|
||||
"title": "Gogs",
|
||||
"versions": ["0.11.86","0.12.9"],
|
||||
"versions": ["0.11.86","0.12.9","0.13.0"],
|
||||
"tip": "soft",
|
||||
"checks": "server/gogs",
|
||||
"path":"server/gogs",
|
||||
|
||||
@@ -9,6 +9,10 @@ serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
if [ -f ${rootPath}/bin/activate ];then
|
||||
source ${rootPath}/bin/activate
|
||||
fi
|
||||
|
||||
|
||||
GOGS_DOWNLOAD='https://dl.gogs.io'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"title": "Memcached",
|
||||
"shell": "install.sh",
|
||||
"versions":["1.6"],
|
||||
"updates":["1.6.15"],
|
||||
"updates":["1.6.21"],
|
||||
"tip": "soft",
|
||||
"checks": "server/memcached",
|
||||
"path":"server/memcached",
|
||||
|
||||
@@ -1596,6 +1596,15 @@ def setDbMasterAccess():
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
def resetMaster(version=''):
|
||||
pdb = pMysqlDb()
|
||||
r = pdb.execute('reset master')
|
||||
isError = isSqlError(r)
|
||||
if isError != None:
|
||||
return isError
|
||||
return mw.returnJson(True, '重置成功!')
|
||||
|
||||
|
||||
def getMasterDbList(version=''):
|
||||
try:
|
||||
args = getArgs()
|
||||
@@ -2850,6 +2859,8 @@ if __name__ == "__main__":
|
||||
print(getDbrunMode(version))
|
||||
elif func == 'set_dbrun_mode':
|
||||
print(setDbrunMode(version))
|
||||
elif func == 'reset_master':
|
||||
print(resetMaster(version))
|
||||
elif func == 'get_masterdb_list':
|
||||
print(getMasterDbList(version))
|
||||
elif func == 'get_master_status':
|
||||
|
||||
@@ -1601,6 +1601,14 @@ function setDbMasterAccess(username){
|
||||
});
|
||||
}
|
||||
|
||||
function resetMaster(){
|
||||
myPost('reset_master', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
},{icon: rdata.status ? 1 : 2});
|
||||
},'正在执行重置master命令[reset master]');
|
||||
}
|
||||
|
||||
function getMasterRepSlaveList(){
|
||||
var _data = {};
|
||||
if (typeof(page) =='undefined'){
|
||||
@@ -2446,6 +2454,7 @@ function masterOrSlaveConf(version=''){
|
||||
<p class="conf_p">\
|
||||
<span class="f14 c6 mr20">Master[主]配置</span><span class="f14 c6 mr20"></span>\
|
||||
<button class="btn '+(!rdata.status ? 'btn-danger' : 'btn-success')+' btn-xs btn-master">'+(!rdata.status ? '未开启' : '已开启') +'</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()" >重置</button>\
|
||||
</p>\
|
||||
<hr/>\
|
||||
<!-- master list -->\
|
||||
|
||||
@@ -1577,6 +1577,15 @@ def setDbMasterAccess():
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
def resetMaster(version=''):
|
||||
pdb = pMysqlDb()
|
||||
r = pdb.execute('reset master')
|
||||
isError = isSqlError(r)
|
||||
if isError != None:
|
||||
return isError
|
||||
return mw.returnJson(True, '重置成功!')
|
||||
|
||||
|
||||
def getMasterDbList(version=''):
|
||||
try:
|
||||
args = getArgs()
|
||||
@@ -2827,6 +2836,8 @@ if __name__ == "__main__":
|
||||
print(getDbrunMode(version))
|
||||
elif func == 'set_dbrun_mode':
|
||||
print(setDbrunMode(version))
|
||||
elif func == 'reset_master':
|
||||
print(resetMaster(version))
|
||||
elif func == 'get_masterdb_list':
|
||||
print(getMasterDbList(version))
|
||||
elif func == 'get_master_status':
|
||||
|
||||
@@ -1601,6 +1601,14 @@ function setDbMasterAccess(username){
|
||||
});
|
||||
}
|
||||
|
||||
function resetMaster(){
|
||||
myPost('reset_master', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
},{icon: rdata.status ? 1 : 2});
|
||||
},'正在执行重置master命令[reset master]');
|
||||
}
|
||||
|
||||
function getMasterRepSlaveList(){
|
||||
var _data = {};
|
||||
if (typeof(page) =='undefined'){
|
||||
@@ -2446,6 +2454,7 @@ function masterOrSlaveConf(version=''){
|
||||
<p class="conf_p">\
|
||||
<span class="f14 c6 mr20">Master[主]配置</span><span class="f14 c6 mr20"></span>\
|
||||
<button class="btn '+(!rdata.status ? 'btn-danger' : 'btn-success')+' btn-xs btn-master">'+(!rdata.status ? '未开启' : '已开启') +'</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()" >重置</button>\
|
||||
</p>\
|
||||
<hr/>\
|
||||
<!-- master list -->\
|
||||
|
||||
@@ -1811,6 +1811,15 @@ def setDbMasterAccess():
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
|
||||
|
||||
def resetMaster(version=''):
|
||||
pdb = pMysqlDb()
|
||||
r = pdb.execute('reset master')
|
||||
isError = isSqlError(r)
|
||||
if isError != None:
|
||||
return isError
|
||||
return mw.returnJson(True, '重置成功!')
|
||||
|
||||
|
||||
def getMasterDbList(version=''):
|
||||
try:
|
||||
args = getArgs()
|
||||
@@ -3073,6 +3082,8 @@ if __name__ == "__main__":
|
||||
print(getDbrunMode(version))
|
||||
elif func == 'set_dbrun_mode':
|
||||
print(setDbrunMode(version))
|
||||
elif func == 'reset_master':
|
||||
print(resetMaster(version))
|
||||
elif func == 'get_masterdb_list':
|
||||
print(getMasterDbList(version))
|
||||
elif func == 'get_master_status':
|
||||
|
||||
@@ -1601,6 +1601,15 @@ function setDbMasterAccess(username){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function resetMaster(){
|
||||
myPost('reset_master', '', function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
},{icon: rdata.status ? 1 : 2});
|
||||
},'正在执行重置master命令[reset master]');
|
||||
}
|
||||
|
||||
function getMasterRepSlaveList(){
|
||||
var _data = {};
|
||||
if (typeof(page) =='undefined'){
|
||||
@@ -2446,6 +2455,7 @@ function masterOrSlaveConf(version=''){
|
||||
<p class="conf_p">\
|
||||
<span class="f14 c6 mr20">Master[主]配置</span><span class="f14 c6 mr20"></span>\
|
||||
<button class="btn '+(!rdata.status ? 'btn-danger' : 'btn-success')+' btn-xs btn-master">'+(!rdata.status ? '未开启' : '已开启') +'</button>\
|
||||
<button class="btn btn-success btn-xs" onclick="resetMaster()" >重置</button>\
|
||||
</p>\
|
||||
<hr/>\
|
||||
<!-- master list -->\
|
||||
|
||||
@@ -72,7 +72,7 @@ Install_openresty()
|
||||
|
||||
# Last Download Method
|
||||
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
|
||||
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://dl.midoks.me/soft/openresty/openresty-${VERSION}.tar.gz -T 3
|
||||
wget --no-check-certificate -O ${openrestyDir}/openresty-${VERSION}.tar.gz http://dl.midoks.me/soft/openresty/openresty-${VERSION}.tar.gz -T 3
|
||||
fi
|
||||
|
||||
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
|
||||
|
||||
@@ -13,9 +13,9 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
# 中国优化安装
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
LOCAL_ADDR=common
|
||||
if [ ! -z "$cn" ];then
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
fi
|
||||
|
||||
@@ -70,7 +70,7 @@ fi
|
||||
|
||||
ZIP_OPTION='--enable-zip'
|
||||
libzip_version=`pkg-config libzip --modversion`
|
||||
if version_lt "$libzip_version" "0.11.0" ;then
|
||||
if [ "$?" != "0" ] || version_lt "$libzip_version" "0.11.0" ;then
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash libzip.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/libzip/lib/pkgconfig
|
||||
ZIP_OPTION="--with-libzip=$serverPath/lib/libzip"
|
||||
|
||||
@@ -40,6 +40,10 @@ else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
if [ ! -d $serverPath/lib/libzip ];then
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash libzip.sh
|
||||
fi
|
||||
|
||||
export PKG_CONFIG_PATH=/www/server/lib/libzip/lib/pkgconfig
|
||||
|
||||
Install_lib()
|
||||
@@ -51,6 +55,7 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
|
||||
@@ -52,9 +52,9 @@ def send_msg(bot, tag='ad', trigger_time=300):
|
||||
|
||||
# https://t.me/gjgzs2022 | 22/m
|
||||
# 高价收量 👑 集团收量 ❤️ 流量变现/支付宝代付 ❤️ 微信代付/实名认证/过人脸🕵️♀️各种账号处理✅ | 28/m
|
||||
# https://zhaoziyuan.la/ | web | 15/m | 2m | next,9/15
|
||||
# https://zhaoziyuan.pw/ | web | 15/m | 2m | next,9/15 | @baleite
|
||||
# 腾云机场 |9/m
|
||||
# 🚀鲲鹏VPN | 13/m
|
||||
# 🚀鲲鹏VPN | 13/m | next,10/10
|
||||
keyboard = [
|
||||
[
|
||||
types.InlineKeyboardButton(
|
||||
|
||||
+5
-2
@@ -28,6 +28,9 @@ elif grep -Eqi "openSUSE" /etc/*-release; then
|
||||
zypper install cron wget curl zip unzip
|
||||
elif grep -Eqi "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eq "EulerOS" /etc/*-release || grep -Eq "openEuler" /etc/*-release; then
|
||||
OSNAME='euler'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eqi "CentOS" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
@@ -64,10 +67,10 @@ fi
|
||||
# HTTP_PREFIX="https://ghproxy.com/"
|
||||
# fi
|
||||
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
+27
-15
@@ -13,6 +13,13 @@ VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -
|
||||
setenforce 0
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
|
||||
if [ "$SSH_PORT" == "" ];then
|
||||
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
|
||||
SSH_PORT=${SSH_PORT_LINE/"Port "/""}
|
||||
fi
|
||||
echo "SSH PORT:${SSH_PORT}"
|
||||
|
||||
yum install -y wget lsof crontabs
|
||||
yum install -y python3-devel
|
||||
yum install -y python3-pip
|
||||
@@ -25,32 +32,37 @@ yum install -y mysql-devel
|
||||
yum install -y expect
|
||||
|
||||
|
||||
if [ -f /usr/sbin/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
|
||||
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
|
||||
service iptables save
|
||||
# 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
|
||||
# service iptables save
|
||||
|
||||
iptables_status=`service iptables status | grep 'not running'`
|
||||
if [ "${iptables_status}" == '' ];then
|
||||
service iptables restart
|
||||
fi
|
||||
# iptables_status=`service iptables status | grep 'not running'`
|
||||
# if [ "${iptables_status}" == '' ];then
|
||||
# service iptables restart
|
||||
# fi
|
||||
|
||||
#安装时不开启
|
||||
service iptables stop
|
||||
fi
|
||||
# #安装时不开启
|
||||
# service iptables stop
|
||||
# fi
|
||||
|
||||
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
if [ ! -f /usr/sbin/firewalld ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
#取消服务锁定
|
||||
systemctl unmask firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
firewall-cmd --permanent --zone=public --add-port=22/tcp
|
||||
if [ "$SSH_PORT" != "" ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=${SSH_PORT}/tcp
|
||||
else
|
||||
firewall-cmd --permanent --zone=public --add-port=22/tcp
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
@@ -17,6 +17,11 @@ if [ "$__GET_BIT" == "32" ];then
|
||||
apt install -y rustc
|
||||
fi
|
||||
|
||||
if [ "$VERSION_ID" == "10" ];then
|
||||
apt install -y rustc
|
||||
fi
|
||||
|
||||
|
||||
# synchronize time first
|
||||
apt-get install ntpdate -y
|
||||
NTPHOST='time.nist.gov'
|
||||
|
||||
Executable
+152
@@ -0,0 +1,152 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
if [ ! -f /usr/bin/applydeltarpm ];then
|
||||
yum -y provides '*/applydeltarpm'
|
||||
yum -y install deltarpm
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
setenforce 0
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'`
|
||||
if [ "$SSH_PORT" == "" ];then
|
||||
SSH_PORT_LINE=`cat /etc/ssh/sshd_config | grep "Port \d*" | tail -1`
|
||||
SSH_PORT=${SSH_PORT_LINE/"Port "/""}
|
||||
fi
|
||||
echo "SSH PORT:${SSH_PORT}"
|
||||
|
||||
yum install -y wget lsof crontabs
|
||||
yum install -y python3-devel
|
||||
yum install -y python3-pip
|
||||
yum install -y python-devel
|
||||
yum install -y vixie-cron
|
||||
yum install -y curl-devel
|
||||
yum install -y libmcrypt
|
||||
yum install -y libmcrypt-devel
|
||||
yum install -y mysql-devel
|
||||
yum install -y expect
|
||||
|
||||
|
||||
# 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
|
||||
# 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
|
||||
# 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/firewalld ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
#取消服务锁定
|
||||
systemctl unmask firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
if [ "$SSH_PORT" != "" ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=${SSH_PORT}/tcp
|
||||
else
|
||||
firewall-cmd --permanent --zone=public --add-port=22/tcp
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
|
||||
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
||||
firewall-cmd --reload
|
||||
#安装时不开启
|
||||
systemctl stop firewalld
|
||||
fi
|
||||
|
||||
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
|
||||
dnf upgrade -y libmodulemd
|
||||
fi
|
||||
|
||||
|
||||
yum install -y libtirpc libtirpc-devel
|
||||
yum install -y rpcgen
|
||||
yum install -y openldap openldap-devel
|
||||
yum install -y bison re2c
|
||||
yum install -y cmake3
|
||||
yum install -y autoconf
|
||||
yum install -y make cmake gcc gcc-c++
|
||||
|
||||
yum install -y libmemcached libmemcached-devel
|
||||
yum install -y curl curl-devel
|
||||
yum install -y zlib zlib-devel
|
||||
yum install -y libzip libzip-devel
|
||||
yum install -y pcre pcre-devel
|
||||
yum install -y icu libicu-devel
|
||||
yum install -y freetype freetype-devel
|
||||
yum install -y openssl openssl-devel
|
||||
yum install -y libxml2 libxml2-devel
|
||||
yum install -y graphviz
|
||||
yum install -y sqlite-devel
|
||||
yum install -y oniguruma oniguruma-devel
|
||||
yum install -y ImageMagick ImageMagick-devel
|
||||
|
||||
|
||||
yum install -y libzstd-devel
|
||||
yum install -y libevent libevent-devel unzip zip
|
||||
# yum install -y python-imaging
|
||||
yum install -y libicu-devel bzip2-devel pcre pcre-devel
|
||||
|
||||
yum install -y gd gd-devel
|
||||
yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel
|
||||
|
||||
yum install -y net-tools
|
||||
yum install -y ncurses-devel
|
||||
yum install -y libXpm-devel
|
||||
yum install -y libargon2-devel
|
||||
|
||||
|
||||
for yumPack in flex file libtool libtool-libs kernel-devel patch wget glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel libcap diffutils ca-certificates net-tools psmisc git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper expat-devel readline-devel;
|
||||
do yum -y install $yumPack;done
|
||||
|
||||
|
||||
if [ "$VERSION_ID" -eq "8" ];then
|
||||
dnf upgrade -y libmodulemd
|
||||
fi
|
||||
|
||||
if [ "$VERSION_ID" -eq "9" ];then
|
||||
yum install -y patchelf
|
||||
dnf --enablerepo=crb install -y libtirpc-devel
|
||||
dnf --enablerepo=crb install -y libmemcached libmemcached-devel
|
||||
dnf --enablerepo=crb install -y libtool libtool-libs
|
||||
dnf --enablerepo=crb install -y gnutls-devel
|
||||
dnf --enablerepo=crb install -y mysql-devel
|
||||
|
||||
dnf --enablerepo=crb install -y libvpx-devel libXpm-devel libwebp libwebp-devel
|
||||
dnf --enablerepo=crb install -y libjpeg-devel libpng-devel
|
||||
dnf --enablerepo=crb install -y oniguruma oniguruma-devel
|
||||
dnf --enablerepo=crb install -y libzip libzip-devel
|
||||
# yum remove -y chardet
|
||||
fi
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
@@ -32,6 +32,9 @@ elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
zypper refresh
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eq "EulerOS" /etc/*-release || grep -Eq "openEuler" /etc/*-release; then
|
||||
OSNAME='euler'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eqi "CentOS" /etc/*-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
@@ -68,10 +71,10 @@ fi
|
||||
# HTTP_PREFIX="https://ghproxy.com/"
|
||||
# fi
|
||||
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
+2
-3
@@ -64,11 +64,10 @@ fi
|
||||
# LOCAL_ADDR=cn
|
||||
# HTTP_PREFIX="https://ghproxy.com/"
|
||||
# fi
|
||||
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
+6
-5
@@ -25,6 +25,8 @@ if [ ${_os} == "Darwin" ]; then
|
||||
elif grep -Eqi "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
elif grep -Eq "EulerOS" /etc/*-release || grep -Eq "openEuler" /etc/*-release; then
|
||||
OSNAME='euler'
|
||||
elif grep -Eqi "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eqi "CentOS" /etc/*-release; then
|
||||
@@ -55,15 +57,14 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
ping -c 1 github.com > /dev/null 2>&1
|
||||
if [ "$?" != "0" ];then
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
echo "local:${LOCAL_ADDR}"
|
||||
|
||||
CP_CMD=/usr/bin/cp
|
||||
if [ -f /bin/cp ];then
|
||||
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
|
||||
if [ -f /etc/motd ];then
|
||||
echo "welcome to mdserver-web panel" > /etc/motd
|
||||
fi
|
||||
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
if [ -f /etc/rc.d/init.d/mw ];then
|
||||
bash /etc/rc.d/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/rc.d/init.d/mw
|
||||
fi
|
||||
|
||||
echo -e "stop mw"
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
|
||||
port=7200
|
||||
if [ -f /www/server/mdserver-web/data/port.pl ]; then
|
||||
port=$(cat /www/server/mdserver-web/data/port.pl)
|
||||
fi
|
||||
|
||||
n=0
|
||||
while [[ "$isStart" != "" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo -e "start mw"
|
||||
cd /www/server/mdserver-web && bash cli.sh start
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
n=0
|
||||
while [[ ! -f /etc/rc.d/init.d/mw ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 1
|
||||
let n+=1
|
||||
if [ $n -gt 20 ];then
|
||||
echo -e "start mw fail"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo -e "start mw success"
|
||||
@@ -25,6 +25,8 @@ if [ ${_os} == "Darwin" ]; then
|
||||
elif grep -Eqi "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
elif grep -Eq "EulerOS" /etc/*-release || grep -Eq "openEuler" /etc/*-release; then
|
||||
OSNAME='euler'
|
||||
elif grep -Eqi "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eqi "CentOS" /etc/*-release; then
|
||||
@@ -61,15 +63,15 @@ fi
|
||||
# LOCAL_ADDR=cn
|
||||
# HTTP_PREFIX="https://ghproxy.com/"
|
||||
# fi
|
||||
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
LOCAL_ADDR=common
|
||||
if [ ! -z "$cn" ];then
|
||||
cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ] || [ "$?" != "0" ] ;then
|
||||
LOCAL_ADDR=cn
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
echo "local:${LOCAL_ADDR}"
|
||||
|
||||
CP_CMD=/usr/bin/cp
|
||||
if [ -f /bin/cp ];then
|
||||
|
||||
Reference in New Issue
Block a user