赞
踩
sudo yum update -y
sudo yum groupinstall -y "Development Tools"
sudo yum install -y \
gcc \
openssl-devel \
bzip2-devel \
libffi-devel \
zlib-devel \
wget
# 安装高版本gcc
sudo yum install -y centos-release-scl
sudo yum install -y devtoolset-10
scl enable devtoolset-10 bash
echo "source /opt/rh/devtoolset-10/enable" >> ~/.bashrc
source ~/.bashrc
sudo yum install -y wget gcc gcc-c++ kernel-devel make
cd /usr/local/src
sudo wget http://ftp.gnu.org/gnu/gcc/gcc-10.2.1/gcc-10.2.1.tar.gz
sudo tar -xzf gcc-10.2.1.tar.gz
cd gcc-10.2.1
sudo ./contrib/download_prerequisites
sudo mkdir build
cd build
sudo ../configure --prefix=/usr/local/gcc-10.2.1 --enable-languages=c,c++ --disable-multilib
sudo make -j$(nproc)
sudo make install
sudo ln -s /usr/local/gcc-10.2.1/bin/gcc /usr/bin/gcc-10.2.1
sudo ln -s /usr/local/gcc-10.2.1/bin/g++ /usr/bin/g++-10.2.1
sudo ln -s /usr/local/gcc-10.2.1/bin/cpp /usr/bin/cpp-10.2.1
echo 'export PATH=/usr/local/gcc-10.2.1/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
gcc --version
# 安装高版本openssl
sudo yum remove openssl
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar -zxf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
make
sudo make install
sudo ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
sudo ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
sudo ldconfig
echo "source /opt/rh/devtoolset-10/enable" >> ~/.bashrc
source ~/.bashrc
openssl version
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tgz
sudo tar xzf Python-3.12.3.tgz
cd Python-3.12.3
sudo mkdir -p /data/opt/python/python3
sudo ./configure --prefix=/data/opt/python/python3 --enable-shared --enable-optimizations --with-openssl=/usr/local/openssl
# --enable-shared 开启共享
# --with-openssl 指定openssl(OpenSSL 1.1.1k)家目录
sudo make altinstall
wget https://bootstrap.pypa.io/get-pip.py
sudo /data/opt/python/python3/bin/python3.12 get-pip.py
/data/opt/python/python3/bin/python3.12 --version
/data/opt/python/python3/bin/pip3.12 --version
sudo vim /etc/profile
export LD_LIBRARY_PATH=/data/opt/python/python3/lib:$LD_LIBRARY_PATH
# Set PATH for Python 3.12 installation
export PATH="/usr/local/bin/python3.12:$PATH"
export PYTHONUSERBASE=/data/opt/python/python3
# 保存并关闭文件,然后使更改生效:
source /etc/profile
ln -s xxx xxx
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。