windows下使用WSL部署Dify+vLLM
·
安装wsl发行版
wsl --install -d Ubuntu-22.04 --name dify-vllm --location D:\WSL\dify-vllm
进入wsl环境:
1. 输入nvidia-smi,确认已经安装了nvidia驱动
2. 安装 Docker Engine
执行以下命令(逐条复制运行)
# 更新包管理器并安装依赖
sudo apt update && sudo apt upgrade -y
sudo apt install -y ca-certificates curl
# 添加 Docker 官方 GPG 密钥和仓库
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 安装 Docker 引擎和 Docker Compose 插件
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# 将当前用户加入 docker 组,免 sudo 运行
sudo usermod -aG docker $USER
newgrp docker # 立即生效(或退出重新登录)
# 启动 Docker 服务
sudo service docker start
验证安装:
docker --version
docker compose version
3. 部署 Dify
# 克隆 Dify 项目
git clone https://github.com/langgenius/dify.git
cd dify/docker
# 复制环境变量配置文件
cp .env.example .env
# 启动所有服务(后台运行)
docker compose up -d
等待镜像拉取和容器启动完毕,通过 Windows 浏览器访问:
http://localhost:80
4. 部署vLLM
安装uv
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
使用uv创建虚拟环境,~/pyenvs/vllmenv会自动创建
uv venv ./pyenvs/vllmenv --python 3.11
激活虚拟环境:
source pyenvs/vllmenv/bin/activate
安装vllm
uv pip install vllm
安装huggingface-cli,下载模型权重用
uv pip install huggingface_hub
使用hf-mirror加速下载
echo 'export HF_ENDPOINT=https://hf-mirror.com' >> ~/.bashrc
source ~/.bashrc
下载模型到指定目录,需要查找到模型在huggingface上的ID
hf download Qwen/Qwen3.6-35B-A3B \
--local-dir ~/vllmModels/Qwen3.6-35B-A3B
下载完成后,使用vllm启动,本地路径
python -m vllm.entrypoints.openai.api_server \
--model ~/vllmModels/Qwen3.6-35B-A3B \
--gpu-memory-utilization 0.95 \
--port 8000
更多推荐


所有评论(0)