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
Make sure the content is consistent with the above pictures
Press the esc key, and then enter the colon + wq to save
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
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
2.2 Update the software list and install necessary software and dependencies
sudo apt-get install g++
Click Enter
sudo apt-get install gcc
sudo apt-get install make
Click Enter
Installed successfully
2.2 Uninstall the original driver
sudo apt-get remove --purge nvidia*
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
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
Just press Enter here, the default selection
Keep pressing Enter until the installation is successful
3. Check whether the graphics card driver is installed successfully
nvidia-smi
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
Execute the installation command
sudo sh ./cuda_12.4.0_550.54.14_linux.run
1.Output accept start installation
2. Then note that you need to press enter to uncheck the first option because the driver has been installed before
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
4. Installation is completed
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"
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
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
2. Install miniconda3
bash Miniconda3-py310_23.10.0-1-Linux-x86_64.sh -u
Directly enter key to the input path and yes
The recommended path here is: miniconda3
Just enter enter and enter yes again
Installed successfully
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"
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
8. Verify whether the installation is successful
conda -V
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/
2. Set the channel address to display when searching
conda config --set show_channel_urls yes
3. Configure the pip mirror source
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
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
--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