2022-07-07 02:22:04 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
|
|
|
|
export PATH
|
|
|
|
|
|
|
|
|
|
curPath=`pwd`
|
|
|
|
|
rootPath=$(dirname "$curPath")
|
|
|
|
|
rootPath=$(dirname "$rootPath")
|
|
|
|
|
serverPath=$(dirname "$rootPath")
|
|
|
|
|
|
|
|
|
|
if id www &> /dev/null ;then
|
2022-11-20 22:16:47 -05:00
|
|
|
echo "www uid is `id -u www`"
|
|
|
|
|
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
2022-07-07 02:22:04 -04:00
|
|
|
else
|
|
|
|
|
groupadd www
|
2024-06-15 08:53:04 -04:00
|
|
|
useradd -g www -s /sbin/nologin www
|
|
|
|
|
# useradd -g www -s /bin/bash www
|
2022-07-07 02:22:04 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
action=$1
|
|
|
|
|
type=$2
|
|
|
|
|
|
|
|
|
|
if [ "${2}" == "" ];then
|
2024-07-19 15:03:10 -04:00
|
|
|
echo '缺少安装脚本...'
|
2022-07-07 02:22:04 -04:00
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ ! -d $curPath/versions/$2 ];then
|
2024-07-19 12:57:10 -04:00
|
|
|
echo '缺少安装脚本2...'
|
2022-07-07 02:22:04 -04:00
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
2024-06-14 03:28:22 -04:00
|
|
|
# cd /www/server/mdserver-web/plugins/php-yum/versions && bash common.sh 83 install opcache
|
2022-07-07 02:22:04 -04:00
|
|
|
|
2022-07-12 13:04:53 -04:00
|
|
|
#获取信息和版本
|
2024-06-14 03:28:22 -04:00
|
|
|
# bash /www/server/mdserver-web/scripts/getos.sh
|
2022-07-12 13:04:53 -04:00
|
|
|
bash ${rootPath}/scripts/getos.sh
|
|
|
|
|
OSNAME=`cat ${rootPath}/data/osname.pl`
|
|
|
|
|
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
|
|
|
|
|
2024-07-19 12:56:16 -04:00
|
|
|
if [ "$OSNAME" == "alma" ];then
|
|
|
|
|
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
|
|
|
|
fi
|
2022-07-12 13:04:53 -04:00
|
|
|
|
2024-07-19 12:58:48 -04:00
|
|
|
if [ "$OSNAME" == "rocky" ];then
|
|
|
|
|
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
|
|
|
|
fi
|
|
|
|
|
|
2022-07-12 13:04:53 -04:00
|
|
|
if [ "$OSNAME" == "centos" ];then
|
|
|
|
|
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-${VERSION_ID}.rpm
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
2022-07-12 13:13:16 -04:00
|
|
|
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-31.rpm
|
2022-07-12 13:04:53 -04:00
|
|
|
if [ "$OSNAME" == "fedora" ];then
|
|
|
|
|
rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-${VERSION_ID}.rpm
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-07 09:15:22 -04:00
|
|
|
if [ "${action}" == "uninstall" ] && [ -d ${serverPath}/php-yum/${type} ];then
|
|
|
|
|
#初始化
|
|
|
|
|
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py stop ${type}
|
|
|
|
|
cd ${rootPath} && python3 ${rootPath}/plugins/php-yum/index.py initd_uninstall ${type}
|
2024-06-13 11:29:25 -04:00
|
|
|
|
|
|
|
|
if [ -f /lib/systemd/system/php${type}-php-fpm.service ];then
|
|
|
|
|
rm -rf /lib/systemd/system/php${type}-fpm.service
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -f /lib/systemd/system/system/php${type}-php-fpm.service ];then
|
|
|
|
|
rm -rf /lib/systemd/system/php${type}-php-fpm.service
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
systemctl daemon-reload
|
2022-07-07 09:15:22 -04:00
|
|
|
fi
|
|
|
|
|
|
2022-07-07 02:22:04 -04:00
|
|
|
cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1
|
|
|
|
|
|
2022-07-07 03:20:57 -04:00
|
|
|
if [ "${action}" == "install" ] && [ -d ${serverPath}/php-yum/${type} ];then
|
2022-11-19 04:42:59 -05:00
|
|
|
|
2022-11-16 06:58:34 -05:00
|
|
|
# 安装通用扩展
|
2022-11-16 07:13:50 -05:00
|
|
|
echo "install PHP-YUM[${type}] extend start"
|
2023-01-08 22:27:34 -05:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mysqlnd
|
2023-01-08 22:39:52 -05:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mysql
|
2022-11-16 07:13:50 -05:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install gd
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install iconv
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install exif
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install intl
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mcrypt
|
2024-07-19 12:56:16 -04:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install bcmath
|
2022-11-16 07:13:50 -05:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install openssl
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install gettext
|
2022-11-18 10:15:28 -05:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install redis
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install memcached
|
2023-01-08 22:27:34 -05:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mbstring
|
2024-06-11 04:04:36 -04:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install mongodb
|
|
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install zip
|
2024-07-19 13:32:12 -04:00
|
|
|
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install simplexml
|
|
|
|
|
|
2022-11-16 07:13:50 -05:00
|
|
|
echo "install PHP-YUM[${type}] extend end"
|
2022-12-17 10:57:05 -05:00
|
|
|
|
2023-08-17 10:49:01 -04:00
|
|
|
#初始化
|
2024-12-10 06:31:15 -05:00
|
|
|
cd ${rootPath} && python3 plugins/php-yum/index.py start ${type}
|
|
|
|
|
cd ${rootPath} && python3 plugins/php-yum/index.py initd_install ${type}
|
2023-08-17 10:49:01 -04:00
|
|
|
|
2022-12-17 10:57:05 -05:00
|
|
|
if [ ! -f /usr/local/bin/composer ];then
|
|
|
|
|
cd /tmp
|
2023-01-09 02:10:14 -05:00
|
|
|
curl -sS https://getcomposer.org/installer | /opt/remi/php${type}/root/usr/bin/php
|
2022-12-17 10:57:05 -05:00
|
|
|
mv composer.phar /usr/local/bin/composer
|
|
|
|
|
fi
|
2024-06-11 05:56:46 -04:00
|
|
|
|
2024-06-11 06:21:50 -04:00
|
|
|
echo "PHP-YUM[${type}] start ..."
|
2024-06-11 06:17:54 -04:00
|
|
|
systemctl restart php${type}-php-fpm
|
2024-06-11 06:21:50 -04:00
|
|
|
echo "PHP-YUM[${type}] start ok"
|
2022-07-07 02:22:04 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|