千家信息网

mysql源码安装的脚本分享

发表于:2024-12-13 作者:千家信息网编辑
千家信息网最后更新 2024年12月13日,这篇文章主要讲解了"mysql源码安装的脚本分享",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"mysql源码安装的脚本分享"吧!代码如下:#!/bin
千家信息网最后更新 2024年12月13日mysql源码安装的脚本分享

这篇文章主要讲解了"mysql源码安装的脚本分享",文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习"mysql源码安装的脚本分享"吧!

代码如下:

#!/bin/bashPATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/binexport PATHclear;SysName=""SysBit=""CpuNum=""RamTotal=""RamSwap=""FileMax=""MysqlVersion="Percona-Server-5.6.15-rel63.0"MysqlLine="http://www.percona.com/downloads/Percona-Server-5.6/LATEST/source"MysqlPath="/usr/local/mysql"MysqlDataPath="$MysqlPath/data"MysqlLogPath="/var/log/mysql"MysqlConfigPath="$MysqlPath/conf"MysqlPass="test123"SYSTEM_CHECK(){ [[ $(id -u) != '0' ]] && echo '[Error] Please use root to install PUPPET.' && exit; egrep -i "centos" /etc/issue && SysName='centos'; egrep -i "ubuntu" /etc/issue && SysName='ubuntu'; [[ "$SysName" == '' ]] && echo '[Error] Your system is not supported this script' && exit; SysBit='32' && [ `getconf WORD_BIT` == '32' ] && [ `getconf LONG_BIT` == '64' ] && SysBit='64'; CpuNum=`cat /proc/cpuinfo |grep 'processor'|wc -l`; RamTotal=`free -m | grep 'Mem' | awk '{print $2}'`; RamSwap=`free -m | grep 'Swap' | awk '{print $2}'`; FileMax=`cat /proc/sys/fs/file-max`}INSTALL_BASE_PACKAGES(){ SYSTEM_CHECK if [ "$SysName" == 'centos' ]; then  echo '[yum-fastestmirror Installing] ************************************************** >>';  yum -y install yum-fastestmirror;  cp /etc/yum.conf /etc/yum.conf.lnmp  sed -i 's:exclude=.*:exclude=:g' /etc/yum.conf  for packages in gcc gcc-c++ openssl-devel ncurses-devel wget crontabs iptables bison cmake automake make readline-devel logrotate openssl; do    echo "[${packages} Installing] ************************************************** >>";   yum -y install $packages;   done;  mv -f /etc/yum.conf.lnmp /etc/yum.conf; else  apt-get remove -y mysql-client mysql-server mysql-common;  apt-get update;  for packages in gcc g++ cmake make ntp logrotate cron bison libncurses5-dev libncurses5 libssl-dev openssl curl openssl; do   echo "[${packages} Installing] ************************************************** >>";   apt-get install -y $packages --force-yes;apt-get -fy install;apt-get -y autoremove;   done; fi;}INSTALL_MYSQL(){ INSTALL_BASE_PACKAGES cd /tmp/ echo "[${MysqlVersion} Installing] ************************************************** >>"; [ ! -f ${MysqlVersion}.tar.gz ] && wget -c ${MysqlLine}/${MysqlVersion}.tar.gz tar -zxf /tmp/$MysqlVersion.tar.gz; cd /tmp/$MysqlVersion; groupadd mysql; useradd -s /sbin/nologin -g mysql mysql; cmake -DCMAKE_INSTALL_PREFIX=$MysqlPath  -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=complex -DWITH_READLINE=ON -DENABLED_LOCAL_INFILE=ON -DWITH_INNODB_MEMCACHED=ON -DWITH_UNIT_TESTS=OFF; make -j $Cpunum; make install; for path in $MysqlLogPath $MysqlPath $MysqlConfigPath/conf.d $MysqlDataPath;do  [ ! -d $path ] && mkdir -p $path  chmod 740 $path;  chown -R mysql:mysql $path; done# EOF **********************************cat > $MysqlConfigPath/my.cnf< /etc/ld.so.conf.d/mysql.conf<

感谢各位的阅读,以上就是"mysql源码安装的脚本分享"的内容了,经过本文的学习后,相信大家对mysql源码安装的脚本分享这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是,小编将为大家推送更多相关知识点的文章,欢迎关注!

0