安装前置应用
1、更换yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo yum clean all && yum makecache
2、下载前置软件
yum install -y pcre-devel openssl openssl-devel cmake3 vim centos-release-scl 安装centos-release-scl后执行步骤3和4,无法安装centos-release-scl执行步骤5
3、升级c++
yum install devtoolset-8-gcc.x86_64 devtoolset-8-gcc-c++.x86_64 devtoolset-8- gcc-gdb-plugin.x86_64 -y
4、制作软连接
ln -s /opt/rh/devtoolset-8/root/usr/bin/* /usr/bin/
5、安装gcc(前提:无法安装centos-release-scl)
# 下载源码包 wget http://ftp.gnu.org/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.xz # 解压文件 xz -d gcc-7.5.0.tar.xz tar -xvf gcc-7.5.0.tar cd gcc-7.5.0 # 编译文件 ./contrib/download_prerequisites mkdir build cd build ../configure --enable-checking=release --enable-languages=c,c++ --disablemultilib make && make install
安装MySQL
卸载已有mysql
rpm -qa mysql #查询MySQL包
rpm -e mysql #卸载mysql
下载源码包
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-boost-8.0.29.tar.gz
编译MySQL
mkdir /root/lnmp
tar zxvf mysql-boost-8.0.29.tar.gz -C /root/lnmp
cd /root/lnmp/mysql-8.0.29
cmake3 -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DMYSQL_DATADIR=/usr/local/mysql/data/ \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS=all \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DWITH_INNODB_MEMCACHED=1 \ -DWITH_DEBUG=OFF \ -DWITH_ZLIB=bundled \ -DENABLED_LOCAL_INFILE=1 \ -DENABLED_PROFILING=ON \ -DMYSQL_MAINTAINER_MODE=OFF \ -DMYSQL_TCP_PORT=3306 \ -DDOWNLOAD_BOOST=1 \ -DWITH_BOOST=/root/lnmp/mysql-8.0.29/boost/
make && make install