gdbm mysql函数库_[shell]脚本库(PHP,MySQL,Mariadb)

PHP多版本编译安装脚本

#!/bin/bash

#Auto Install PHP (5.6|7.0|7.1)

. /etc/init.d/functions

clear

#Root test

[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

install_log_name=install_php.log

env_file=/etc/profile.d/php.sh

install_log_path=/var/log/appinstall/

download_path=/tmp/tmpdir/

install_path=/usr/local/

src_path=/usr/local/src/

php_dir=/usr/local/php

sys_version=`rpm -q centos-release|cut -d- -f3`

clear

echo "##########################################"

echo "# #"

echo "# 安装 PHP 5.6 7.0 7.1 #"

echo "# #"

echo "##########################################"

echo "1: Install PHP-5.6"

echo "2: Install PHP-7.0"

echo "3 Install PHP-7.1"

echo "4: EXIT"

# 选择安装软件版本

read -p "Please input your choice:" softversion

# 传入内容,格式化内容输出,可以传入多个参数,用空格隔开

ok_msg() {

for msg in $*;do

action $msg /bin/true

done

}

error_msg() {

for msg in $*;do

action $msg /bin/false

done

}

base_yum_install() {

echo '----------------------------环境安装-------------------------------'

for package in $*;do

yum install -y ${package} &> /dev/null

ok_msg "安装软件包:${package}"

done

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` Install completed">>${install_log_path}${install_log_name} && return 0

else

echo "`date +%F' '%H:%M:%S` Install fail!">>${install_log_path}${install_log_name} && return 1

fi

}

# 判断命令是否存在,第一个参数 $1 为判断的命令,第二个参数为提供该命令的yum 软件包名称

check_yum_command() {

ok_msg "命令检查:$1"

hash $1 &> /dev/null

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` check command $1 ">>${install_log_path}${install_log_name} && return 0

else

yum -y install $2 >/dev/null 2>&1

fi

}

# 判断目录是否存在,传入目录绝对路径,可以传入多个目录

check_dir() {

echo '----------------------------目录检测-------------------------------'

for dirname in $*;do

[ -d ${dirname} ] || mkdir -p $dirname &> /dev/null

ok_msg "目录检查:${dirname}"

done

echo "`date +%F' '%H:%M:%S` 目录检查 check success!" >> ${install_log_path}${install_log_name}

}

# 下载文件并解压至安装目录,传入url链接地址

download_file() {

ok_msg "下载源码包:$2"

mkdir -p $download_path

wget $1 -c -P $download_path &> /dev/null

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` $2 download success!">>${install_log_path}${install_log_name}

else

echo "`date +%F' '%H:%M:%s` $2 download fail!">>${install_log_path}${install_log_name} && exit 1

fi

}

# 解压文件,可以传入多个压缩文件绝对路径,用空格隔开,解压至安装目录

extract_file() {

ok_msg "解压源码包:$2"

cd ${download_path}

for file in $1;do

if [ "${file##*.}" == "gz" ];then

tar -zxf $file -C ${src_path} && echo "`date +%F' '%H:%M:%S` $file extrac success!,path is $src_path">>${install_log_path}${install_log_name}

elif [ "${file##*.}" == "zip" ];then

unzip -q $file -d ${src_path} && echo "`date +%F' '%H:%M:%S` $file extrac success!,path is $src_path">>${install_log_path}${install_log_name}

else

echo "`date +%F' '%H:%M:%S` $file type error, extrac fail!">>${install_log_path}${install_log_name} && exit 1

fi

done

}

# 配置环境变量,第一个参数为添加环境变量的绝对路径

config_env() {

ok_msg "环境变量配置"

echo "export PATH=\$PATH:$1" >${env_file}

source ${env_file} && echo "`date +%F' '%H:%M:%S` 软件安装完成!">> ${install_log_path}${install_log_name}

}

# 编译PHP函数

compile_php() {

echo '------------------------------安装PHP-----------------------------'

cd ${src_path}${php_name}

./configure --prefix=${php_dir} --exec-prefix=${php_dir} --bindir=${php_dir}/bin --sbindir=${php_dir}/sbin --includedir=${php_dir}/include --libdir=${php_dir}/lib/php --mandir=${php_dir}/php/man --with-config-file-path=${php_dir}/etc --with-mhash --with-openssl --with-mysqli --with-pdo-mysql --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --without-gdbm --disable-fileinfo &> /dev/null

if [ $? -eq 0 ];then

ok_msg "编译PHP"

echo "`date +%F' '%H:%M:%S` 编译成功!">> ${install_log_path}${install_log_name}

else

error_msg "编译PHP"

echo "`date +%F' '%H:%M:%S` 编译失败!">> ${install_log_path}${install_log_name}

exit 1

fi

make &> /dev/null

make install &> /dev/null

if [ $? -eq 0 ];then

ok_msg "安装PHP"

echo "`date +%F' '%H:%M:%S` 编译成功!">> ${install_log_path}${install_log_name}

else

error_msg "安装PHP"

echo "`date +%F' '%H:%M:%S` 编译失败!">> ${install_log_path}${install_log_name}

exit 1

fi

/bin/cp php.ini-production ${php_dir}/etc/php.ini

ok_msg "安装PHP-FPM"

[ ! -f /etc/init.d/php-fpm ] && wget -O /etc/init.d/php-fpm https://anchnet-script.oss-cn-shanghai.aliyuncs.com/php/php-fpm &> /dev/null

chmod a+x /etc/init.d/php-fpm

id www &> /dev/null

USER=`echo $?`

if [ $USER -eq 1 ];then

useradd -s /sbin/nologin -M www

fi

rm -fr /etc/php.ini

ln -s ${phpdir}/etc/php.ini /etc/php.ini

cd ${php_dir}/etc && /bin/cp php-fpm.conf.default php-fpm.conf

[ -d ${php_dir}/etc/php-fpm.d ] && cd php-fpm.d && /bin/cp www.conf.default www.conf

if [ ${sys_version} == "7" ];then

chkconfig --add php-fpm

systemctl start php-fpm

elif [ ${sys_version} == "6" ];then

/etc/init.d/php-fpm start &> /dev/null

fi

netstat -tunlp | grep php-fpm &> /dev/null

[ $? -eq 0 ] && ok_msg "启动服务" || error_msg "启动服务"

echo "`date +%F' '%H:%M:%S` PHP安装完成!">> ${install_log_path}${install_log_name}

}

main() {

check_dir $src_path $install_log_path $install_path $download_path $php_dir

check_yum_command wget wget

check_yum_command unzip unzip

base_yum_install make cmake gcc gcc-c++ flex bison file libtool libtool-libs autoconf libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl-devel gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap lsof curl-devel

download_file $URL PHP

for filename in `ls $download_path`;do

extract_file ${download_path}$filename ${filename}

done

php_name=`ls ${src_path} | grep php`

compile_php

rm -fr ${download_path}

config_env ${php_dir}/bin

}

case ${softversion} in

1)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/php/php-5.6.31.tar.gz"

main

;;

2)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/php/php-7.0.22.tar.gz"

main

;;

3)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/php/php-7.1.8.tar.gz"

main

;;

4)

exit 0

;;

*)

echo "input Error! Place input{1|2|3|4}"

exit 1

esac

MySQL多版本编译安装脚本

#!/bin/bash

# CentOS 6|7 已测试

# Time: 2018-8-10

# install_mysql

# CentOS 6已适配,7服务启动脚本未适配

. /etc/init.d/functions

[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

install_log_name=install_mysql.log

env_file=/etc/profile.d/mysql.sh

install_log_path=/var/log/appinstall/

download_path=/tmp/tmpdir/

install_path=/usr/local/

src_path=/usr/local/src/

mysql_dir=/usr/local/mysql

mysql_data=/usr/local/mysql/data

sys_version=`rpm -q centos-release|cut -d- -f3`

clear

echo "##########################################"

echo "# #"

echo "# 安装 MySQL 5.5 5.6 5.7 #"

echo "# #"

echo "##########################################"

echo "1: Install MySQL-5.5"

echo "2: Install MySQL-5.6"

echo "3: Install MySQL-5.7"

echo "4: EXIT"

# 选择安装软件版本

read -p "Please input your choice:" softversion

# 传入内容,格式化内容输出,可以传入多个参数,用空格隔开

ok_msg() {

for msg in $*;do

action $msg /bin/true

done

}

error_msg() {

for msg in $*;do

action $msg /bin/false

done

}

base_yum_install() {

echo '----------------------------环境安装-------------------------------'

for package in $*;do

yum install -y ${package} &> /dev/null

ok_msg "安装软件包:${package}"

done

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` 环境安装完成">>${install_log_path}${install_log_name} && return 0

else

echo "`date +%F' '%H:%M:%S` 环境安装失败">>${install_log_path}${install_log_name} && return 1

fi

}

# 判断命令是否存在,第一个参数 $1 为判断的命令,第二个参数为提供该命令的yum 软件包名称

check_yum_command() {

ok_msg "命令检查:$1"

hash $1 &> /dev/null

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` check command $1 ">>${install_log_path}${install_log_name} && return 0

else

yum -y install $2 >/dev/null 2>&1

fi

}

# 判断目录是否存在,传入目录绝对路径,可以传入多个目录

check_dir() {

echo '----------------------------目录检测-------------------------------'

for dirname in $*;do

[ -d ${dirname} ] || mkdir -p $dirname &> /dev/null

ok_msg "目录检查:${dirname}"

done

echo "`date +%F' '%H:%M:%S` 目录检查完成" >> ${install_log_path}${install_log_name}

}

# 下载文件并解压至安装目录,传入url链接地址

download_file() {

ok_msg "下载源码包:$2"

mkdir -p $download_path

wget $1 -c -P $download_path &> /dev/null

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` $2 下载完成">>${install_log_path}${install_log_name}

else

echo "`date +%F' '%H:%M:%s` $2 下载失败">>${install_log_path}${install_log_name} && exit 1

fi

}

# 解压文件,可以传入多个压缩文件绝对路径,用空格隔开,解压至安装目录

extract_file() {

ok_msg "解压源码包:$2"

cd ${download_path}

for file in $1;do

if [ "${file##*.}" == "gz" ];then

tar -zxf $file -C ${src_path} && echo "`date +%F' '%H:%M:%S` $file 解压完成">>${install_log_path}${install_log_name}

elif [ "${file##*.}" == "zip" ];then

unzip -q $file -d ${src_path} && echo "`date +%F' '%H:%M:%S` $file 解压失败">>${install_log_path}${install_log_name}

else

echo "`date +%F' '%H:%M:%S` $file type error, extrac fail!">>${install_log_path}${install_log_name} && exit 1

fi

done

}

# 配置环境变量,第一个参数为添加环境变量的绝对路径

config_env() {

ok_msg "环境变量配置"

echo "export PATH=\$PATH:$1" >${env_file}

source ${env_file} && echo "`date +%F' '%H:%M:%S` 软件安装完成!">> ${install_log_path}${install_log_name}

}

# 编译MySQL函数

compile_mysql() {

echo '----------------------------安装MySQL------------------------------'

cd ${src_path}${mysql_name}

id mysql &> /dev/null

USER=`echo $?`

if [ $USER -eq 1 ];then

groupadd mysql

useradd -g mysql mysql -s /bin/false

chown -R mysql:mysql /usr/local/mysql/data

fi

echo "`date +%F' '%H:%M:%S` 用户添加完成!">> ${install_log_path}${install_log_name}

ok_msg "MySQL用户"

if [ ${softversion} == "1" ];then

cmake . -DCMAKE_INSTALL_PREFIX=${mysql_dir} -DMYSQL_DATADIR=${mysql_data} -DSYSCONFDIR=/etc &> /dev/null

STATUS=$?

[ $? -eq 0 ] && ok_msg "Cmake完成" || error_msg "Cmake完成"

elif [ ${softversion} == "2" ];then

cmake . -DCMAKE_INSTALL_PREFIX=${mysql_dir} -DMYSQL_DATADIR=${mysql_data} -DSYSCONFDIR=/etc &> /dev/null

STATUS=$?

[ $? -eq 0 ] && ok_msg "Cmake完成" || error_msg "Cmake完成"

elif [ ${softversion} == "3" ];then

boost_url="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mysql/boost_1_59_0.tar.gz"

download_file ${boost_url} boost

tar -zxf /tmp/tmpdir/boost_1_59_0.tar.gz -C /usr/local/

cmake . -DCMAKE_INSTALL_PREFIX=${mysql_dir} -DMYSQL_DATADIR=${mysql_data} -DSYSCONFDIR=/etc -DWITH_BOOST=/usr/local/boost_1_59_0 &> /dev/null

STATUS=$?

[ $? -eq 0 ] && ok_msg "Cmake完成" || error_msg "Cmake完成"

fi

if [ ${STATUS} -eq 0 ];then

echo "`date +%F' '%H:%M:%S` Cmake成功!">> ${install_log_path}${install_log_name}

else

error_msg "编译MySQL"

echo "`date +%F' '%H:%M:%S` Cmake失败!">> ${install_log_path}${install_log_name} && exit 1

exit 1

fi

make

make install &> /dev/null

mv /etc/my.cnf /etc/my.cnf.bak

if [ ${softversion} == "1" ];then

/bin/cp ${mysql_dir}/support-files/my-medium.cnf /etc/my.cnf

elif [ ${softversion} == "2" ];then

/bin/cp ${mysql_dir}/support-files/my-default.cnf /etc/my.cnf

elif [ ${softversion} == "3" ];then

wget -O /etc/my.cnf https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mysql/my-medium.cnf &> /dev/null

fi

if [ ${softversion} == "3" ];then

continue

else

echo "datadir = ${mysql_data}" >> /etc/my.cnf

echo "basedir = ${mysql_dir}" >> /etc/my.cnf

fi

if [ ${softversion} == "3" ];then

${mysql_dir}/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &> /dev/null

[ $? -eq 0 ] && ok_msg "DB初始化" || error_msg "DB初始化" && exit 1

else

chmod +x ./scripts/mysql_install_db

./scripts/mysql_install_db --user=mysql --basedir=${mysql_dir} --datadir=/usr/local/mysql/data &> /dev/null

[ $? -eq 0 ] && ok_msg "DB初始化" || error_msg "DB初始化" && exit 1

fi

echo "`date +%F' '%H:%M:%S` MySQL db初始化安装完成!">> ${install_log_path}${install_log_name}

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod 755 /etc/init.d/mysqld

if [ ${sys_version} == "7" ];then

chkconfig --add mysqld

systemctl start mysqld

elif [ ${sys_version} == "6" ];then

/etc/init.d/mysqld start &> /dev/null

fi

ok_msg "安装MySQL"

echo "`date +%F' '%H:%M:%S` MySQL安装完成!">> ${install_log_path}${install_log_name}

netstat -tunlp | grep mysql &> /dev/null

[ $? -eq 0 ] && ok_msg "启动MySQL" || error_msg "启动MySQL"

}

#主函数

main() {

check_dir $src_path $install_log_path $install_path $download_path $mysql_dir $mysql_data

check_yum_command wget wget

check_yum_command unzip unzip

base_yum_install install make gcc-c++ cmake bison-devel ncurses-devel vimbison libgcrypt perl

download_file $URL MySQL

for filename in `ls $download_path`;do

extract_file ${download_path}$filename ${filename}

done

mysql_name=`ls ${src_path} | grep mysql`

compile_mysql

rm -fr ${download_path}

config_env ${apache_dir}/bin

}

case ${softversion} in

1)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mysql/mysql-5.5.57.tar.gz"

