mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 12:40:25 +08:00
feat: update scripts
This commit is contained in:
@@ -206,6 +206,7 @@ server
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
access_log /www/wwwlogs/%s.log;
|
||||
error_log /www/wwwlogs/%s.log;
|
||||
}
|
||||
|
||||
290
scripts/mysql/install.sh
Normal file
290
scripts/mysql/install.sh
Normal file
@@ -0,0 +1,290 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
ARCH=$(uname -m)
|
||||
memTotal=$(LC_ALL=C free -m | grep Mem | awk '{print $2}')
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/mysql"
|
||||
setupPath="/www"
|
||||
mysqlPath="${setupPath}/server/mysql"
|
||||
mysqlVersion=""
|
||||
mysqlPassword=$(cat /dev/urandom | head -n 16 | md5sum | head -c 16)
|
||||
|
||||
if [[ "${1}" == "8.0" ]]; then
|
||||
mysqlVersion="8.0.33"
|
||||
elif [[ "${1}" == "5.7" ]]; then
|
||||
mysqlVersion="5.7.42"
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:不支持的 MySQL 版本!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${memTotal}" -lt "4096" ]] && [[ "${1}" == "8.0" ]]; then
|
||||
echo -e $HR
|
||||
echo "错误:这点内存(${memTotal}M)还想装 MySQL 8.0?洗洗睡吧!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 安装依赖
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf install dnf-plugins-core -y
|
||||
dnf install epel-release -y
|
||||
dnf config-manager --set-enabled epel
|
||||
dnf config-manager --set-enabled PowerTools
|
||||
dnf config-manager --set-enabled powertools
|
||||
dnf config-manager --set-enabled CRB
|
||||
dnf config-manager --set-enabled Crb
|
||||
dnf config-manager --set-enabled crb
|
||||
/usr/bin/crb enable
|
||||
dnf makecache
|
||||
dnf groupinstall "Development Tools" -y
|
||||
dnf install cmake bison ncurses-devel libtirpc-devel openssl-devel pkg-config openldap-devel libudev-devel cyrus-sasl-devel patchelf -y
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
apt update
|
||||
apt install build-essential cmake bison libncurses5-dev libtirpc-dev libssl-dev pkg-config libldap2-dev libudev-dev libsasl2-dev patchelf -y
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:耗子Linux面板不支持该系统"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mysqlUserCheck=$(cat /etc/passwd | grep mysql)
|
||||
if [ "${mysqlUserCheck}" == "" ]; then
|
||||
groupadd mysql
|
||||
useradd -s /sbin/nologin -g mysql mysql
|
||||
fi
|
||||
|
||||
# 准备目录
|
||||
rm -rf ${mysqlPath}
|
||||
mkdir -p ${mysqlPath}
|
||||
cd ${mysqlPath}
|
||||
|
||||
# 下载源码
|
||||
wget -T 120 -O ${mysqlPath}/mysql-${mysqlVersion}.tar.gz ${downloadUrl}/mysql-boost-${mysqlVersion}.tar.gz
|
||||
tar -zxvf mysql-${mysqlVersion}.tar.gz
|
||||
rm -f mysql-${mysqlVersion}.tar.gz
|
||||
mv mysql-${mysqlVersion} src
|
||||
|
||||
# openssl
|
||||
wget -T 120 -O ${mysqlPath}/openssl-1.1.1u.tar.gz ${downloadUrl}/openssl/openssl-1.1.1u.tar.gz
|
||||
tar -zxvf openssl-1.1.1u.tar.gz
|
||||
rm -f openssl-1.1.1u.tar.gz
|
||||
mv openssl-1.1.1u openssl
|
||||
cd openssl
|
||||
./config --prefix=/usr/local/openssl-1.1 --openssldir=/usr/local/openssl-1.1
|
||||
make -j$(nproc)
|
||||
make install
|
||||
echo "/usr/local/openssl-1.1/lib" > /etc/ld.so.conf.d/openssl-1.1.conf
|
||||
ldconfig
|
||||
cd ..
|
||||
rm -rf openssl
|
||||
|
||||
# 编译
|
||||
cd src
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=${mysqlPath} -DMYSQL_DATADIR=${mysqlPath}/data -DSYSCONFDIR=${mysqlPath}/conf -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXTRA_CHARSETS=all -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DENABLED_LOCAL_INFILE=1 -DWITH_SYSTEMD=1 -DSYSTEMD_PID_DIR=${mysqlPath} -DWITH_SSL=/usr/local/openssl-1.1 -DWITH_BOOST=../boost
|
||||
make -j$(nproc)
|
||||
|
||||
# 安装
|
||||
make install
|
||||
|
||||
# 配置
|
||||
mkdir ${mysqlPath}/conf
|
||||
cat > ${mysqlPath}/conf/my.cnf << EOF
|
||||
[client]
|
||||
port = 3306
|
||||
socket = /tmp/mysql.sock
|
||||
|
||||
[mysqld]
|
||||
port = 3306
|
||||
socket = /tmp/mysql.sock
|
||||
datadir = ${mysqlPath}/data
|
||||
default_storage_engine = InnoDB
|
||||
skip-external-locking
|
||||
table_definition_cache = 400
|
||||
performance_schema_max_table_instances = 400
|
||||
key_buffer_size = 8M
|
||||
max_allowed_packet = 1G
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
query_cache_size = 4M
|
||||
tmp_table_size = 8M
|
||||
explicit_defaults_for_timestamp = 1
|
||||
#skip-name-resolve
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 65535
|
||||
early-plugin-load = ""
|
||||
|
||||
log-bin = mysql-bin
|
||||
binlog_format = mixed
|
||||
server-id = 1
|
||||
slow_query_log = 1
|
||||
slow-query-log-file = ${mysqlPath}/mysql-slow.log
|
||||
long_query_time = 3
|
||||
log-error = ${mysqlPath}/mysql-error.log
|
||||
|
||||
innodb_data_home_dir = ${mysqlPath}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = ${mysqlPath}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_redo_log_capacity = 5M
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 50
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 4
|
||||
innodb_write_io_threads = 4
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
max_allowed_packet = 500M
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
EOF
|
||||
|
||||
# 根据CPU核心数确定写入线程数
|
||||
cpuCore=$(cat /proc/cpuinfo | grep "processor" | wc -l)
|
||||
sed -i 's/innodb_write_io_threads = 4/innodb_write_io_threads = '${cpuCore}'/g' ${mysqlPath}/conf/my.cnf
|
||||
sed -i 's/innodb_read_io_threads = 4/innodb_read_io_threads = '${cpuCore}'/g' ${mysqlPath}/conf/my.cnf
|
||||
|
||||
if [[ "${1}" == "8.0" ]]; then
|
||||
sed -i '/query_cache_size/d' ${mysqlPath}/conf/my.cnf
|
||||
fi
|
||||
if [[ "${1}" == "5.7" ]]; then
|
||||
sed -i '/innodb_redo_log_capacity/d' ${mysqlPath}/conf/my.cnf
|
||||
fi
|
||||
|
||||
# 根据内存大小调参
|
||||
if [[ ${memTotal} -gt 1024 && ${memTotal} -lt 2048 ]]; then
|
||||
sed -i "s#^key_buffer_size.*#key_buffer_size = 32M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^table_open_cache.*#table_open_cache = 128#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^sort_buffer_size.*#sort_buffer_size = 768K#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^read_buffer_size.*#read_buffer_size = 768K#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^myisam_sort_buffer_size.*#myisam_sort_buffer_size = 8M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^thread_cache_size.*#thread_cache_size = 16#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^query_cache_size.*#query_cache_size = 16M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^tmp_table_size.*#tmp_table_size = 32M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_buffer_pool_size.*#innodb_buffer_pool_size = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_redo_log_capacity.*#innodb_redo_log_capacity = 64M" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_log_buffer_size.*#innodb_log_buffer_size = 16M#" ${mysqlPath}/conf/my.cnf
|
||||
elif [[ ${memTotal} -ge 2048 && ${memTotal} -lt 4096 ]]; then
|
||||
sed -i "s#^key_buffer_size.*#key_buffer_size = 64M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^table_open_cache.*#table_open_cache = 256#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^sort_buffer_size.*#sort_buffer_size = 1M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^read_buffer_size.*#read_buffer_size = 1M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^myisam_sort_buffer_size.*#myisam_sort_buffer_size = 16M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^thread_cache_size.*#thread_cache_size = 32#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^query_cache_size.*#query_cache_size = 32M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^tmp_table_size.*#tmp_table_size = 64M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_buffer_pool_size.*#innodb_buffer_pool_size = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_redo_log_capacity.*#innodb_redo_log_capacity = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_log_buffer_size.*#innodb_log_buffer_size = 32M#" ${mysqlPath}/conf/my.cnf
|
||||
elif [[ ${memTotal} -ge 4096 && ${memTotal} -lt 8192 ]]; then
|
||||
sed -i "s#^key_buffer_size.*#key_buffer_size = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^table_open_cache.*#table_open_cache = 512#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^sort_buffer_size.*#sort_buffer_size = 2M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^read_buffer_size.*#read_buffer_size = 2M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^myisam_sort_buffer_size.*#myisam_sort_buffer_size = 32M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^thread_cache_size.*#thread_cache_size = 64#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^query_cache_size.*#query_cache_size = 64M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^tmp_table_size.*#tmp_table_size = 64M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_buffer_pool_size.*#innodb_buffer_pool_size = 512M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_redo_log_capacity.*#innodb_redo_log_capacity = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_log_buffer_size.*#innodb_log_buffer_size = 64M#" ${mysqlPath}/conf/my.cnf
|
||||
elif [[ ${memTotal} -ge 8192 && ${memTotal} -lt 16384 ]]; then
|
||||
sed -i "s#^key_buffer_size.*#key_buffer_size = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^table_open_cache.*#table_open_cache = 1024#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^sort_buffer_size.*#sort_buffer_size = 4M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^read_buffer_size.*#read_buffer_size = 4M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^myisam_sort_buffer_size.*#myisam_sort_buffer_size = 64M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^thread_cache_size.*#thread_cache_size = 128#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^query_cache_size.*#query_cache_size = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^tmp_table_size.*#tmp_table_size = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_buffer_pool_size.*#innodb_buffer_pool_size = 1024M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_redo_log_capacity.*#innodb_redo_log_capacity = 512M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_log_buffer_size.*#innodb_log_buffer_size = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
elif [[ ${memTotal} -ge 16384 && ${memTotal} -lt 32768 ]]; then
|
||||
sed -i "s#^key_buffer_size.*#key_buffer_size = 512M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^table_open_cache.*#table_open_cache = 2048#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^sort_buffer_size.*#sort_buffer_size = 8M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^read_buffer_size.*#read_buffer_size = 8M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^myisam_sort_buffer_size.*#myisam_sort_buffer_size = 128M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^thread_cache_size.*#thread_cache_size = 256#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^query_cache_size.*#query_cache_size = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^tmp_table_size.*#tmp_table_size = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_buffer_pool_size.*#innodb_buffer_pool_size = 2048M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_redo_log_capacity.*#innodb_redo_log_capacity = 1G#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_log_buffer_size.*#innodb_log_buffer_size = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
elif [[ ${memTotal} -ge 32768 ]]; then
|
||||
sed -i "s#^key_buffer_size.*#key_buffer_size = 1024M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^table_open_cache.*#table_open_cache = 4096#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^sort_buffer_size.*#sort_buffer_size = 16M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^read_buffer_size.*#read_buffer_size = 16M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^myisam_sort_buffer_size.*#myisam_sort_buffer_size = 256M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^thread_cache_size.*#thread_cache_size = 512#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^query_cache_size.*#query_cache_size = 512M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^tmp_table_size.*#tmp_table_size = 512M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_buffer_pool_size.*#innodb_buffer_pool_size = 4096M#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_redo_log_capacity.*#innodb_redo_log_capacity = 2G#" ${mysqlPath}/conf/my.cnf
|
||||
sed -i "s#^innodb_log_buffer_size.*#innodb_log_buffer_size = 512M#" ${mysqlPath}/conf/my.cnf
|
||||
fi
|
||||
|
||||
chmod 644 ${mysqlPath}/conf/my.cnf
|
||||
chown -R mysql:mysql ${mysqlPath}
|
||||
chmod -R 755 ${mysqlPath}
|
||||
|
||||
# 初始化
|
||||
rm -rf ${mysqlPath}/src
|
||||
rm -rf ${mysqlPath}/data
|
||||
mkdir -p ${mysqlPath}/data
|
||||
chown -R mysql:mysql ${mysqlPath}/data
|
||||
chmod -R 755 ${mysqlPath}/data
|
||||
|
||||
${mysqlPath}/bin/mysqld --initialize-insecure --user=mysql --basedir=${mysqlPath} --datadir=${mysqlPath}/data
|
||||
|
||||
echo "export PATH=${mysqlPath}/bin:\$PATH" >> /etc/profile
|
||||
source /etc/profile
|
||||
|
||||
# 启动
|
||||
cp ${mysqlPath}/lib/systemd/system/mysqld.service /etc/systemd/system/mysqld.service
|
||||
sed -i "#ExecStartPre#d" /etc/systemd/system/mysqld.service
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl enable mysqld
|
||||
systemctl start mysqld
|
||||
|
||||
${mysqlPath}/bin/mysqladmin -u root password ${mysqlPassword}
|
||||
|
||||
echo "mysql root password: ${mysqlPassword}"
|
||||
41
scripts/mysql/uninstall.sh
Normal file
41
scripts/mysql/uninstall.sh
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
systemctl stop mysqld
|
||||
systemctl disable mysqld
|
||||
rm -rf /etc/systemd/system/mysqld.service
|
||||
systemctl daemon-reload
|
||||
pkill -9 mysqld
|
||||
rm -rf /www/server/mysql
|
||||
|
||||
rm -f /usr/bin/mysql*
|
||||
rm -f /usr/lib/libmysql*
|
||||
rm -f /usr/lib64/libmysql*
|
||||
|
||||
userdel -r mysql
|
||||
groupdel mysql
|
||||
|
||||
sed -i '#export PATH=/www/server/mysql#d' /etc/profile
|
||||
source /etc/profile
|
||||
|
||||
panel deletePlugin mysql
|
||||
|
||||
echo -e "${HR}\nMySQL uninstall completed.\n${HR}"
|
||||
@@ -20,22 +20,28 @@ limitations under the License.
|
||||
HR="+----------------------------------------------------"
|
||||
ARCH=$(uname -m)
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
downloadUrl="https://raw.githubusercontent.com/HaoZi-Team/Panel_Assets/main/openresty"
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/openresty"
|
||||
setupPath="/www"
|
||||
openrestyPath="${setupPath}/server/openresty"
|
||||
openrestyVersion="1.21.4.1"
|
||||
|
||||
# Check use proxy
|
||||
useProxy=${1}
|
||||
if [ "${useProxy}" == "--proxy" ]; then
|
||||
downloadUrl="https://ghproxy.com/${downloadUrl}"
|
||||
fi
|
||||
|
||||
# 安装依赖
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf install gcc gcc-c++ make tar unzip gd gd-devel git-core flex perl perl-CPAN oniguruma oniguruma-devel libsodium-devel libxml2-devel libxslt-devel GeoIP-devel bison yajl yajl-devel curl curl-devel libtermcap-devel ncurses-devel libevent-devel readline-devel libuuid-devel brotli-devel icu libicu libicu-devel openssl openssl-devel -y
|
||||
dnf install dnf-plugins-core -y
|
||||
dnf install epel-release -y
|
||||
dnf config-manager --set-enabled epel
|
||||
dnf config-manager --set-enabled PowerTools
|
||||
dnf config-manager --set-enabled powertools
|
||||
dnf config-manager --set-enabled CRB
|
||||
dnf config-manager --set-enabled Crb
|
||||
dnf config-manager --set-enabled crb
|
||||
/usr/bin/crb enable
|
||||
dnf makecache
|
||||
dnf groupinstall "Development Tools" -y
|
||||
dnf install tar unzip gd gd-devel git-core flex perl perl-CPAN oniguruma oniguruma-devel libsodium-devel libxml2-devel libxslt-devel GeoIP-devel bison yajl yajl-devel curl curl-devel libtermcap-devel ncurses-devel libevent-devel readline-devel libuuid-devel brotli-devel icu libicu libicu-devel openssl openssl-devel -y
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
apt install gcc g++ make tar unzip libgd3 libgd-dev git flex perl perl-modules libonig-dev libsodium-dev libxml2-dev libxslt1-dev libgeoip-dev bison libyajl-dev curl libcurl4-openssl-dev libncurses5-dev libevent-dev libreadline-dev uuid-dev libbrotli-dev icu-devtools libicu-dev openssl libssl-dev -y
|
||||
apt update
|
||||
apt install build-essential tar unzip libgd3 libgd-dev git flex perl perl-modules libonig-dev libsodium-dev libxml2-dev libxslt1-dev libgeoip-dev bison libyajl-dev curl libcurl4-openssl-dev libncurses5-dev libevent-dev libreadline-dev uuid-dev libbrotli-dev icu-devtools libicu-dev openssl libssl-dev -y
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:耗子Linux面板不支持该系统"
|
||||
@@ -49,7 +55,7 @@ cd ${openrestyPath}
|
||||
|
||||
# 下载源码
|
||||
wget -T 120 -O ${openrestyPath}/openresty-${openrestyVersion}.tar.gz ${downloadUrl}/openresty-${openrestyVersion}.tar.gz
|
||||
tar -xvf openresty-${openrestyVersion}.tar.gz
|
||||
tar -zxvf openresty-${openrestyVersion}.tar.gz
|
||||
rm -f openresty-${openrestyVersion}.tar.gz
|
||||
mv openresty-${openrestyVersion} src
|
||||
cd src
|
||||
@@ -173,7 +179,7 @@ cat >${openrestyPath}/conf/nginx.conf <<EOF
|
||||
user www www;
|
||||
worker_processes auto;
|
||||
error_log /www/wwwlogs/openresty_error.log crit;
|
||||
pid /www/server/openresty/logs/nginx.pid;
|
||||
pid /www/server/openresty/nginx.pid;
|
||||
worker_rlimit_nofile 51200;
|
||||
|
||||
stream {
|
||||
@@ -342,7 +348,7 @@ Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/www/server/openresty/logs/nginx.pid
|
||||
PIDFile=/www/server/openresty/nginx.pid
|
||||
ExecStartPre=/www/server/openresty/sbin/nginx -t -c /www/server/openresty/conf/nginx.conf
|
||||
ExecStart=/www/server/openresty/sbin/nginx -c /www/server/openresty/conf/nginx.conf
|
||||
ExecReload=/www/server/openresty/sbin/nginx -s reload
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
247
scripts/php/install.sh
Normal file
247
scripts/php/install.sh
Normal file
@@ -0,0 +1,247 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
ARCH=$(uname -m)
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/php"
|
||||
setupPath="/www"
|
||||
phpVersion="${1}"
|
||||
phpPath="${setupPath}/server/php/${phpVersion}"
|
||||
|
||||
# 安装依赖
|
||||
if [ "${OS}" == "centos" ]; then
|
||||
dnf install dnf-plugins-core -y
|
||||
dnf install epel-release -y
|
||||
dnf config-manager --set-enabled epel
|
||||
dnf config-manager --set-enabled PowerTools
|
||||
dnf config-manager --set-enabled powertools
|
||||
dnf config-manager --set-enabled CRB
|
||||
dnf config-manager --set-enabled Crb
|
||||
dnf config-manager --set-enabled crb
|
||||
/usr/bin/crb enable
|
||||
dnf makecache
|
||||
dnf groupinstall "Development Tools" -y
|
||||
dnf install autoconf glibc-headers gdbm-devel gd gd-devel perl oniguruma-devel libsodium-devel libxml2-devel sqlite-devel libzip-devel bzip2-devel xz-devel libpng-devel libjpeg-devel libwebp-devel freetype-devel gmp-devel openssl-devel readline-devel libxslt-devel libcurl-devel pkgconfig libedit-devel zlib-devel pcre-devel crontabs libicu libicu-devel c-ares -y
|
||||
elif [ "${OS}" == "debian" ]; then
|
||||
apt update
|
||||
apt install build-essential autoconf libc6-dev libgdbm-dev libgd-tools libgd-dev perl libonig-dev libsodium-dev libxml2-dev libsqlite3-dev libzip-dev libbz2-dev liblzma-dev libpng-dev libjpeg-dev libwebp-dev libfreetype6-dev libgmp-dev libssl-dev libreadline-dev libxslt1-dev libcurl4-openssl-dev pkg-config libedit-dev zlib1g-dev libpcre3-dev cron libicu-dev libc-ares2 libc-ares-dev -y
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:耗子Linux面板不支持该系统"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 准备安装目录
|
||||
rm -rf ${phpPath}
|
||||
mkdir -p ${phpPath}
|
||||
cd ${phpPath}
|
||||
|
||||
# 下载源码
|
||||
if [ "${phpVersion}" == "74" ]; then
|
||||
wget -O ${phpPath}/php-${phpVersion}.tar.gz ${downloadUrl}/php-7.4.33.tar.gz
|
||||
elif [ "${phpVersion}" == "80" ]; then
|
||||
wget -O ${phpPath}/php-${phpVersion}.tar.gz ${downloadUrl}/php-8.0.29.tar.gz
|
||||
elif [ "${phpVersion}" == "81" ]; then
|
||||
wget -O ${phpPath}/php-${phpVersion}.tar.gz ${downloadUrl}/php-8.1.21.tar.gz
|
||||
elif [ "${phpVersion}" == "82" ]; then
|
||||
wget -O ${phpPath}/php-${phpVersion}.tar.gz ${downloadUrl}/php-8.2.8.tar.gz
|
||||
else
|
||||
echo -e $HR
|
||||
echo "错误:PHP-${phpVersion}不支持,请检查版本号是否正确。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:PHP-${phpVersion}下载失败,请检查网络是否正常。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tar -xvf php-${phpVersion}.tar.gz
|
||||
rm -f php-${phpVersion}.tar.gz
|
||||
mv php-* src
|
||||
|
||||
if [ "${phpVersion}" -le "80" ]; then
|
||||
wget -T 120 -O ${phpPath}/openssl-1.1.1u.tar.gz ${downloadUrl}/openssl/openssl-1.1.1u.tar.gz
|
||||
tar -zxvf openssl-1.1.1u.tar.gz
|
||||
rm -f openssl-1.1.1u.tar.gz
|
||||
mv openssl-1.1.1u openssl
|
||||
cd openssl
|
||||
./config --prefix=/usr/local/openssl-1.1 --openssldir=/usr/local/openssl-1.1
|
||||
make -j$(nproc)
|
||||
make install
|
||||
echo "/usr/local/openssl-1.1/lib" > /etc/ld.so.conf.d/openssl-1.1.conf
|
||||
ldconfig
|
||||
cd ..
|
||||
rm -rf openssl
|
||||
|
||||
export CFLAGS="-I/usr/local/openssl-1.1/include -I/usr/local/curl/include"
|
||||
export LIBS="-L/usr/local/openssl-1.1/lib -L/usr/local/curl/lib"
|
||||
fi
|
||||
|
||||
# 配置
|
||||
cd src
|
||||
./configure --prefix=${phpPath} --with-config-file-path=${phpPath}/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-freetype --with-jpeg --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --enable-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --with-gettext --enable-fileinfo --enable-opcache --with-sodium --with-webp
|
||||
|
||||
# 编译安装
|
||||
make -j${nproc}
|
||||
make install
|
||||
if [ ! -f "${phpPath}/bin/php" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:PHP-${phpVersion}安装失败,请截图错误信息寻求帮助!"
|
||||
rm -rf ${phpPath}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 创建php配置
|
||||
mkdir -p ${phpPath}/etc
|
||||
\cp php.ini-production ${phpPath}/etc/php.ini
|
||||
|
||||
# 安装zip拓展
|
||||
cd ${phpPath}/src/ext/zip
|
||||
${phpPath}/bin/phpize
|
||||
./configure --with-php-config=${phpPath}/bin/php-config
|
||||
make -j${cpuCore}
|
||||
make install
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:PHP-${phpVersion} zip拓展安装失败,请截图错误信息寻求帮助。"
|
||||
exit 1
|
||||
fi
|
||||
cd ../../
|
||||
|
||||
# 写入拓展标记位
|
||||
echo ";下方标记位禁止删除,否则将导致PHP拓展无法正常安装!" >>${phpPath}/etc/php.ini
|
||||
echo ";haozi" >>${phpPath}/etc/php.ini
|
||||
# 写入zip拓展到php配置
|
||||
echo "extension=zip" >>${phpPath}/etc/php.ini
|
||||
|
||||
# 设置软链接
|
||||
rm -f /usr/bin/php-${phpVersion}
|
||||
rm -f /usr/bin/pear
|
||||
rm -f /usr/bin/pecl
|
||||
ln -sf ${phpPath}/bin/php /usr/bin/php
|
||||
ln -sf ${phpPath}/bin/php /usr/bin/php-${phpVersion}
|
||||
ln -sf ${phpPath}/bin/phpize /usr/bin/phpize
|
||||
ln -sf ${phpPath}/bin/pear /usr/bin/pear
|
||||
ln -sf ${phpPath}/bin/pecl /usr/bin/pecl
|
||||
ln -sf ${phpPath}/sbin/php-fpm /usr/bin/php-fpm-${phpVersion}
|
||||
|
||||
# 设置fpm
|
||||
cat >${phpPath}/etc/php-fpm.conf <<EOF
|
||||
[global]
|
||||
pid = ${phpPath}/var/run/php-fpm.pid
|
||||
error_log = ${phpPath}/var/log/php-fpm.log
|
||||
log_level = notice
|
||||
|
||||
[www]
|
||||
listen = /tmp/php-cgi-${phpVersion}.sock
|
||||
listen.backlog = -1
|
||||
listen.allowed_clients = 127.0.0.1
|
||||
listen.owner = www
|
||||
listen.group = www
|
||||
listen.mode = 0666
|
||||
user = www
|
||||
group = www
|
||||
pm = dynamic
|
||||
pm.max_children = 30
|
||||
pm.start_servers = 5
|
||||
pm.min_spare_servers = 5
|
||||
pm.max_spare_servers = 10
|
||||
request_terminate_timeout = 100
|
||||
request_slowlog_timeout = 30
|
||||
pm.status_path = /phpfpm_${phpVersion}_status
|
||||
slowlog = var/log/slow.log
|
||||
EOF
|
||||
|
||||
# 设置PHP进程数
|
||||
memTotal=$(free -m | grep Mem | awk '{print $2}')
|
||||
if [[ ${memTotal} -gt 1024 && ${memTotal} -le 2048 ]]; then
|
||||
sed -i "s#pm.max_children.*#pm.max_children = 50#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.start_servers.*#pm.start_servers = 5#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.min_spare_servers.*#pm.min_spare_servers = 5#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.max_spare_servers.*#pm.max_spare_servers = 10#" ${phpPath}/etc/php-fpm.conf
|
||||
elif [[ ${memTotal} -gt 2048 && ${memTotal} -le 4096 ]]; then
|
||||
sed -i "s#pm.max_children.*#pm.max_children = 80#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.start_servers.*#pm.start_servers = 5#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.min_spare_servers.*#pm.min_spare_servers = 5#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.max_spare_servers.*#pm.max_spare_servers = 20#" ${phpPath}/etc/php-fpm.conf
|
||||
elif [[ ${memTotal} -gt 4096 && ${memTotal} -le 8192 ]]; then
|
||||
sed -i "s#pm.max_children.*#pm.max_children = 150#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.start_servers.*#pm.start_servers = 10#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.min_spare_servers.*#pm.min_spare_servers = 10#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.max_spare_servers.*#pm.max_spare_servers = 30#" ${phpPath}/etc/php-fpm.conf
|
||||
elif [[ ${memTotal} -gt 8192 && ${memTotal} -le 16384 ]]; then
|
||||
sed -i "s#pm.max_children.*#pm.max_children = 200#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.start_servers.*#pm.start_servers = 15#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.min_spare_servers.*#pm.min_spare_servers = 15#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.max_spare_servers.*#pm.max_spare_servers = 30#" ${phpPath}/etc/php-fpm.conf
|
||||
elif [[ ${memTotal} -gt 16384 ]]; then
|
||||
sed -i "s#pm.max_children.*#pm.max_children = 300#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.start_servers.*#pm.start_servers = 20#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.min_spare_servers.*#pm.min_spare_servers = 20#" ${phpPath}/etc/php-fpm.conf
|
||||
sed -i "s#pm.max_spare_servers.*#pm.max_spare_servers = 50#" ${phpPath}/etc/php-fpm.conf
|
||||
fi
|
||||
sed -i "s#listen.backlog.*#listen.backlog = 8192#" ${phpPath}/etc/php-fpm.conf
|
||||
# 最大上传限制100M
|
||||
sed -i 's/post_max_size =.*/post_max_size = 100M/g' ${phpPath}/etc/php.ini
|
||||
sed -i 's/upload_max_filesize =.*/upload_max_filesize = 100M/g' ${phpPath}/etc/php.ini
|
||||
# 时区PRC
|
||||
sed -i 's/;date.timezone =.*/date.timezone = PRC/g' ${phpPath}/etc/php.ini
|
||||
sed -i 's/short_open_tag =.*/short_open_tag = On/g' ${phpPath}/etc/php.ini
|
||||
sed -i 's/;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=1/g' ${phpPath}/etc/php.ini
|
||||
# 最大运行时间
|
||||
sed -i 's/max_execution_time =.*/max_execution_time = 86400/g' ${phpPath}/etc/php.ini
|
||||
sed -i 's/;sendmail_path =.*/sendmail_path = \/usr\/sbin\/sendmail -t -i/g' ${phpPath}/etc/php.ini
|
||||
# 禁用函数
|
||||
sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv/g' ${phpPath}/etc/php.ini
|
||||
sed -i 's/display_errors = Off/display_errors = On/g' ${phpPath}/etc/php.ini
|
||||
sed -i 's/error_reporting =.*/error_reporting = E_ALL \& \~E_NOTICE/g' ${phpPath}/etc/php.ini
|
||||
|
||||
# 设置SSL根证书
|
||||
sed -i "s#;openssl.cafile=#openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt#" ${phpPath}/etc/php.ini
|
||||
sed -i "s#;curl.cainfo =#curl.cainfo = /etc/pki/tls/certs/ca-bundle.crt#" ${phpPath}/etc/php.ini
|
||||
|
||||
# 关闭php外显
|
||||
sed -i 's/expose_php = On/expose_php = Off/g' ${phpPath}/etc/php.ini
|
||||
|
||||
# 写入openresty 调用php配置文件
|
||||
cat >/www/server/openresty/conf/enable-php-${phpVersion}.conf <<EOF
|
||||
location ~ \.php$ {
|
||||
try_files \$uri =404;
|
||||
fastcgi_pass unix:/tmp/php-cgi-${phpVersion}.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi.conf;
|
||||
include pathinfo.conf;
|
||||
}
|
||||
EOF
|
||||
|
||||
# 添加php-fpm到服务
|
||||
\cp ${phpPath}/src/sapi/fpm/php-fpm.service /lib/systemd/system/php-fpm-${phpVersion}.service
|
||||
sed -i "/PrivateTmp/d" /lib/systemd/system/php-fpm-${phpVersion}.service
|
||||
systemctl daemon-reload
|
||||
|
||||
# 启动php
|
||||
systemctl enable php-fpm-${phpVersion}.service
|
||||
systemctl start php-fpm-${phpVersion}.service
|
||||
|
||||
panel writePlugin php${phpVersion}
|
||||
|
||||
echo -e "${HR}\nPHP-${phpVersion} 安装成功!\n${HR}"
|
||||
35
scripts/php/uninstall.sh
Normal file
35
scripts/php/uninstall.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
setupPath="/www"
|
||||
phpVersion="${1}"
|
||||
phpPath="${setupPath}/server/php/${phpVersion}"
|
||||
|
||||
systemctl stop php-fpm-${phpVersion}
|
||||
systemctl disable php-fpm-${phpVersion}
|
||||
rm -rf /lib/systemd/system/php-fpm-${phpVersion}.service
|
||||
systemctl daemon-reload
|
||||
|
||||
rm -rf ${phpPath}
|
||||
rm -f /usr/bin/php-${phpVersion}
|
||||
|
||||
panel deletePlugin openresty
|
||||
|
||||
echo -e "${HR}\nPHP uninstall completed.\n${HR}"
|
||||
80
scripts/php_extensions/exif.sh
Normal file
80
scripts/php_extensions/exif.sh
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
action="$1" # 操作
|
||||
phpVersion="$2" # PHP版本
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=exif$')
|
||||
if [ "${isInstall}" != "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 已安装 exif"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /www/server/php/${phpVersion}/src/ext/exif
|
||||
/www/server/php/${phpVersion}/bin/phpize
|
||||
./configure --with-php-config=/www/server/php/${phpVersion}/bin/php-config
|
||||
make
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} exif 编译失败"
|
||||
exit 1
|
||||
fi
|
||||
make install
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} exif 安装失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/;haozi/a\extension=exif' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} exif 安装成功"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=exif$')
|
||||
if [ "${isInstall}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 未安装 exif"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/extension=exif/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} exif 卸载成功"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
91
scripts/php_extensions/imagemagick.sh
Normal file
91
scripts/php_extensions/imagemagick.sh
Normal file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/php_extensions"
|
||||
action="$1"
|
||||
phpVersion="$2"
|
||||
imagickVersion="3.7.0"
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=imagick$')
|
||||
if [ "${isInstall}" != "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 已安装 imagick"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 安装依赖
|
||||
dnf install ImageMagick ImageMagick-devel -y
|
||||
|
||||
cd /www/server/php/${phpVersion}/src/ext
|
||||
rm -rf imagick
|
||||
rm -rf imagick.tar.gz
|
||||
wget -O imagick.tar.gz ${downloadUrl}/imagick-${imagickVersion}.tar.gz
|
||||
tar -zxvf imagick.tar.gz
|
||||
mv imagick-${imagickVersion} imagick
|
||||
cd imagick
|
||||
/www/server/php/${phpVersion}/bin/phpize
|
||||
./configure --with-php-config=/www/server/php/${phpVersion}/bin/php-config
|
||||
make
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} imagick 编译失败"
|
||||
exit 1
|
||||
fi
|
||||
make install
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} imagick 安装失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/;haozi/a\extension=imagick' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} imagick 安装成功"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=imagick$')
|
||||
if [ "${isInstall}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 未安装 imagick"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/extension=imagick/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} imagick 卸载成功"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
73
scripts/php_extensions/ioncube.sh
Normal file
73
scripts/php_extensions/ioncube.sh
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/php_extensions"
|
||||
action="$1"
|
||||
phpVersion="$2"
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep 'ioncube_loader_lin')
|
||||
if [ "${isInstall}" != "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 已安装 ionCube"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir /usr/local/ioncube
|
||||
wget -O /usr/local/ioncube/ioncube_loader_lin_${phpVersion}.so ${downloadUrl}/ioncube_loader_lin_${phpVersion}.so
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:ionCube 下载失败,请检查网络是否正常。"
|
||||
exit 1
|
||||
fi
|
||||
sed -i -e "/;haozi/a\zend_extension=/usr/local/ioncube/ioncube_loader_lin_${phpVersion}.so" /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} ionCube 安装成功"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep 'ioncube_loader_lin')
|
||||
if [ "${isInstall}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 未安装 ionCube"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f /usr/local/ioncube/ioncube_loader_lin_${phpVersion}.so
|
||||
sed -i '/ioncube_loader_lin/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} ionCube 卸载成功"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
68
scripts/php_extensions/opcache.sh
Normal file
68
scripts/php_extensions/opcache.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
action="$1" # 操作
|
||||
phpVersion="$2" # PHP版本
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^zend_extension=opcache$')
|
||||
if [ "${isInstall}" != "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 已安装 Zend OPcache"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${phpVersion}" -ge "80" ]; then
|
||||
sed -i '/;haozi/a\zend_extension=opcache\nopcache.enable = 1\nopcache.enable_cli=1\nopcache.memory_consumption=128\nopcache.interned_strings_buffer=32\nopcache.max_accelerated_files=100000\nopcache.revalidate_freq=3\nopcache.save_comments=0\nopcache.jit_buffer_size=128m\nopcache.jit=1205' /www/server/php/${phpVersion}/etc/php.ini
|
||||
else
|
||||
sed -i '/;haozi/a\zend_extension=opcache\nopcache.enable = 1\nopcache.enable_cli=1\nopcache.memory_consumption=128\nopcache.interned_strings_buffer=32\nopcache.max_accelerated_files=100000\nopcache.revalidate_freq=3\nopcache.save_comments=0' /www/server/php/${phpVersion}/etc/php.ini
|
||||
fi
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} Zend OPcache 安装成功"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^zend_extension=opcache$')
|
||||
if [ "${isInstall}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 未安装 Zend OPcache"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/^opcache.*$/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
sed -i '/zend_extension=opcache/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} Zend OPcache 卸载成功"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
80
scripts/php_extensions/pdo_pgsql.sh
Normal file
80
scripts/php_extensions/pdo_pgsql.sh
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
action="$1"
|
||||
phpVersion="$2"
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=pdo_pgsql$')
|
||||
if [ "${isInstall}" != "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 已安装 pdo_pgsql"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /www/server/php/${phpVersion}/src/ext/pdo_pgsql
|
||||
/www/server/php/${phpVersion}/bin/phpize
|
||||
./configure --with-php-config=/www/server/php/${phpVersion}/bin/php-config --with-pdo-pgsql=/usr/pgsql-15
|
||||
make
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} pdo_pgsql 编译失败"
|
||||
exit 1
|
||||
fi
|
||||
make install
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} pdo_pgsql 安装失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/;haozi/a\extension=pdo_pgsql' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} pdo_pgsql 安装成功"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=pdo_pgsql$')
|
||||
if [ "${isInstall}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 未安装 pdo_pgsql"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/extension=pdo_pgsql/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} pdo_pgsql 卸载成功"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
88
scripts/php_extensions/redis.sh
Normal file
88
scripts/php_extensions/redis.sh
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/php_extensions"
|
||||
action="$1"
|
||||
phpVersion="$2"
|
||||
phpredisVersion="5.3.7"
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=redis$')
|
||||
if [ "${isInstall}" != "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 已安装 redis"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd /www/server/php/${phpVersion}/src/ext
|
||||
rm -rf phpredis
|
||||
rm -rf phpredis.tar.gz
|
||||
wget -O phpredis.tar.gz ${downloadUrl}/php-ext/phpredis-${phpredisVersion}.tar.gz
|
||||
tar -zxvf phpredis.tar.gz
|
||||
mv phpredis-${phpredisVersion} phpredis
|
||||
cd phpredis
|
||||
/www/server/php/${phpVersion}/bin/phpize
|
||||
./configure --with-php-config=/www/server/php/${phpVersion}/bin/php-config
|
||||
make
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} redis 编译失败"
|
||||
exit 1
|
||||
fi
|
||||
make install
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} redis 安装失败"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/;haozi/a\extension=redis' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} redis 安装成功"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
isInstall=$(cat /www/server/php/${phpVersion}/etc/php.ini | grep '^extension=redis$')
|
||||
if [ "${isInstall}" == "" ]; then
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} 未安装 redis"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '/extension=redis/d' /www/server/php/${phpVersion}/etc/php.ini
|
||||
|
||||
# 重载PHP
|
||||
systemctl reload php-fpm-${phpVersion}.service
|
||||
echo -e $HR
|
||||
echo "PHP-${phpVersion} redis 卸载成功"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
111
scripts/phpmyadmin/install.sh
Normal file
111
scripts/phpmyadmin/install.sh
Normal file
@@ -0,0 +1,111 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
ARCH=$(uname -m)
|
||||
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
|
||||
downloadUrl="https://dl.cdn.haozi.net/panel/phpmyadmin"
|
||||
setupPath="/www"
|
||||
phpmyadminPath="${setupPath}/wwwroot/phpmyadmin"
|
||||
phpmyadminVersion="5.2.1"
|
||||
randomDir="$(cat /dev/urandom | head -n 16 | md5sum | head -c 10)"
|
||||
|
||||
# 准备安装目录
|
||||
rm -rf ${phpmyadminPath}
|
||||
mkdir -p ${phpmyadminPath}
|
||||
cd ${phpmyadminPath}
|
||||
|
||||
wget -O phpmyadmin.zip ${downloadUrl}/phpMyAdmin-${phpmyadminVersion}-all-languages.zip
|
||||
if [ "$?" != "0" ]; then
|
||||
echo -e $HR
|
||||
echo "错误:phpMyAdmin 下载失败"
|
||||
rm -rf ${phpmyadminPath}
|
||||
exit 1
|
||||
fi
|
||||
unzip -o phpmyadmin.zip
|
||||
mv phpMyAdmin-${phpmyadminVersion}-all-languages phpmyadmin_${randomDir}
|
||||
chown -R www:www ${phpmyadminPath}
|
||||
chmod -R 755 ${phpmyadminPath}
|
||||
rm -rf phpmyadmin.zip
|
||||
|
||||
# 判断PHP版本
|
||||
phpVersion="74"
|
||||
if [ -d "/www/server/php/80" ]; then
|
||||
phpVersion="80"
|
||||
fi
|
||||
if [ -d "/www/server/php/81" ]; then
|
||||
phpVersion="81"
|
||||
fi
|
||||
if [ -d "/www/server/php/82" ]; then
|
||||
phpVersion="82"
|
||||
fi
|
||||
|
||||
# 写入 phpMyAdmin 配置文件
|
||||
cat >/www/server/vhost/openresty/phpmyadmin.conf <<EOF
|
||||
# 配置文件中的标记位请勿随意修改,改错将导致面板无法识别!
|
||||
# 有自定义配置需求的,请将自定义的配置写在各标记位下方。
|
||||
server
|
||||
{
|
||||
# port标记位开始
|
||||
listen 888;
|
||||
# port标记位结束
|
||||
# server_name标记位开始
|
||||
server_name phpmyadmin;
|
||||
# server_name标记位结束
|
||||
# index标记位开始
|
||||
index index.php;
|
||||
# index标记位结束
|
||||
# root标记位开始
|
||||
root /www/wwwroot/phpmyadmin;
|
||||
# root标记位结束
|
||||
|
||||
# php标记位开始
|
||||
include enable-php-${phpVersion}.conf;
|
||||
# php标记位结束
|
||||
|
||||
# 面板默认禁止访问部分敏感目录,可自行修改
|
||||
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn)
|
||||
{
|
||||
return 404;
|
||||
}
|
||||
location ~ /tmp/ {
|
||||
return 403;
|
||||
}
|
||||
# 面板默认不记录静态资源的访问日志并开启1小时浏览器缓存,可自行修改
|
||||
location ~ .*\.(js|css)$
|
||||
{
|
||||
expires 1h;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
access_log /www/wwwlogs/phpmyadmin.log;
|
||||
error_log /www/wwwlogs/phpmyadmin.log;
|
||||
}
|
||||
EOF
|
||||
# 设置文件权限
|
||||
chown -R root:root /www/server/vhost/openresty/phpmyadmin.conf
|
||||
chmod -R 644 /www/server/vhost/openresty/phpmyadmin.conf
|
||||
|
||||
# 放行端口
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp >/dev/null 2>&1
|
||||
firewall-cmd --reload
|
||||
|
||||
panel writePlugin phpmyadmin
|
||||
systemctl reload openresty
|
||||
30
scripts/phpmyadmin/uninstall.sh
Normal file
30
scripts/phpmyadmin/uninstall.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
setupPath="/www"
|
||||
phpmyadminPath="${setupPath}/wwwroot/phpmyadmin"
|
||||
|
||||
|
||||
rm -rf /www/server/vhost/openresty/phpmyadmin.conf
|
||||
rm -rf ${phpmyadminPath}
|
||||
panel deletePlugin phpmyadmin
|
||||
systemctl reload openresty
|
||||
|
||||
echo -e "${HR}\phpMyAdmin uninstall completed.\n${HR}"
|
||||
27
scripts/postgresql/install.sh
Normal file
27
scripts/postgresql/install.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
||||
|
||||
: '
|
||||
Copyright 2022 HaoZi Technology Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
'
|
||||
|
||||
HR="+----------------------------------------------------"
|
||||
postgresqlVersion="$1"
|
||||
setup_Path="/www"
|
||||
postgresqlPath="${setup_Path}/server/postgresql"
|
||||
os_Version=$(cat /etc/redhat-release | sed -r 's/.* ([0-9]+)\.?.*/\1/')
|
||||
ipLocation=$(curl -s https://ip.ping0.cc/geo) # 获取IP位置
|
||||
|
||||
# TODO
|
||||
0
scripts/postgresql/uninstall.sh
Normal file
0
scripts/postgresql/uninstall.sh
Normal file
Reference in New Issue
Block a user