Browse Source

Enable MariaDB-10.3

lj2007331@gmail.com 6 years ago
parent
commit
2131260163
4 changed files with 105 additions and 57 deletions
  1. 1 1
      README.md
  2. 47 9
      include/check_download.sh
  3. 1 1
      include/check_os.sh
  4. 56 46
      install.sh

+ 1 - 1
README.md

@@ -6,7 +6,7 @@ Script properties:
 - Continually updated, Provide Shell Interaction and Autoinstall
 - Source compiler installation, most stable source is the latest version, and download from the official site
 - Some security optimization
-- Providing a plurality of database versions (MySQL-8.0, MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.1, MariaDB-10.0, MariaDB-5.5, Percona-5.7, Percona-5.6, Percona-5.5, AliSQL-5.6, PostgreSQL, MongoDB)
+- Providing a plurality of database versions (MySQL-8.0, MySQL-5.7, MySQL-5.6, MySQL-5.5, MariaDB-10.3, MariaDB-10.2, MariaDB-10.1, MariaDB-10.0, MariaDB-5.5, Percona-5.7, Percona-5.6, Percona-5.5, AliSQL-5.6, PostgreSQL, MongoDB)
 - Providing multiple PHP versions (PHP-7.2, PHP-7.1, PHP-7.0, PHP-5.6, PHP-5.5, PHP-5.4, PHP-5.3)
 - Provide Nginx, Tengine, OpenResty
 - Providing a plurality of Tomcat version (Tomcat-9, Tomcat-8, Tomcat-7, Tomcat-6)

+ 47 - 9
include/check_download.sh

@@ -255,6 +255,44 @@ checkDownload() {
         fi
         ;;
       5)
+        # MariaDB 10.3
+        if [ "${dbinstallmethod}" == '1' ]; then
+          echo "Download MariaDB 10.3 binary package..."
+          FILE_NAME=mariadb-${mariadb103_ver}-${GLIBC_FLAG}-${SYS_BIT_b}.tar.gz
+          if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
+            DOWN_ADDR_MARIADB=http://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb103_ver}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}
+            DOWN_ADDR_MARIADB_BK=http://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb103_ver}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}
+          else
+            DOWN_ADDR_MARIADB=http://ftp.osuosl.org/pub/mariadb/mariadb-${mariadb103_ver}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}
+            DOWN_ADDR_MARIADB_BK=http://mirror.nodesdirect.com/mariadb/mariadb-${mariadb103_ver}/bintar-${GLIBC_FLAG}-${SYS_BIT_a}
+          fi
+        elif [ "${dbinstallmethod}" == '2' ]; then
+          echo "Download MariaDB 10.3 source package..."
+          FILE_NAME=mariadb-${mariadb103_ver}.tar.gz
+          if [ "${IPADDR_COUNTRY}"x == "CN"x ]; then
+            DOWN_ADDR_MARIADB=http://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-${mariadb103_ver}/source
+            DOWN_ADDR_MARIADB_BK=http://mirrors.ustc.edu.cn/mariadb/mariadb-${mariadb103_ver}/source
+          else
+            DOWN_ADDR_MARIADB=http://ftp.osuosl.org/pub/mariadb/mariadb-${mariadb103_ver}/source
+            DOWN_ADDR_MARIADB_BK=http://mirror.nodesdirect.com/mariadb/mariadb-${mariadb103_ver}/source
+          fi
+        fi
+        src_url=${DOWN_ADDR_MARIADB}/${FILE_NAME} && Download_src
+        wget -4 --tries=6 -c --no-check-certificate ${DOWN_ADDR_MARIADB}/md5sums.txt -O ${FILE_NAME}.md5
+        MARAIDB_TAR_MD5=$(awk '{print $1}' ${FILE_NAME}.md5)
+        [ -z "${MARAIDB_TAR_MD5}" ] && MARAIDB_TAR_MD5=$(curl -s ${DOWN_ADDR_MARIADB_BK}/md5sums.txt | grep ${FILE_NAME} | awk '{print $1}')
+        tryDlCount=0
+        while [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" != "${MARAIDB_TAR_MD5}" ]; do
+          wget -c --no-check-certificate ${DOWN_ADDR_MARIADB_BK}/${FILE_NAME};sleep 1
+          let "tryDlCount++"
+          [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${MARAIDB_TAR_MD5}" -o "${tryDlCount}" == '6' ] && break || continue
+        done
+        if [ "${tryDlCount}" == '6' ]; then
+          echo "${CFAILURE}${FILE_NAME} download failed, Please contact the author! ${CEND}"
+          kill -9 $$
+        fi
+        ;;
+      6)
         # MariaDB 10.2
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 10.2 binary package..."
@@ -292,7 +330,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      6)
+      7)
         # MariaDB 10.1
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 10.1 binary package..."
@@ -330,7 +368,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      7)
+      8)
         # MariaDB 10.0
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 10.0 binary package..."
@@ -368,7 +406,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      8)
+      9)
         # MariaDB 5.5
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download MariaDB 5.5 binary package..."
@@ -406,7 +444,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      9)
+      10)
         # Precona 5.7
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download Percona 5.7 binary package..."
@@ -438,7 +476,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      10)
+      11)
         # Precona 5.6
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download Percona 5.6 binary package..."
@@ -471,7 +509,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      11)
+      12)
         # Percona 5.5
         if [ "${dbinstallmethod}" == '1' ]; then
           echo "Download Percona 5.5 binary package..."
