centos6 / 7 and the install upgrades openssl python3

Today is the last day of 2019, and looked at his year on a written essay, it is a bit pathetic to think of taking advantage of a little time now to write another, ^ _ ^

centos6 or centos 7 python are installed by default python 2 version, now you want to upgrade to python3, and the compiler to compile ssl python3 needed to bring the module parameters, so they first upgrade openssl.

I own two test machine is centos6.9 and centos7.3 of.

First you have to install dependencies:

sudo yum install zlib zlib-devel bzip2-devel openssl-devel ncurses-devel libuuid-devel sqlite-devel readline-devel tcl-devel tk-devel lzma gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel

Download and install the source code to compile:

wget ftp://ftp.fi.muni.cz/pub/openssl/source/openssl-1.1.1d.tar.gz
tar zxf openssl-1.1.1d.tar.gz
cd openssl-1.1.1d
./config --prefix=/usr/local/openssl shared zlib
make
make install

Make soft link to / usr / lib64 directory

ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

Editing shared library files loaded so

sudo vim / etc / LD .so.conf.d / openssl_1. 1.1 .conf
 / usr / local / OpenSSL / lib /    # add this line 

sudo ldconfig -v # enable effective immediately

View test version:

/usr/bin/openssl version

 

 Installation python3.7.4

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
tar zxf Python-3.7.4.tgz
cd Python-3.7.4
./configure --prefix=/usr/local/python37 --with-openssl=/usr/local/openssl/
make
make install

Create a soft link:

ln -sf /usr/local/python37/bin/python3.7 /usr/bin/python3
ln -sf /usr/local/python37/bin/pip3.7  /usr/bin/pip3

test:

 

 

You can successfully imported ssl module that is success. (* ^ ▽ ^ *)

 

Guess you like

Origin www.cnblogs.com/wangss/p/12125469.html