Current location: Home> ComfyUI Tutorial> ComfyUI local deployment ubuntu

ComfyUI local deployment ubuntu

Author: LoRA Time: 21 Mar 2025

1. Basic environment configuration of ubuntu22.04

1.1 Replace the Tsinghua Ubuntu mirror source

Delete the original file

 rm /etc/apt/sources.list

Start editing new files

 vim /etc/apt/sources.list

Press the i key first and paste the following content

 # The source code mirror is commented by default to improve the speed of apt update. If necessary, you can uncomment 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

# The following security update software sources include the official source and mirror site configuration. If necessary, you can modify the comments and switch 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 

1.png

Make sure the content is consistent with the above pictures

Press the esc key, and then enter the colon + wq to save

1.png

1.2 Update package list:

Open the terminal and enter the following command:

 sudo apt-get update
 sudo apt upgrade

The update time is long, please wait patiently

1.png

2. Install Nvidia graphics driver

2.1 Use wget to download driver packages on the command line

 wget https://cn.download.nvidia.com/XFree86/Linux-x86_64/550.100/NVIDIA-Linux-x86_64-550.100.run 

1.png

2.2 Update the software list and install necessary software and dependencies

 sudo apt-get install g++ 

1.png

1.png

Click Enter

1.png

 sudo apt-get install gcc 

1.png

 sudo apt-get install make 

1.png

1.png

Click Enter

Installed successfully

1.png

2.2 Uninstall the original driver

 sudo apt-get remove --purge nvidia* 

1.png

1. Use vim to modify the configuration file

 sudo vim /etc/modprobe.d/blacklist.conf

2. Press the i key to enter the editing mode and add two lines to the end of the file:

 blacklist nouveau
options nouveau modeset=0 

1.png

3. Press the esc key to exit the editing mode, enter: wq to save and exit

4. Update the file

 sudo update-initramfs -u

Waiting here is a long time

5. Restart the computer:

 sudo reboot

It takes a while to connect here

2.3 Install the driver

1. Grant execution permissions

 sudo chmod 777 NVIDIA-Linux-x86_64-550.100.run

2. Execute the installation command

 sudo ./NVIDIA-Linux-x86_64-550.100.run 

1.png

1.png

Just press Enter here, the default selection

1.png

2.png

3.png

4.png

5.png

Keep pressing Enter until the installation is successful

1.png

2.png

3. Check whether the graphics card driver is installed successfully

 nvidia-smi 

1.png

2.4 Install CUDA

 wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run 

1.png

Execute the installation command

 sudo sh ./cuda_12.4.0_550.54.14_linux.run

1.Output accept start installation

1.png

2. Then note that you need to press enter to uncheck the first option because the driver has been installed before

1.png

ComfyUI

The most powerful and modular stable diffusion GUI with graphical/node interface.

Project address: https://gitcode.com/gh_mirrors/co/ComfyUI

3. Then select Install to start installation

1.png

4. Installation is completed

1.png

2.5 Environment variable configuration

1. Open the configuration file in vim mode

 sudo vim ~/.bashrc

2. Press the i key to enter the editing mode and add the following content at the end of the file:

 export PATH="/usr/local/cuda-12.4/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH" 

1.png

Press the esc key to exit the editing mode, enter: wq to save and exit

3. Update environment variables

 source ~/.bashrc

4. Check whether CUDA is installed successfully

 nvcc -V 

1.png

2. Install the miniconda environment

1. Download miniconda3

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

1.png

2. Install miniconda3

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

1.png

Directly enter key to the input path and yes

The recommended path here is: miniconda3

1.png

Just enter enter and enter yes again

1.png

Installed successfully

1.png

3. Switch to bin folder

 cd miniconda3/bin/

4. Enter pwd to get the path

 pwd

Copy the path here

5. Open the user environment editing page

 vim ~/.bashrc

Click the keyboard I key to enter the editing mode, enter the following code at the bottom

 export PATH="/root/miniconda3/bin:$PATH" 

1.png

Press the esc key to exit the editing mode, enter: wq to save and exit

6. Reload user environment variables

 source ~/.bashrc

7. Initialize conda

 conda init bash 

1.png

8. Verify whether the installation is successful

 conda -V 

1.png

9.conda configuration

1. Configure Tsinghua mirror source

The code is as follows:

 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/ 

1.png

2. Set the channel address to display when searching

 conda config --set show_channel_urls yes 

1.png

3. Configure the pip mirror source

 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple 

1.png

3.Clone Comfyui repository

3.1 Official website address: Comfyui's GitHub address

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

3.2 If the download speed is slow, add https://mirror.ghproxy.com/ mirror source

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

3.3 Enter the Comfyui folder

 cd ComfyUI

3.4 Create the environment required for Comfyui

 conda create -n comfyui python=3.10
conda activate comfyui

3.5 Installation dependencies

 pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
 pip install -r requirements.txt

3.6 Modify port startup

 python main.py --port 15070 --listen 0.0.0.0 

1.png

 --port 50000: Set the port that the server listens to is a business port, and here it is changed to a business port.

After successful startup, access http://host IP:port

1742442776278593.png