卸载mariadb
rpm -qa | grep mariadb
mariadb-libs-5.5.64-1.el7.x86_64
yum remove mariadb-libs.x86_64 -y
安装高版本GCC,解决编译中会遇到的GCC 5.3 or newer is required (-dumpversion says 4.8.5)
cd /opt
yum install centos-release-scl -y
yum install devtoolset-9 -y
scl enable devtoolset-9 zsh
gcc --version
# 后续开发包
yum -y groupinstall "Development tools"
yum -y install openssl-devel bison-devel ncurses-devel zlib-devel bzip2-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
下载编译安装cmake
# 上传cmake-3.19.3.tar.gz到/opt
cd /opt
tar -zxvf cmake-3.19.3.tar.gz
cd cmake-3.19.3
./bootstrap
make && make install
下载MySQL,选source,编译安装MySQL
# 上传mysql-boost-8.0.23.tar.gz到opt目录
cd /opt
tar -zxvf mysql-boost-8.0.23.tar.gz
cd mysql-8.0.23
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENHINE=1 \
-DEXTRA_CHARSETS=all \
-DFORCE_INSOURCE_BUILD=1 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_unicode_ci
make && make install
配置MySQL
# 设置权限,查看是否有MySQL用户和用户组
cat /etc/passwd
cat /etc/group
# 如果没有,创建用户和用户组
groupadd mysql
useradd -g mysql mysql
# 修改/usr/local/mysql权限
chown -R mysql:mysql /usr/local/mysql
初始化MySQL配置
vim ~/.zshrc
# 添加路径 export PATH=$PATH:/usr/local/mysql/bin
cd /usr/local/mysql
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cp support-files/mysql.server /etc/init.d/mysql
chkconfig mysql on
mkdir /var/lib/mysql
chmod 777 /var/lib/mysql
service mysql start
# 后续操作...
安装Python3.9.1
# 上传Python-3.9.1.tgz到opt目录
cd /opt
tar -zxvf Python-3.9.1.tgz
mkdir /usr/local/python3.9
cd Python-3.9.1
./configure --prefix=/usr/local/python3.9 --with-ssl # --enable-optimizations
make && make install
ln -s /usr/local/python3.9/bin/python3 /usr/local/bin/python3.9
ln -s /usr/local/python3.9/bin/pip3 /usr/local/bin/pip3.9
python3.9 -m pip3 install --upgrade pip
which python3.9
# /usr/local/bin/python3.9