set -xsrc="/home/software"tgt="/usr/local"install_file="/home/software/install_file.log"error_file="/home/software/error_file.log"makeinstall(){[ $1 -ne 0 ] && tail -30 $install_file |tee -a $error_file && exit 1;make >>$install_file 2>&1[ $1 -ne 0 ] && tail -30 $install_file |tee -a $error_file && exit 1;make install >>$install_file 2>&1[ $1 -ne 0 ] && tail -30 $install_file |tee -a $error_file && exit 1;}install(){#install cmakecd $srctouch {install_file,error_file}.logtar zxvf cmake-2.8.12.1.tar.gz >>$install_file 2>&1cd cmake-2.8.12.1./bootstrap >>$install_file 2>&1makeinstall $?#install mysqlyum -y install ncurses* >>$install_file 2>&1cd $srctar zxvf mysql-5.5.35.tar.gzcd mysql-5.5.35$src/cmake-2.8.12.1/bin/cmake -DCMAKE-INSTALL-PRIFIX=/usr/local/mysql -DDEFAULT-CHARSET=utf8 >>$install_file 2>&1makeinstall $?cp -f support-files/my-large.cnf /etc/my.cnf >>$install_file 2>&1cp support-files/mysql.server /etc/init.d/mysqld >>$install_file 2>&1chmod 755 /etc/init.d/mysqlduseradd mysql >>$install_file 2>&1cd /usr/local/mysql/ >>$install_file 2>&1chown -R mysql:mysql * >>$install_file 2>&1./scripts/mysql_install_db --user=mysql >>$install_file 2>&1chown -R root * >>$install_file 2>&1chown -R mysql data >>$install_file 2>&1echo "/usr/local/mysql/bin/mysqld_safe &" >> /etc/rc.localservice mysqld start}install
转载于:https://www.cnblogs.com/txhy/p/10643878.html