mdserver-web/scripts/install/freebsd.sh

95 lines
2.5 KiB
Bash
Raw Normal View History

2022-07-04 06:56:13 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
2022-07-04 10:49:04 -04:00
if grep -Eq "FreeBSD" /etc/*-release && [ ! -f /bin/bash ]; then
ln -sf /usr/local/bin/bash /bin/bash
fi
2022-07-04 07:13:22 -04:00
pkg update -y
2022-07-04 06:56:13 -04:00
pkg install -y python3
2022-07-04 07:14:18 -04:00
python3 -m ensurepip
2022-07-04 07:16:10 -04:00
pip3 install --upgrade setuptools
2022-07-04 07:32:28 -04:00
python3 -m pip install --upgrade pip
2022-07-04 07:17:56 -04:00
pkg install -y lsof
2022-07-04 07:23:56 -04:00
pkg install -y sqlite3
2022-07-04 08:35:41 -04:00
pkg install -y py38-sqlite3
2022-07-04 08:48:14 -04:00
pkg install -y py38-mysqlclient
2022-07-04 11:29:32 -04:00
pkg install -y py38-cffi
2022-07-04 07:55:13 -04:00
2022-07-04 07:30:22 -04:00
pkg install -y gcc
pkg install -y autoconf
2022-07-04 09:11:22 -04:00
pkg install -y make
pkg install -y gmake
pkg install -y cmake
2022-07-04 07:55:13 -04:00
pkg install -y libxslt
2022-07-04 08:35:41 -04:00
pkg install -y libunwind
2022-07-04 10:21:27 -04:00
pkg install -y influxpkg-config
2022-08-11 07:38:43 -04:00
pkg install -y expect
2022-07-04 06:56:13 -04:00
2022-07-04 09:11:22 -04:00
pkg install -y pcre
pkg install -y webp
2022-07-04 10:21:27 -04:00
pkg install -y freetype
pkg install -y oniguruma
pkg install -y brotli
pkg install -y harfbuzz
2022-07-04 09:11:22 -04:00
2022-07-04 11:29:32 -04:00
# pkg install -y py38-cffi
2022-07-04 08:45:38 -04:00
2022-07-04 06:56:13 -04:00
2022-07-04 07:06:57 -04:00
pkg autoremove -y
2022-07-04 06:56:13 -04:00
#https need
if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
fi
2022-12-09 08:50:36 -05:00
if [ -f /usr/sbin/iptables ];then
2022-07-04 06:56:13 -04:00
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
2022-10-01 05:58:51 -04:00
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
2022-07-04 06:56:13 -04:00
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
# 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
#安装时不开启
service iptables stop
fi
2022-12-09 08:50:36 -05:00
if [ ! -f /usr/sbin/iptables ];then
2022-07-04 07:10:47 -04:00
pkg install -y firewalld
2022-07-04 06:56:13 -04:00
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
2022-10-01 05:58:51 -04:00
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
2022-07-04 06:56:13 -04:00
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
firewall-cmd --reload
#安装时不开启
systemctl stop firewalld
fi
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data