@@ -504,7 +542,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      12)
+      13)
         # AliSQL 5.6
         DOWN_ADDR_ALISQL=$mirrorLink
         echo "Download AliSQL 5.6 source package..."
@@ -517,7 +555,7 @@ checkDownload() {
           [ "$(md5sum ${FILE_NAME} | awk '{print $1}')" == "${ALISQL_TAR_MD5}" ] && break || continue
         done
         ;;
-      13)
+      14)
         # PostgreSQL
         echo "Download PostgreSQL source package..."
         FILE_NAME=postgresql-${pgsql_ver}.tar.gz
@@ -543,7 +581,7 @@ checkDownload() {
           kill -9 $$
         fi
         ;;
-      14)
+      15)
         # MongoDB
         echo "Download MongoDB binary package..."
         FILE_NAME=mongodb-linux-${SYS_BIT_b}-${mongodb_ver}.tgz

+ 1 - 1
include/check_os.sh

@@ -69,7 +69,7 @@ else
 fi
 
 LIBC_YN=$(awk -v A=$(getconf -a | grep GNU_LIBC_VERSION | awk '{print $NF}') -v B=2.14 'BEGIN{print(A>=B)?"0":"1"}')
-[ $LIBC_YN == '0' ] && GLIBC_FLAG=linux-glibc_214 || GLIBC_FLAG=linux
+[ ${LIBC_YN} == '0' ] && GLIBC_FLAG=linux-glibc_214 || GLIBC_FLAG=linux
 
 if uname -m | grep -Eqi "arm"; then
   armplatform="y"

+ 56 - 46
install.sh

@@ -54,7 +54,7 @@ showhelp() {
   --php_extensions [ext name] Install PHP extension, include zendguardloader,ioncube,imagick,gmagick
   --tomcat_option [1-4]       Install Tomcat version
   --jdk_option [1-4]          Install JDK version
-  --db_option [1-14]          Install DB version
+  --db_option [1-15]          Install DB version
   --dbinstallmethod [1-2]     DB install method, default: 1 binary install
   --dbrootpwd [password]      DB super password
   --pureftpd                  Install Pure-Ftpd
@@ -124,14 +124,14 @@ while :; do
     --db_option)
       db_option=$2; shift 2
       db_yn=y
-      if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
+      if [[ "${db_option}" =~ ^[1-9]$|^1[0-3]$ ]]; then
         [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; }
-      elif [ "${db_option}" == '13' ]; then
-        [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; }
       elif [ "${db_option}" == '14' ]; then
+        [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; }
+      elif [ "${db_option}" == '15' ]; then
         [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; }
       else
-        echo "${CWARNING}db_option input error! Please only input number 1~14${CEND}"
+        echo "${CWARNING}db_option input error! Please only input number 1~15${CEND}"
         exit 1
       fi
       ;;
@@ -346,32 +346,33 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG} 2${CEND}. Install MySQL-5.7"
           echo -e "\t${CMSG} 3${CEND}. Install MySQL-5.6"
           echo -e "\t${CMSG} 4${CEND}. Install MySQL-5.5"
