فهرست منبع

更新 PHP 和 MariaDB 版本支持,修复安装脚本细节

- 在 install.sh 中添加 PHP 8.4 安装选项
- 更新 MariaDB 10.11 版本至 10.11.11
- 移除 MariaDB 下载备用地址的中国特定逻辑
chengli 3 ماه پیش
والد
کامیت
a81ff55bbd
5فایلهای تغییر یافته به همراه170 افزوده شده و 10 حذف شده
  1. 0 1
      include/check_download.sh
  2. 96 0
      include/php-8.4.sh
  3. 65 5
      include/postgresql.sh
  4. 8 3
      install.sh
  5. 1 1
      versions.txt

+ 0 - 1
include/check_download.sh

@@ -281,7 +281,6 @@ checkDownload() {
 
         if [ "${OUTIP_STATE}"x == "China"x ]; then
           DOWN_ADDR_MARIADB=${mirror_link}/oneinstack/src/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
-          DOWN_ADDR_MARIADB_BK=http://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
         else
           DOWN_ADDR_MARIADB=${mirror_link}/oneinstack/src/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}
           DOWN_ADDR_MARIADB_BK=${mirror_link}/oneinstack/src/mariadb/mariadb-${mariadb_ver}/${FILE_TYPE}

+ 96 - 0
include/php-8.4.sh

