centos7通过pip3安装docker-compose安装全过程

centos7通过pip3安装docker-compose安装全过程:

centos7默认的openssl版本和python3.10以上的版本不兼容,所以要自己编译安装openssl 1.1.1

安装前的相关工具准备:

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum install libffi-devel -y

openssl 安装:
下载解压:

https://www.openssl.org/source/openssl-1.1.1q.tar.gz
tar -zxvf openssl-1.1.1q.tar.gz

编译安装:

./config --prefix=/usr/local/openssl
make -j && make install

查看版本:

openssl version

python3和pip3安装:
下载解压:

https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
tar -zxvf Python-3.10.5.tgz

编译安装(编译安装python3解决ssl模块缺失问题,网上其他人修改Module里面的Setup文件我这边并没有成功,所以直接采用这种方式反而简单能成功):

./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl --with-openssl-rpath=auto

make && make install

创建软连接:

ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3

pip3更换阿里源:

mkdir -p  ~/.pip
cd ~/.pip/
vi pip.conf   

配置文件内容:

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com         
disable-pip-version-check = true        
timeout = 120

docker-compose安装(通过pip3安装):
安装:

pip3 install docker-compose

创建软连接:

ln -s /usr/local/python3/bin/docker-compose /usr/bin/docker-compose 

版本查看:

docker-compose version

你可能感兴趣的:(centos7通过pip3安装docker-compose安装全过程)