main

;;

2)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mysql/mysql-5.6.37.tar.gz"

main

;;

3)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mysql/mysql-5.7.19.tar.gz"

main

;;

4)

exit 0

;;

*)

echo "input Error! Place input{1|2|3|4}"

exit 1

esac

Mariadb多版本编译安装脚本

#!/bin/bash

# CentOS 6|7 已测试

# Time: 2018-8-10

# install_mariadb

. /etc/init.d/functions

[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

install_log_name=install_mariadb.log

env_file=/etc/profile.d/mariadb.sh

install_log_path=/var/log/appinstall/

download_path=/tmp/tmpdir/

install_path=/usr/local/

src_path=/usr/local/src/

mariadb_dir=/usr/local/mysql

mariadb_data=/usr/local/mysql/data

sys_version=`rpm -q centos-release|cut -d- -f3`

clear

echo "##########################################"

echo "# #"

echo "# 安装 mariadb 5.5 10.1 10.2 10.3 #"

echo "# #"

echo "##########################################"

echo "1: Install Mariadb-5.5"

echo "2: Install Mariadb-10.1"

echo "3: Install Mariadb-10.2"

echo "4: Install Mariadb-10.3"

echo "5: EXIT"

# 选择安装软件版本

read -p "Please input your choice:" softversion

# 传入内容,格式化内容输出,可以传入多个参数,用空格隔开

ok_msg() {

for msg in $*;do

action $msg /bin/true

done

}

error_msg() {

for msg in $*;do

action $msg /bin/false

done

}

base_yum_install() {

echo '----------------------------环境安装-------------------------------'

for package in $*;do

yum install -y ${package} &> /dev/null

ok_msg "安装软件包:${package}"

done

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` 环境安装完成">>${install_log_path}${install_log_name} && return 0

else

echo "`date +%F' '%H:%M:%S` 环境安装失败">>${install_log_path}${install_log_name} && return 1

fi

}

# 判断命令是否存在,第一个参数 $1 为判断的命令,第二个参数为提供该命令的yum 软件包名称

check_yum_command() {

ok_msg "命令检查:$1"

hash $1 &> /dev/null

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` check command $1 ">>${install_log_path}${install_log_name} && return 0

else

yum -y install $2 >/dev/null 2>&1

fi

}

# 判断目录是否存在,传入目录绝对路径,可以传入多个目录

check_dir() {

echo '----------------------------目录检测-------------------------------'

for dirname in $*;do

[ -d ${dirname} ] || mkdir -p $dirname &> /dev/null

ok_msg "目录检查:${dirname}"

done

echo "`date +%F' '%H:%M:%S` 目录检查完成" >> ${install_log_path}${install_log_name}

}

# 下载文件并解压至安装目录,传入url链接地址

download_file() {

ok_msg "下载源码包:$2"

mkdir -p $download_path

wget $1 -c -P $download_path &> /dev/null

if [ $? -eq 0 ];then

echo "`date +%F' '%H:%M:%S` $2 下载完成">>${install_log_path}${install_log_name}

else

echo "`date +%F' '%H:%M:%s` $2 下载失败">>${install_log_path}${install_log_name} && exit 1

fi

}

# 解压文件,可以传入多个压缩文件绝对路径,用空格隔开,解压至安装目录

extract_file() {

ok_msg "解压源码包:$2"

cd ${download_path}

for file in $1;do

if [ "${file##*.}" == "gz" ];then

tar -zxf $file -C ${src_path} && echo "`date +%F' '%H:%M:%S` $file 解压完成">>${install_log_path}${install_log_name}

elif [ "${file##*.}" == "zip" ];then

unzip -q $file -d ${src_path} && echo "`date +%F' '%H:%M:%S` $file 解压失败">>${install_log_path}${install_log_name}

else

echo "`date +%F' '%H:%M:%S` $file type error, extrac fail!">>${install_log_path}${install_log_name} && exit 1

fi

done

}

# 配置环境变量,第一个参数为添加环境变量的绝对路径

config_env() {

ok_msg "环境变量配置"

echo "export PATH=\$PATH:$1" >${env_file}

source ${env_file} && echo "`date +%F' '%H:%M:%S` 软件安装完成!">> ${install_log_path}${install_log_name}

}

# 编译mariadb函数

compile_mariadb() {

echo '----------------------------安装MySQL------------------------------'

cd ${src_path}${mariadb_name}

id mysql &> /dev/null

USER=`echo $?`

if [ $USER -eq 1 ];then

groupadd mysql

useradd -g mysql mysql -s /bin/false

chown -R mysql:mysql /usr/local/mysql/data

fi

echo "`date +%F' '%H:%M:%S` 用户添加完成!">> ${install_log_path}${install_log_name}

ok_msg "Mariadb用户"

cmake . -DCMAKE_INSTALL_PREFIX=${mariadb_dir} -DMYSQL_DATADIR=${mariadb_data} -DSYSCONFDIR=/etc -DWITHOUT_TOKUDB=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci &> /dev/null

if [ $? -eq 0 ];then

ok_msg "Cmake完成"

echo "`date +%F' '%H:%M:%S` Cmake成功!">> ${install_log_path}${install_log_name}

else

error_msg "Cmake完成"

echo "`date +%F' '%H:%M:%S` Cmake失败!">> ${install_log_path}${install_log_name}

exit 1

fi

make

make install &> /dev/null

[ -f /etc/my.cnf ] && mv /etc/my.cnf /etc/my.cnf.bak

/bin/cp ${mariadb_dir}/support-files/my-medium.cnf /etc/my.cnf

chmod +x ./scripts/mysql_install_db

./scripts/mysql_install_db --user=mysql --basedir=${mariadb_dir} --datadir=${mariadb_data} &> /dev/null

[ $? -eq 0 ] && ok_msg "DB初始化" || error_msg "DB初始化"

echo "`date +%F' '%H:%M:%S` Mariadb db初始化安装完成!">> ${install_log_path}${install_log_name}

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod 755 /etc/init.d/mysqld

if [ ${sys_version} == "7" ];then

chkconfig --add mysqld

systemctl start mysqld

elif [ ${sys_version} == "6" ];then

/etc/init.d/mysqld start &> /dev/null

fi

ok_msg "安装Mariadb"

echo "`date +%F' '%H:%M:%S` Mariadb安装完成!">> ${install_log_path}${install_log_name}

netstat -tunlp | grep mysql &> /dev/null

[ $? -eq 0 ] && ok_msg "启动Mariadb" || error_msg "启动Mariadb"

echo "`date +%F' '%H:%M:%S` Mariadb启动成功!">> ${install_log_path}${install_log_name}

}

#主函数

main() {

check_dir $src_path $install_log_path $install_path $download_path $mariadb_dir $mariadb_data

check_yum_command wget wget

check_yum_command unzip unzip

base_yum_install install make gcc-c++ cmake bison-devel ncurses-devel vimbison libgcrypt perl libaio-devel Judy Judy-devel openssl-devel libevent-devel

download_file $URL Mariadb

for filename in `ls $download_path`;do

extract_file ${download_path}$filename ${filename}

done

mariadb_name=`ls ${src_path} | grep mariadb`

compile_mariadb

rm -fr ${download_path}

config_env ${mariadb_dir}/bin

}

case ${softversion} in

1)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mariadb/mariadb-5.5.61.tar.gz"

main

;;

2)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mariadb/mariadb-10.1.35.tar.gz"

main

;;

3)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mariadb/mariadb-10.2.17.tar.gz"

main

;;

4)

URL="https://anchnet-script.oss-cn-shanghai.aliyuncs.com/mariadb/mariadb-10.3.9.tar.gz"

main

;;

5)

exit 0

;;

*)

echo "input Error! Place input{1|2|3|4}"

exit 1

esac

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值