基础环境
服务器基本信息
系统版本:Centos7.9
服务器配置:8C32G500G硬盘 16G显存
软件版本
显卡驱动版本:535.154.05
Python版本:3.10
Docker版本:25.0.3
Docker Compose:v2.24.5
开始部署
显卡驱动安装
使用的是阿里云的云服务器,在阿里云提供的文档中找到对应的驱动安装版本下载并安装
Python环境安装
# 进入/mnt目录下
cd /mnt
# 安装依赖
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make openssl-devel openssl11 openssl11-devel libffi-devel
# make时可能出现openssl报错,需要设置openssl环境变量
export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)
# 下载Python源码包
wget https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz
tar -xzvf Python-3.10.13.tgz
cd Python-3.10.13/
# 编译安装
./configure --prefix=/usr/local/python3 --with-ssl
make && make install
# 配置环境变量在~/.bash_profile中增加两行
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
# python3环境变量
export PYTHON_HOME=/usr/local/python3
export PATH=$PYTHON_HOME/bin:$PATH
export PATH
# 刷新环境变量
source ~/.bash_profile
安装docker及docker-compose
# 安装 Docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
systemctl enable --now docker
# 安装 docker-compose
# 下载地址:https:///docker/compose/releases/download/v2.24.5/docker-compose-linux-x86_64
cp -rf docker-compose-linux-x86_64 /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
使用到的链接地址
阿里云提供的驱动安装文档:https://help.aliyun.com/zh/egs/user-guide/install-a-gpu-driver-on-a-gpu-accelerated-compute-optimized-linux-instance?spm=a2c4g.11186623.0.0.3dc55e7ewEsPUj
Python源码包地址:https://www.python.org/ftp/python/3.10.13/Python-3.10.13.tgz
docker-compose下载地址:https:///docker/compose/releases/download/v2.24.5/docker-compose-linux-x86_64