手上没有别的服务器,本地搭建了一个虚拟机来跑下Docker服务,许多环境都要从头开始配,记录一下,以后也许用得着。
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 -y libffi-devel zlib1g-dev
yum install zlib* -y
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
tar -xvf Python-3.7.2.tar.xz
mkdir /usr/local/python3
cd Python-3.7.2
./configure --prefix=/usr/local/python3 --enable-optimizations --with-ssl
#第一个指定安装的路径,不指定的话,安装过程中可能软件所需要的文件复制到其他不同目录,删除软件很不方便,复制软件也不方便.
#第二个可以提高python10%-20%代码运行速度.
#第三个是为了安装pip需要用到ssl,后面报错会有提到.
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
# 安装docker
yum install docker
# 安装docker-compose
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
添加国内源
vi /etc/docker/daemon.json
{
"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]
}
重启服务
systemctl daemon-reload
systemctl restart docker.service
# 下载最新版本
wget https://www.sqlite.org/snapshot/sqlite-snapshot-202101022356.tar.gz
# 解压
tar -xvf sqlite-snapshot-202101022356.tar.gz
# 进入目录
cd sqlite-snapshot-202101022356
# 编译和安装
./configure
make && make install
再指定一下路径,这步不做的话Python里面的sqlite3版本不会更新,具体不清楚为什么。
export LD_LIBRARY_PATH="/usr/local/lib"