首先不管安装什么软件都要把一些依赖包安装好:
Centos/redhat 安装
yum -y install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml2 libxml2-devel libgcrypt libtool bison
Ubuntu安装
apt-get install gcc-c++ ncurses-devel cmake make perl gcc autoconf automake zlib libxml2 libxml2-devel libgcrypt libtool bison
!/bin/bash
#auto install LAMP
#by 杨进 2021-02
#Httpd define path variable
#MySQL define path variable
M_FILES=mysql-5.5.62.tar.gz
M_FILES_DIR=mysql-5.5.62
M_URL=https://mirrors.cnnic.cn/mysql/downloads/MySQL-5.5
M_PREFIX=/usr/local/mysql
wget -c $M_URL/$M_FILES && tar -xzvf $M_FILES && cd $M_FILES_DIR && yum install cmake -y;cmake . -DCMAKE_INSTALL_PREFIX=$M_PREFIX \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_DATADIR=/data/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_BIG_TABLES=1 \
-DWITH_DEBUG=0
make && make install
/bin/cp support-files/my-small.cnf /etc/my.conf
/bin/cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
if [ $? -eq 0 ];then
make && make install
echo -e "\n\033[32m-----------------------------------------------\033[0m"
echo -e "\033[32mThe $M_FILES_DIR Server Install Success !\033[0m"
else
echo -e "\033[32mThe $M_FILES_DIR Make or Make install ERROR,Please Check......"
exit 0
网友评论