#!/bin/bash
function ok() {
if [ $? -eq 0 ];then
echo "install $1 ok" >>/tmp/onekey_install_lnmp.log
else
echo "install $1 false" >>/tmp/onekey_install_lnmp.log
exit 1
fi
}
echo "install yum updates"
yum install -y apr* autoconf automake bison bzip2 bzip2* cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng* libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libX* libtiff libtiff* make mpfr ncurses* ntp openssl nasm nasm* openssl-devel patch pcre-devel perl php-common php-gd policycoreutils ppl telnet t1lib t1lib* wget zlib-devel
ok Yum_install_success
echo "Install Cmake-3.0.2"
cd /usr/local/src
tar zxvf cmake-3.0.2.tar.gz
cd cmake-3.0.2
./configure
make && make install
ok install_cmake
echo "Install MySQL"
sleep 10
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
chown -R mysql:mysql /usr/local/mysql-5.6.21
chmod 755 -R /data/mysql
mkdir -p /usr/local/mysql-5.6.21
chmod 777 -R /usr/local/mysql-5.6.21
ln -s /usr/local/mysql-5.6.21/ /usr/local/mysql
cd /usr/local/src
tar zxvf mysql-5.6.21.tar.gz
cd mysql-5.6.21
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.6.21 -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql-5.6.21/mysql.sock -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
rm -rf /etc/my.cnf
cd /usr/local/mysql-5.6.21
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
ln -s /usr/local/mysql-5.6.21/my.cnf /etc/my.cnf
chmod 644 /etc/my.cnf
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/init.d/mysqld
chkconfig mysqld on
echo "export PATH=$PATH:/usr/local/mysql-5.6.21/bin">>/etc/profile
ln -s /usr/local/mysql/lib/ /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
ok install_MySQL
2017-05-19
安装mysql shell脚本 mysql-5.6.21.tar.gz
评论
发表评论
姓 名: