Ubuntu 单机多卡部署脚本: vLLM + DeepSeek 70B
# 部署脚本:Ubuntu + vLLM + DeepSeek 70B
# 执行前请确保:1. 系统为 Ubuntu 20.04/22.04 2. 拥有NVIDIA显卡(显存≥24G)
# 系统更新与基础依赖
sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential python3-pip curl git wget
# NVIDIA驱动安装(需重启)
#sudo add-apt-repository ppa:graphics-drivers/ppa -y
#sudo apt update
#sudo apt install -y nvidia-driver-550-server
echo "请手动重启系统后再次执行本脚本!"
exit 0 # 首次执行到此退出
# ---- 以下为重启后执行的第二部分 ----
#pip 使用国内源
mkdir -p $HOME/.pip/
cat <<EOF
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
EOF >$HOME/.pip/pip.conf
# Miniconda安装
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# 使用国内源
wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
source $HOME/miniconda/bin/activate
# 创建虚拟环境
conda create -n vllm python=3.11 -y
conda activate vllm
# 安装核心组件
pip install vllm huggingface_hub modelscope
# 模型下载示例(替换为实际模型ID)
MODEL_ID="deepseek-ai/DeepSeek-R1-Distill-Llama-70B"
python - <<EOF
from modelscope import snapshot_download
snapshot_download('$MODEL_ID', cache_dir='./models')
EOF
# 启动服务(根据GPU数量调整tensor-parallel-size)
vllm serve --model ./models/$MODEL_ID \
--tensor-parallel-size 4 \
--gpu-memory-utilization 0.95 \
--port 6006 \
--max-model-len 8192
# 单机多卡,这里的 --tensor-parallel-size 参数为 4 ,直接用4卡、也可以用8卡用8