-          echo -e "\t${CMSG} 5${CEND}. Install MariaDB-10.2"
-          echo -e "\t${CMSG} 6${CEND}. Install MariaDB-10.1"
-          echo -e "\t${CMSG} 7${CEND}. Install MariaDB-10.0"
-          echo -e "\t${CMSG} 8${CEND}. Install MariaDB-5.5"
-          echo -e "\t${CMSG} 9${CEND}. Install Percona-5.7"
-          echo -e "\t${CMSG}10${CEND}. Install Percona-5.6"
-          echo -e "\t${CMSG}11${CEND}. Install Percona-5.5"
-          echo -e "\t${CMSG}12${CEND}. Install AliSQL-5.6"
-          echo -e "\t${CMSG}13${CEND}. Install PostgreSQL"
-          echo -e "\t${CMSG}14${CEND}. Install MongoDB"
+          echo -e "\t${CMSG} 5${CEND}. Install MariaDB-10.3"
+          echo -e "\t${CMSG} 6${CEND}. Install MariaDB-10.2"
+          echo -e "\t${CMSG} 7${CEND}. Install MariaDB-10.1"
+          echo -e "\t${CMSG} 8${CEND}. Install MariaDB-10.0"
+          echo -e "\t${CMSG} 9${CEND}. Install MariaDB-5.5"
+          echo -e "\t${CMSG}10${CEND}. Install Percona-5.7"
+          echo -e "\t${CMSG}11${CEND}. Install Percona-5.6"
+          echo -e "\t${CMSG}12${CEND}. Install Percona-5.5"
+          echo -e "\t${CMSG}13${CEND}. Install AliSQL-5.6"
+          echo -e "\t${CMSG}14${CEND}. Install PostgreSQL"
+          echo -e "\t${CMSG}15${CEND}. Install MongoDB"
           read -p "Please input a number:(Default 2 press Enter) " db_option
           [ -z "${db_option}" ] && db_option=2
-          [ "${db_option}" == '14' -a "${OS_BIT}" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
-          if [[ "${db_option}" =~ ^[1-9]$|^1[0-4]$ ]]; then
-            if [ "${db_option}" == '13' ]; then
+          [[ "${db_option}" =~ ^5$|^15$ ]] && [ "${OS_BIT}" == '32' ] && { echo "${CWARNING}By not supporting 32-bit! ${CEND}"; continue; }
+          if [[ "${db_option}" =~ ^[1-9]$|^1[0-5]$ ]]; then
+            if [ "${db_option}" == '14' ]; then
               [ -e "${pgsql_install_dir}/bin/psql" ] && { echo "${CWARNING}PostgreSQL already installed! ${CEND}"; db_yn=Other; break; }
-            elif [ "${db_option}" == '14' ]; then
+            elif [ "${db_option}" == '15' ]; then
               [ -e "${mongo_install_dir}/bin/mongo" ] && { echo "${CWARNING}MongoDB already installed! ${CEND}"; db_yn=Other; break; }
             else
               [ -d "${db_install_dir}/support-files" ] && { echo "${CWARNING}MySQL already installed! ${CEND}"; db_yn=Other; break; }
             fi
             while :; do
-              if [ "${db_option}" == '13' ]; then
+              if [ "${db_option}" == '14' ]; then
                 read -p "Please input the postgres password of PostgreSQL(default: ${dbpostgrespwd}): " dbpwd
                 [ -z "${dbpwd}" ] && dbpwd=${dbpostgrespwd}
-              elif [ "${db_option}" == '14' ]; then
+              elif [ "${db_option}" == '15' ]; then
                 read -p "Please input the root password of MongoDB(default: ${dbmongopwd}): " dbpwd
                 [ -z "${dbpwd}" ] && dbpwd=${dbmongopwd}
               else
@@ -380,9 +381,9 @@ if [ ${ARG_NUM} == 0 ]; then
               fi
               [ -n "`echo ${dbpwd} | grep '[+|&]'`" ] && { echo "${CWARNING}input error,not contain a plus sign (+) and & ${CEND}"; continue; }
               if (( ${#dbpwd} >= 5 )); then
-                if [ "${db_option}" == '13' ]; then
+                if [ "${db_option}" == '14' ]; then
                   dbpostgrespwd=${dbpwd}
-                elif [ "${db_option}" == '14' ]; then
+                elif [ "${db_option}" == '15' ]; then
                   dbmongopwd=${dbpwd}
                 else
                   dbrootpwd=${dbpwd}
@@ -393,7 +394,7 @@ if [ ${ARG_NUM} == 0 ]; then
               fi
             done
             # choose install methods
-            if [[ "${db_option}" =~ ^[1-9]$|^1[0-1]$ ]]; then
+            if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
               while :; do echo
                 echo "Please choose installation of the database:"
                 echo -e "\t${CMSG}1${CEND}. Install database from binary package."
@@ -403,13 +404,14 @@ if [ ${ARG_NUM} == 0 ]; then
                 if [[ ! ${dbinstallmethod} =~ ^[1-2]$ ]]; then
                   echo "${CWARNING}input error! Please only input number 1~2${CEND}"
                 else
+                  [ "${db_option}" == '5' -a "${LIBC_YN}" != '0' -a "$dbinstallmethod" == '1' ] && { echo "${CWARNING}MariaDB-10.3 binaries require GLIBC 2.14 or higher! ${CEND}"; continue; }
                   break
                 fi
               done
             fi
             break
           else
-            echo "${CWARNING}input error! Please only input number 1~14${CEND}"
+            echo "${CWARNING}input error! Please only input number 1~15${CEND}"
           fi
         done
       fi
@@ -738,6 +740,14 @@ case "${db_option}" in
     Install_MySQL55 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
   5)
+    if [ "${dbinstallmethod}" == "2" ]; then
+      . include/boost.sh
+      installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
+    fi
+    . include/mariadb-10.3.sh
+    Install_MariaDB103 2>&1 | tee -a ${oneinstack_dir}/install.log
+    ;;
+  6)
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -745,7 +755,7 @@ case "${db_option}" in
     . include/mariadb-10.2.sh
     Install_MariaDB102 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  6)
+  7)
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -753,15 +763,15 @@ case "${db_option}" in
     . include/mariadb-10.1.sh
     Install_MariaDB101 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  7)