@@ -0,0 +1,96 @@
+#!/bin/bash
+
+Install_PHP84() {
+  pushd ${oneinstack_dir}/src > /dev/null
+  
+  if [ ! -e "${php_install_dir}/bin/phpize" ]; then
+    PHP_version=8.4.4
+    PHP_main_ver=84
+    
+    # 下载和校验
+    src_url=https://www.php.net/distributions/php-${PHP_version}.tar.gz && Download_src
+    
+    # 安装依赖
+    Install_PHP_Dependent
+    
+    # 编译安装
+    tar xzf php-${PHP_version}.tar.gz
+    pushd php-${PHP_version} > /dev/null
+    make clean
+    [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
+    
+    # PHP 8.4 特定的编译选项
+    ./configure --prefix=${php_install_dir} \
+    --with-config-file-path=${php_install_dir}/etc \
+    --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
+    --with-fpm-user=${run_user} \
+    --with-fpm-group=${run_user} \
+    --with-pear=/usr/share/php \
+    --enable-mysqlnd \
+    --with-mysqli=mysqlnd \
+    --with-pdo-mysql=mysqlnd \
+    --with-sqlite3 \
+    --with-pdo-sqlite \
+    --with-openssl \
+    --with-zlib \
+    --with-zip \
+    --with-curl \
+    --with-iconv \
+    --with-gettext \
+    --with-readline \
+    --with-mhash \
+    --with-ldap \
+    --with-ldap-sasl \
+    --with-sodium \
+    --enable-bcmath \
+    --enable-fpm \
+    --enable-xml \
+    --enable-sysvsem \
+    --enable-sysvshm \
+    --enable-sysvmsg \
+    --enable-shmop \
+    --enable-sockets \
+    --enable-mbstring \
+    --enable-pcntl \
+    --enable-soap \
+    --enable-gd \
+    --enable-intl \
+    --enable-opcache \
+    --enable-ftp \
+    --enable-exif \
+    --enable-calendar \
+    --without-pear \
+    --disable-phar \
+    --disable-rpath
+
+    make -j ${THREAD} && make install
+    
+    if [ -e "${php_install_dir}/bin/phpize" ]; then
+      # 配置文件
+      mkdir -p ${php_install_dir}/etc/php.d
+      \cp php.ini-production ${php_install_dir}/etc/php.ini
+      
+      # PHP-FPM配置
+      \cp sapi/fpm/php-fpm.conf.in ${php_install_dir}/etc/php-fpm.conf
+      \cp sapi/fpm/www.conf.in ${php_install_dir}/etc/php-fpm.d/www.conf
+      sed -i "s@^;pid = run/php-fpm.pid@pid = run/php-fpm.pid@" ${php_install_dir}/etc/php-fpm.conf
+      
+      # 启动脚本
+      \cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
+      sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
+      systemctl enable php-fpm
+
+      # 环境变量
+      echo "export PATH=${php_install_dir}/bin:\$PATH" > /etc/profile.d/php.sh
+      
+      echo "${CSUCCESS}PHP ${PHP_version} installed successfully! ${CEND}"
+      rm -rf php-${PHP_version}
+    else
+      rm -rf ${php_install_dir}
+      echo "${CFAILURE}PHP ${PHP_version} install failed, Please Contact the author! ${CEND}"
+      kill -9 $$; exit 1;
+    fi
+    popd > /dev/null
+  fi
+  popd > /dev/null
+}

+ 65 - 5
include/postgresql.sh

@@ -10,32 +10,90 @@
 
 Install_PostgreSQL() {
   pushd ${oneinstack_dir}/src > /dev/null
+  
+  # 首先安装必要的依赖包
+  if [ "${PM}" == 'yum' ]; then
+    yum -y install flex bison readline-devel zlib-devel openssl-devel
+  elif [ "${PM}" == 'apt-get' ]; then
+    apt-get -y install flex bison libreadline-dev zlib1g-dev libssl-dev
+  fi
+  
   id -u postgres >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -d ${pgsql_install_dir} -s /bin/bash postgres
-  mkdir -p ${pgsql_data_dir};chown postgres.postgres -R ${pgsql_data_dir}
+  
+  mkdir -p ${pgsql_data_dir}
+  chown -R postgres:postgres ${pgsql_data_dir}
+  
   tar xzf postgresql-${pgsql_ver}.tar.gz
   pushd postgresql-${pgsql_ver}
-  ./configure --prefix=$pgsql_install_dir
+  
+  # 配置和编译
+  ./configure --prefix=${pgsql_install_dir} \
+    --with-openssl \
+    --with-libxml \
+    --with-libxslt \
+    --with-icu
+  
+  if [ $? -ne 0 ]; then
+    echo "${CFAILURE}PostgreSQL configure failed! ${CEND}"
+    kill -9 $$; exit 1;
+  fi
+  
   make -j ${THREAD}
+  if [ $? -ne 0 ]; then
+    echo "${CFAILURE}PostgreSQL make failed! ${CEND}"
+    kill -9 $$; exit 1;
+  fi
+  
   make install
+  if [ $? -ne 0 ]; then
+    echo "${CFAILURE}PostgreSQL make install failed! ${CEND}"
+    kill -9 $$; exit 1;
+  fi
+  
+  # 设置权限
   chmod 755 ${pgsql_install_dir}
-  chown -R postgres.postgres ${pgsql_install_dir}
+  chown -R postgres:postgres ${pgsql_install_dir}
+  
+  # 复制并修改服务文件
   /bin/cp ${oneinstack_dir}/init.d/postgresql.service /lib/systemd/system/
   sed -i "s@=/usr/local/pgsql@=${pgsql_install_dir}@g" /lib/systemd/system/postgresql.service
   sed -i "s@PGDATA=.*@PGDATA=${pgsql_data_dir}@" /lib/systemd/system/postgresql.service
+  
+  # 启用服务
   systemctl enable postgresql
-  popd
+  
+  # 初始化数据库
   su - postgres -c "${pgsql_install_dir}/bin/initdb -D ${pgsql_data_dir}"
+  if [ $? -ne 0 ]; then
+    echo "${CFAILURE}PostgreSQL initdb failed! ${CEND}"
+    kill -9 $$; exit 1;
+  fi
+  
+  # 启动服务
   systemctl start postgresql
+  if [ $? -ne 0 ]; then
+    echo "${CFAILURE}PostgreSQL start failed! ${CEND}"
+    kill -9 $$; exit 1;
+  fi
+  
   sleep 5
+  
+  # 设置密码
   su - postgres -c "${pgsql_install_dir}/bin/psql -c \"alter user postgres with password '$dbpostgrespwd';\""
+  
+  # 配置远程访问
   sed -i 's@^host.*@#&@g' ${pgsql_data_dir}/pg_hba.conf
   sed -i 's@^local.*@#&@g' ${pgsql_data_dir}/pg_hba.conf
   echo 'local   all             all                                     md5' >> ${pgsql_data_dir}/pg_hba.conf
   echo 'host    all             all             0.0.0.0/0               md5' >> ${pgsql_data_dir}/pg_hba.conf
+  
+  # 允许远程连接
   sed -i "s@^#listen_addresses.*@listen_addresses = '*'@" ${pgsql_data_dir}/postgresql.conf
+  
+  # 重新加载配置
   systemctl reload postgresql
-
+  
   if [ -e "${pgsql_install_dir}/bin/psql" ]; then
     sed -i "s+^dbpostgrespwd.*+dbpostgrespwd='$dbpostgrespwd'+" ../options.conf
     echo "${CSUCCESS}PostgreSQL installed successfully! ${CEND}"
@@ -44,6 +102,8 @@ Install_PostgreSQL() {
     echo "${CFAILURE}PostgreSQL install failed, Please contact the author! ${CEND}" && grep -Ew 'NAME|ID|ID_LIKE|VERSION_ID|PRETTY_NAME' /etc/os-release
     kill -9 $$; exit 1;
   fi
+  
+  popd
   popd
   [ -z "$(grep ^'export PATH=' /etc/profile)" ] && echo "export PATH=${pgsql_install_dir}/bin:\$PATH" >> /etc/profile
   [ -n "$(grep ^'export PATH=' /etc/profile)" -a -z "$(grep ${pgsql_install_dir} /etc/profile)" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${pgsql_install_dir}/bin:\1@" /etc/profile

+ 8 - 3
install.sh

@@ -138,8 +138,8 @@ while :; do
   --php_option)
     php_option=$2
     shift 2
-    [[ ! ${php_option} =~ ^[1-9]$|^1[0-3]$ ]] && {
-      echo "${CWARNING}php_option input error! Please only input number 1~12${CEND}"
+    [[ ! ${php_option} =~ ^[1-9]$|^1[0-4]$ ]] && {
+      echo "${CWARNING}php_option input error! Please only input number 1~14${CEND}"
       exit 1
     }
     [ -e "${php_install_dir}/bin/phpize" ] && {
@@ -403,7 +403,7 @@ if [ ${ARG_NUM} == 0 ]; then
               echo "${CWARNING}OpenResty already installed! ${CEND}"
               unset nginx_option
             }
-            [ "${nginx_option}" != '5' -a -e "${caddy_install_dir}/nginx/sbin/nginx" ] && {
+            [ "${nginx_option}" != '5' -a -e "${caddy_install_dir}/bin/caddy" ] && {
               echo "${CWARNING}Caddy already installed! ${CEND}"
               unset nginx_option
             }
@@ -648,6 +648,7 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}11${CEND}. Install php-8.1"
           echo -e "\t${CMSG}12${CEND}. Install php-8.2"
           echo -e "\t${CMSG}13${CEND}. Install php-8.3"
+          echo -e "\t${CMSG}14${CEND}. Install php-8.4"
           read -e -p "Please input a number:(Default 7 press Enter) " php_option
           php_option=${php_option:-7}
           if [[ ! ${php_option} =~ ^[1-9]$|^1[0-3]$ ]]; then
@@ -1083,6 +1084,10 @@ case "${php_option}" in
     . include/php-8.3.sh
     Install_PHP83 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
+  14)
+    . include/php-8.4.sh
+    Install_PHP84 2>&1 | tee -a ${oneinstack_dir}/install.log
+    ;;
 esac
 
 PHP_addons() {

+ 1 - 1
versions.txt

@@ -25,7 +25,7 @@ mysql57_ver=5.7.44
 mysql56_ver=5.6.51
 mysql55_ver=5.5.62
 
-mariadb1011_ver=10.11.8
+mariadb1011_ver=10.11.11
 mariadb105_ver=10.5.23
 mariadb104_ver=10.4.32
 mariadb55_ver=5.5.68