在服务器Ubuntu22.04系统下,ComfyUI的部署
创始人
2024-09-26 16:25:45
0

在服务器Ubuntu22.04系统下,ComfyUI的部署

  • 一、安装环境:ubuntu基本环境配置
      • 1.更新包列表:
      • 2. 安装GPU驱动程序
      • 3.查看显卡信息
      • 4.下载并安装 CUDA 12.3
  • 二、安装miniconda环境
      • 1. 下载miniconda3
      • 2. 安装miniconda3
      • 3. 打开用户环境编辑页面
      • 4.conda配置
      • 5. 重新加载用户环境变量
      • 6. 创建Comfyui需要的环境
  • 三、克隆Comfyui仓库

一、安装环境:ubuntu基本环境配置

1.更新包列表:

修改配置文件

vi /etc/apt/sources.list 

将原有的内容注释(每行最前面加#)
在最后添加以下内容

########   Ubuntu22.04LTS 清华镜像源   ############### # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse   # 预发布软件源,不建议启用 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse 

更新软件列表

sudo apt-get update 

更新本地软件

sudo apt upgrade 

更新时间较长,请耐心等待

2. 安装GPU驱动程序

  • 这个命令会列出您的系统硬件信息,以及推荐的驱动程序版本
ubuntu-drivers devices 
  • 这里的4090建议安装 nvidia-driver-535 驱动程序
sudo apt update sudo apt install nvidia-driver-535 
  • 安装完成后,请务必重启您的系统,以便新的驱动程序生效。
reboot 

3.查看显卡信息

nvidia-smi 

在这里插入图片描述

4.下载并安装 CUDA 12.3

访问 NVIDIA CUDA Toolkit 下载页面,选择 CUDA 12.3 版本。对于 Ubuntu,您可能需要运行类似以下的命令:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/12.3.0/local_installers/cuda-repo-ubuntu2204-12-3-local_12.3.0-545.23.06-1_amd64.deb sudo dpkg -i cuda-repo-ubuntu2204-12-3-local_12.3.0-545.23.06-1_amd64.deb sudo cp /var/cuda-repo-ubuntu2204-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda-toolkit-12-3 
  • 设置环境变量: 编辑 vi ~/.bashrc 文件,添加以下行:
export PATH=/usr/local/cuda-12.3/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 
  • 应用环境变量更改:
source ~/.bashrc 
  • 验证安装:
nvcc --version 

在这里插入图片描述

二、安装miniconda环境

1. 下载miniconda3

wget https://mirrors.cqupt.edu.cn/anaconda/miniconda/Miniconda3-py310_23.10.0-1-Linux-x86_64.sh 

2. 安装miniconda3

bash Miniconda3-py310_23.10.0-1-Linux-x86_64.sh -u 

直接一直enter键,到输入路径和yes
这边建议路径为:miniconda3

3. 打开用户环境编辑页面

vim ~/.bashrc  
  • 点击键盘I键进入编辑模式,在最下方输入以下代码
export PATH="/root/miniconda3/bin:$PATH" 

4.conda配置

  • 配置清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ 
  • 设置搜索时显示通道地址
conda config --set show_channel_urls yes 
  • 配置pip 镜像源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 

5. 重新加载用户环境变量

source ~/.bashrc 
  • 初始化conda
conda init bash 

6. 创建Comfyui需要的环境

conda create -n comfyui python=3.10 conda activate comfyui  

三、克隆Comfyui仓库

官网地址:Comfyui的GitHub地址

git clone https://github.com/comfyanonymous/ComfyUI.git 

如果下载速度较慢可添加https://mirror.ghproxy.com/镜像源

git clone https://mirror.ghproxy.com/https://github.com/comfyanonymous/ComfyUI.git 

进入到Comfyui文件夹内

cd ComfyUI 
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121 
pip install -r requirements.txt 
python main.py --port 15070 --listen 0.0.0.0 

在这里插入图片描述

--port 50000: 设置服务器监听的端口为业务端口,此处改为业务端口。 

启动成功后,访问http://主机IP:端口
在这里插入图片描述

相关内容

热门资讯

玩家必用!pokemmo辅助器... 玩家必用!pokemmo辅助器脚本下载“细节开挂透视挂辅助器”;小薇(透视辅助)致您一封信;亲爱po...
玩家必看!xpoker透视辅助... 【福星临门,好运相随】;玩家必看!xpoker透视辅助“扑克开挂透视挂辅助器”;暗藏猫腻,小编详细说...
今日科普!wepoker可以破... 今日科普!wepoker可以破解游戏“解密开挂透视挂辅助下载”;亲,有的,ai轻松简单,又可以获得无...
我来教教大家!pokemmo辅... 我来教教大家!pokemmo辅助器手机版下载“讲解开挂透视挂辅助插件”;亲真的是有正版授权,小编(透...
玩家交流!德州透视hhpoke... 玩家交流!德州透视hhpoker“解密开挂透视挂辅助器”;德州透视hhpoker软件透明挂作为一款德...
技术分享!wepoker透视挂... 您好,wepoker透视挂底牌这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很...
技术分享!约局吧能不能开挂“曝... 技术分享!约局吧能不能开挂“曝光开挂透视挂辅助神器”;暗藏猫腻!约局吧能不能开挂软件透明挂确实存在有...
研究成果!wepoker插件辅... 研究成果!wepoker插件辅助“2026开挂透视挂辅助下载”是一款可以让一直输的玩家,快速成为一个...
玩家必看教程!fishpoke... 玩家必看教程!fishpoker透视底牌“透牌开挂透视挂辅助安装”;fishpoker透视底牌是一款...
今日科普!wepoker辅助器... 您好:wepoker辅助器最新版本更新内容这款游戏可以开挂的,确实是有挂的,很多玩家在这款游戏中打牌...