+  8)
     . include/mariadb-10.0.sh
     Install_MariaDB100 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  8)
+  9)
     . include/mariadb-5.5.sh
     Install_MariaDB55 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  9)
+  10)
     if [ "${dbinstallmethod}" == "2" ]; then
       . include/boost.sh
       installBoostold 2>&1 | tee -a ${oneinstack_dir}/install.log
@@ -769,23 +779,23 @@ case "${db_option}" in
     . include/percona-5.7.sh
     Install_Percona57 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  10)
+  11)
     . include/percona-5.6.sh
     Install_Percona56 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  11)
+  12)
     . include/percona-5.5.sh
     Install_Percona55 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  12)
+  13)
     . include/alisql-5.6.sh
     Install_AliSQL56 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  13)
+  14)
     . include/postgresql.sh
     Install_PostgreSQL 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
-  14)
+  15)
     . include/mongodb.sh
     Install_MongoDB 2>&1 | tee -a ${oneinstack_dir}/install.log
     ;;
@@ -998,18 +1008,18 @@ echo "Total OneinStack Install Time: ${CQUESTION}${installTime}${CEND} minutes"
 [ "${web_yn}" == 'y' ] && [[ "${nginx_option}" =~ ^[1-3]$ ]] && echo -e "\n$(printf "%-32s" "Nginx install dir":)${CMSG}${web_install_dir}${CEND}"
 [ "${web_yn}" == 'y' ] && [[ "${apache_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Apache install dir":)${CMSG}${apache_install_dir}${CEND}"
 [[ "${tomcat_option}" =~ ^[1,2]$ ]] && echo -e "\n$(printf "%-32s" "Tomcat install dir":)${CMSG}${tomcat_install_dir}${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
-[[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
-[ "${db_option}" == '13' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
-[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
-[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
-[ "${db_option}" == '13' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
-[ "${db_option}" == '14' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
-[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
-[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
-[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-3]$ ]] && echo -e "\n$(printf "%-32s" "Database install dir:")${CMSG}${db_install_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-3]$ ]] && echo "$(printf "%-32s" "Database data dir:")${CMSG}${db_data_dir}${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-3]$ ]] && echo "$(printf "%-32s" "Database user:")${CMSG}root${CEND}"
+[[ "${db_option}" =~ ^[1-9]$|^1[0-3]$ ]] && echo "$(printf "%-32s" "Database password:")${CMSG}${dbrootpwd}${CEND}"
+[ "${db_option}" == '14' ] && echo -e "\n$(printf "%-32s" "PostgreSQL install dir:")${CMSG}${pgsql_install_dir}${CEND}"
+[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "PostgreSQL data dir:")${CMSG}${pgsql_data_dir}${CEND}"
+[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "PostgreSQL user:")${CMSG}postgres${CEND}"
+[ "${db_option}" == '14' ] && echo "$(printf "%-32s" "postgres password:")${CMSG}${dbpostgrespwd}${CEND}"
+[ "${db_option}" == '15' ] && echo -e "\n$(printf "%-32s" "MongoDB install dir:")${CMSG}${mongo_install_dir}${CEND}"
+[ "${db_option}" == '15' ] && echo "$(printf "%-32s" "MongoDB data dir:")${CMSG}${mongo_data_dir}${CEND}"
+[ "${db_option}" == '15' ] && echo "$(printf "%-32s" "MongoDB user:")${CMSG}root${CEND}"
+[ "${db_option}" == '15' ] && echo "$(printf "%-32s" "MongoDB password:")${CMSG}${dbmongopwd}${CEND}"
 [ "${php_yn}" == 'y' ] && echo -e "\n$(printf "%-32s" "PHP install dir:")${CMSG}${php_install_dir}${CEND}"
 [ "${php_yn}" == 'y' -a "${phpcache_option}" == '1' ] && echo "$(printf "%-32s" "Opcache Control Panel URL:")${CMSG}http://${IPADDR}/ocp.php${CEND}"
 [ "${phpcache_option}" == '2' ] && echo "$(printf "%-32s" "xcache Control Panel URL:")${CMSG}http://${IPADDR}/xcache${CEND}"