A straightforward setup for render nodes or headless workstations
This post walks you through how to install ComfyUI on Ubuntu 24.04 (or a similar system), including automatic startup with systemd so the service launches on boot. It works especially well for dedicated machines, render nodes, or headless workstations.
What is ComfyUI?
ComfyUI is a powerful, open-source graphical interface for building and managing AI image generation workflows. It provides a node-based system, allowing users to visually connect different AI model components (like Stable Diffusion, text encoders, and upscalers) without writing code.
Built for both beginners and advanced users, ComfyUI makes it easy to customize, experiment, and automate image generation pipelines, whether you’re running it locally or on a server. Its modular design supports plugins, model management, and high-performance GPU acceleration – making it a go-to tool for creators, developers, and AI enthusiasts who want full control over their generative art process.
What You’ll Need
A machine running Ubuntu 24.04 (or a supported Ubuntu derivative).
NVIDIA GPU (e.g., RTX 3050, 3090, 5090) with drivers installed.
Basic shell familiarity and sudo privileges.
Step 1: Install System Dependencies
Open a terminal and run:
sudo apt update
sudo apt install git python3 python3-venv python3-dev build-essential libgl1 ssh systemd-timesyncd python3.12-venv -y
This ensures you have the tools needed (git, Python venv support, dev-tools, etc.).
Step 2: Install NVIDIA Drivers
Identify the latest GPU driver for your system:
sudo ubuntu-drivers list --gpgpu
Install the recommended GPU driver + CUDA toolkit:
sudo apt update
sudo ubuntu-drivers install --gpgpu
sudo apt install nvidia-cuda-toolkit nvtop
sudo nvtop
You should see your GPU info.
Step 3: Clone ComfyUI
Pick a directory (for example ~/ComfyUI) and clone the repository:
git clone https://github.com/comfyanonymous/ComfyUI.git ~/ComfyUI
You can use another path, but ~/ComfyUI is recommended for consistency.
Step 4: Setup Python Virtual Environment
cd ~/ComfyUI
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip wheel
pip install -r requirements.txt
This creates an isolated Python environment and installs all required dependencies.
Step 5 (Optional): Install GPU-Accelerated PyTorch
If you want better performance via GPU:
pip install torch torchvision
Check whether it’s already installed and compatible with your GPU.
Step 6: Run ComfyUI Manually
To test the installation:
cd ~/ComfyUI
source .venv/bin/activate
python3 main.py --listen 0.0.0.0
Then open your browser and navigate to http://<your-host-ip>:8188. If you’re local, use http://127.0.0.1:8188
Step 7: Enable Automatic Startup (systemd)
If you’d prefer ComfyUI to run on boot:
Create a systemd service file (/etc/systemd/system/comfyui.service):
[Unit]
Description=ComfyUI Service
After=network-online.target
Wants=network-online.target
[Service]
User=administrator
WorkingDirectory=/home/administrator/ComfyUI
ExecStart=/home/administrator/ComfyUI/.venv/bin/python3 main.py --listen 0.0.0.0
Restart=always
[Install]
WantedBy=multi-user.target
Replace
/home/youruserwith your real path.- Replace User with your username.
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable comfyui
sudo systemctl start comfyui
sudo systemctl status comfyui
When running, the service will auto-start on boot, making your setup more reliable.
Final Thoughts
You now have ComfyUI installed, running manually or set to start automatically with systemd. This setup is especially useful for dedicated machines where you want a stable, always-on workflow. If you ever want to customize further (models, nodes, syncing across machines), you have a good foundation.
