mdserver-web/scripts/install/ubuntu.sh

150 lines
3.8 KiB
Bash
Raw Normal View History

2022-06-10 03:26:55 -04:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
2022-06-14 03:14:31 -04:00
export PATH
2022-10-28 23:38:08 -04:00
export LANG=en_US.UTF-8
export DEBIAN_FRONTEND=noninteractive
2022-06-10 03:26:55 -04:00
2022-07-04 12:43:46 -04:00
if grep -Eq "Ubuntu" /etc/*-release; then
2022-07-04 11:11:04 -04:00
sudo ln -sf /bin/bash /bin/sh
#sudo dpkg-reconfigure dash
fi
2022-10-28 23:38:27 -04:00
apt update -y
apt-get update -y
2022-06-10 04:12:52 -04:00
2022-06-16 09:23:38 -04:00
apt install -y wget curl lsof unzip
2022-06-10 10:12:34 -04:00
apt install -y python3-pip
apt install -y python3-venv
2022-06-22 13:26:33 -04:00
apt install -y python3-dev
2022-08-11 07:38:43 -04:00
apt install -y expect
2022-06-10 04:12:52 -04:00
2022-06-11 01:04:59 -04:00
apt install -y cron
2022-06-11 01:03:59 -04:00
2022-06-10 04:26:35 -04:00
if [ ! -d /root/.acme.sh ];then
2022-06-10 04:12:52 -04:00
curl https://get.acme.sh | sh
fi
2022-10-29 04:19:53 -04:00
apt install -y locate
locale-gen en_US.UTF-8
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
2022-06-10 04:12:52 -04:00
2022-06-12 11:21:19 -04:00
if [ -f /usr/sbin/ufw ];then
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 888/tcp
2022-10-01 05:58:51 -04:00
# ufw allow 7200/tcp
2022-06-22 23:57:42 -04:00
# ufw allow 3306/tcp
2022-06-20 12:46:07 -04:00
# ufw allow 30000:40000/tcp
2022-06-10 04:12:52 -04:00
2022-06-12 11:21:19 -04:00
fi
2022-06-10 04:18:56 -04:00
2022-06-14 11:02:34 -04:00
if [ -f /usr/sbin/ufw ];then
ufw disable
fi
2022-06-12 11:21:19 -04:00
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
2022-10-01 05:58:51 -04:00
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
2022-06-22 23:57:42 -04:00
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
2022-06-20 12:46:07 -04:00
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
2022-06-15 04:25:19 -04:00
# fix:debian10 firewalld faq
# https://kawsing.gitbook.io/opensystem/andoid-shou-ji/untitled/fang-huo-qiang#debian-10-firewalld-0.6.3-error-commandfailed-usrsbinip6tablesrestorewn-failed-ip6tablesrestore-v1.8
sed -i 's#IndividualCalls=no#IndividualCalls=yes#g' /etc/firewalld/firewalld.conf
2022-06-12 11:21:19 -04:00
firewall-cmd --reload
2022-06-10 04:18:56 -04:00
fi
2022-06-10 04:12:52 -04:00
#安装时不开启
2022-06-12 11:21:19 -04:00
systemctl stop firewalld
2022-06-10 04:12:52 -04:00
2022-06-10 04:21:11 -04:00
2022-11-03 12:25:47 -04:00
apt install -y devscripts
apt install -y net-tools
apt install -y python3-dev
apt install -y autoconf
apt install -y gcc
apt install -y libffi-dev
apt install -y cmake automake make
apt install -y webp scons
apt install -y libwebp-dev
apt install -y lzma lzma-dev
apt install -y libunwind-dev
apt install -y libpcre3 libpcre3-dev
apt install -y openssl
apt install -y libssl-dev
apt install -y libmemcached-dev
apt install -y libsasl2-dev
apt install -y imagemagick
apt install -y libmagickwand-dev
apt install -y libxml2 libxml2-dev libbz2-dev libmcrypt-dev libpspell-dev librecode-dev
apt install -y libgmp-dev libgmp3-dev libreadline-dev libxpm-dev
apt install -y dia pkg-config
apt install -y zlib1g-dev
apt install -y libjpeg-dev libpng-dev
apt install -y libfreetype6
apt install -y libjpeg62-turbo-dev
apt install -y libfreetype6-dev
apt install -y libevent-dev libncurses5-dev libldap2-dev
apt install -y libzip-dev
apt install -y libicu-dev
apt install -y build-essential
apt install -y libcurl4-openssl-dev
apt install -y curl libcurl4-gnutls-dev
#https://blog.csdn.net/qq_36228377/article/details/123154344
# ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
if [ ! -d /usr/include/curl ];then
ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
fi
apt install -y graphviz bison re2c flex
apt install -y libsqlite3-dev
apt install -y libonig-dev
apt install -y perl g++ libtool
apt install -y libxslt1-dev
apt install -y libmariadb-dev
#apt install -y libmysqlclient-dev
apt install -y libmariadb-dev-compat
#apt install -y libmariadbclient-dev
2022-06-30 13:40:02 -04:00
2022-07-01 12:03:53 -04:00
# mysql8.0 在ubuntu22需要的库
2022-07-01 12:03:42 -04:00
apt install -y patchelf
2022-06-30 13:40:02 -04:00
2022-07-01 12:03:42 -04:00
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
2022-06-30 13:40:02 -04:00
if [ "${VERSION_ID}" == "22.04" ];then
2022-10-06 01:10:44 -04:00
apt install -y python3-cffi
2022-06-30 13:40:02 -04:00
pip3 install -U --force-reinstall --no-binary :all: gevent
fi
2022-11-10 14:21:16 -05:00
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
2022-06-30 13:40:02 -04:00
if [ "${VERSION_ID}" == "22.04" ];then
2022-10-06 01:10:44 -04:00
apt install -y python3-cffi
2022-06-30 13:40:02 -04:00
pip3 install -U --force-reinstall --no-binary :all: gevent
fi