How to Install Fooocus on Ubuntu 24.04 — Easy AI Image Generation
Fooocus is the fastest way to get Midjourney-quality images out of Stable Diffusion XL — no config files, no nodes, no tweaking sampler parameters. You launch it, you type a prompt, you get a beautiful image. This guide walks you through installing Fooocus on a GPU-enabled Ubuntu 24.04 VPS from a clean SSH session to a production-hardened deployment with nginx reverse proxy, basic auth, a systemd service, and API access.
Skip the setup? Deploy Fooocus in one click with our pre-configured GPU Server image. Launch a GPU VPS now and start generating images in under 2 minutes.
Table of Contents
What is Fooocus?
Fooocus is an open-source image generation interface built on top of Stable Diffusion XL (SDXL). It was created by lllyasviel — the same developer behind ControlNet and Stable Diffusion WebUI Forge — with a specific goal: reproduce the simplicity of Midjourney while using a fully local, open-source model stack.
Under the hood Fooocus runs SDXL 1.0 (specifically the juggernautXL_v8Rundiffusion model by default) along with a set of refiners, LoRAs, and sampler presets tuned by the developer. The magic is that you do not see any of that. The UI exposes exactly two fields — a prompt box and an advanced-settings drawer — and produces high-quality 1024x1024 images with a single click. The defaults work. The results look like Midjourney. You do not need to learn samplers, CFG scales, seeds, schedulers, or any of the knobs that dominate other Stable Diffusion interfaces.
Fooocus also bundles features that normally require extensions or manual setup on other platforms: Image Prompt (compose an image from a reference photo), Inpaint & Outpaint (edit regions or extend image borders), Upscale or Variation (enhance or remix an existing image), and 150+ style presets (Cinematic, Fooocus V2, SAI Anime, MRE Cinematic Dynamic, Ads Advertising, etc.). All of it works offline on your GPU, with no subscription, no watermark, no content policy, and no rate limit.
Why Fooocus Instead of Automatic1111 or ComfyUI?
Stable Diffusion has three dominant front-ends: Automatic1111, ComfyUI, and Fooocus. Each serves a different user.
- Automatic1111 (AUTO1111) is the kitchen sink. Every feature in the ecosystem ends up as an extension. It is powerful but requires learning samplers, schedulers, CFG, VAE selection, hires-fix passes, prompt weighting syntax, and extension management. Great for power users. Overwhelming for everyone else.
- ComfyUI is a node graph. You literally wire the model, sampler, VAE, and latent decoder together. It is the most flexible option on the market and the standard for complex pipelines (SD3, Flux, video models). It is also the steepest learning curve.
- Fooocus deletes 90% of those dials and replaces them with sensible defaults. The developer's thesis is that most people want good images, not a playground of parameters. The UI has a single prompt box and an optional advanced panel. The defaults are tuned for photorealism and cinematic composition out of the box.
| Task | Automatic1111 | ComfyUI | Fooocus |
|---|---|---|---|
| Install + first image | 40-90 min | 30-60 min | 10-20 min |
| Configuration needed | Heavy | Heavy | Zero |
| VRAM optimization | Manual flags | Manual flags | Automatic |
| Learning curve | Hours | Days | Minutes |
| Default image quality | Needs tuning | Needs tuning | Excellent |
| Good for API use | Yes | Yes | Yes |
Prerequisites
Before starting, you need:
- A GPU VPS with at least 8 GB VRAM (12 GB+ recommended for faster generation and batch sizes). Fooocus will fall back to 6 GB and even 4 GB modes, but the experience degrades sharply below 8 GB.
- Ubuntu 24.04 LTS (a fresh install is recommended — nothing in this guide assumes existing packages).
- At least 40 GB free disk space — SDXL base, refiner, LoRAs, and generated images add up quickly.
- 8 GB+ system RAM (16 GB ideal).
- SSH access with a non-root sudo user. See How to connect via SSH if this is your first VPS.
- A domain name pointed to your server IP — optional but strongly recommended for HTTPS + auth.
Recommended plan: Our GPU Server with an NVIDIA L4 or RTX 4000 Ada (12 GB VRAM, 8 vCPU, 32 GB RAM, 200 GB NVMe) is the sweet spot for Fooocus. You will get roughly 4-6 seconds per 1024x1024 image.
Step 1: Update the System and Install Build Dependencies
SSH into your VPS and start with a clean update:
sudo apt update && sudo apt upgrade -y
sudo apt install -y git wget curl build-essential software-properties-common \
libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 ffmpeg ca-certificatesThese libraries cover image I/O (libgl1, libxrender1), video decoding for the Image Prompt feature (ffmpeg), build tools for Python wheel compilation (build-essential), and the basics every web workload needs (curl, ca-certificates).
Step 2: Install NVIDIA Drivers and CUDA Toolkit
If your GPU VPS already has NVIDIA drivers provisioned (most VPS-Server.host GPU plans do), verify with:
nvidia-smiYou should see a table showing your GPU model, driver version, and VRAM. If the command is not found, install drivers:
sudo ubuntu-drivers install
sudo rebootAfter the reboot, reconnect via SSH and re-run nvidia-smi to confirm. Fooocus needs CUDA 11.8 or 12.1+ (PyTorch ships its own CUDA runtime, so you do not need to install the full CUDA toolkit separately).
Expected output:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.15 Driver Version: 550.54.15 CUDA Version: 12.4 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 NVIDIA L4 On| 00000000:00:10.0 Off| 0 |
| N/A 34C P8 9W / 72W | 3MiB / 23034MiB | 0% Default |
+-------------------------------+----------------------+----------------------+Step 3: Install Python 3.10 and Create a Virtual Environment
Fooocus targets Python 3.10 specifically. Ubuntu 24.04 ships Python 3.12 by default, which breaks several of Fooocus's pinned dependencies. Install 3.10 from the deadsnakes PPA:
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install -y python3.10 python3.10-venv python3.10-devVerify:
python3.10 --version
Python 3.10.14
Step 4: Clone Fooocus and Install Requirements
Clone the repository into your home directory:
cd ~
git clone https://github.com/lllyasviel/Fooocus.git
cd FooocusCreate and activate a virtual environment, then install PyTorch with CUDA support followed by the Fooocus requirements:
python3.10 -m venv venv source venv/bin/activate
pip install --upgrade pip pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu121 pip install -r requirements_versions.txt
The PyTorch install is ~2 GB and takes a few minutes. The Fooocus requirements add another ~1.5 GB of wheels (transformers, diffusers, gradio, etc.). If you see CUDA not available warnings later, re-verify the PyTorch install with:
python -c "import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0))"
True NVIDIA L4
Step 5: First Launch and Model Download
Fooocus downloads its models on first launch. This is ~15 GB:
juggernautXL_v8Rundiffusion.safetensors(SDXL base, ~7 GB)sd_xl_refiner_1.0_0.9vae.safetensors(refiner, ~6 GB)sd_xl_offset_example-lora_1.0.safetensors(LoRA, ~50 MB)- SDXL VAE and upscaler models (~2 GB combined)
cd ~/Fooocus
source venv/bin/activate
python entry_with_update.py --listen 0.0.0.0 --port 7865Fooocus will print download progress for each model. Once complete, you will see:
App started successful. Use the app with http://0.0.0.0:7865/ or 0.0.0.0:7865The --listen 0.0.0.0 flag binds to all network interfaces so you can reach the UI from outside the VPS. Without it, Fooocus binds to 127.0.0.1 and is only reachable from localhost.
Step 6: Access Fooocus Remotely
Open port 7865 on the firewall:
sudo ufw allow OpenSSH
sudo ufw allow 7865/tcp
sudo ufw enableVisit http://YOUR_SERVER_IP:7865 in your browser. You should see the Fooocus UI with a single prompt box, a Style dropdown, and a Generate button.
Critical warning: This exposes Fooocus to the entire internet with zero authentication. Do not leave it like this. Move on to Step 7 before generating anything important or walking away from the server.
Step 7: Configure nginx Reverse Proxy with Basic Auth
We will put Fooocus behind nginx with HTTP basic auth so you can reach it from anywhere without exposing port 7865 directly.
Install nginx and the password tool:
sudo apt install -y nginx apache2-utilsCreate a password file for your chosen username (replace admin):
sudo htpasswd -c /etc/nginx/.fooocus_htpasswd adminEnter and confirm a strong password when prompted.
Create the nginx site config. Replace fooocus.yourdomain.com with your real domain (or use _ for a default server if you do not have a domain yet):
sudo nano /etc/nginx/sites-available/fooocusPaste:
server { listen 80; server_name fooocus.yourdomain.com;client_max_body_size 50M;
# Basic auth for the entire app auth_basic "Fooocus Restricted"; auth_basic_user_file /etc/nginx/.fooocus_htpasswd;
location / { proxy_pass http://127.0.0.1:7865; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme;
# Long timeouts — image generation can take 30-60s proxy_read_timeout 600s; proxy_send_timeout 600s; proxy_connect_timeout 60s;
# Disable buffering for gradio streaming updates proxy_buffering off; } }
Enable the site and restart nginx:
sudo ln -s /etc/nginx/sites-available/fooocus /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginxNow lock down port 7865 so only nginx (on localhost) can reach Fooocus:
sudo ufw delete allow 7865/tcp
sudo ufw allow 'Nginx Full'Restart Fooocus with --listen 127.0.0.1 so it no longer binds publicly:
# Stop the current process (Ctrl+C) and relaunch with:
python entry_with_update.py --listen 127.0.0.1 --port 7865Visit http://fooocus.yourdomain.com — nginx will prompt for your basic auth credentials, then proxy through to Fooocus.
Step 8: Enable HTTPS with Let's Encrypt
With basic auth in place, HTTPS is mandatory — basic auth sends credentials base64-encoded but unencrypted, so without TLS anyone sniffing your traffic can read the password.
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d fooocus.yourdomain.com --non-interactive --agree-tos -m [email protected] --redirectCertbot modifies your nginx config in place, adding TLS listeners on 443 and redirecting all HTTP traffic to HTTPS. Your site is now reachable at https://fooocus.yourdomain.com with an auto-renewing certificate.
Step 9: Run Fooocus as a systemd Service
Right now Fooocus dies the moment you close your SSH session. Let systemd keep it running and auto-restart on crashes or reboots.
Create the service file:
sudo nano /etc/systemd/system/fooocus.servicePaste (replace ubuntu with your username if different):
[Unit] Description=Fooocus AI Image Generation After=network.target[Service] Type=simple User=ubuntu Group=ubuntu WorkingDirectory=/home/ubuntu/Fooocus Environment="PATH=/home/ubuntu/Fooocus/venv/bin:/usr/bin:/bin" ExecStart=/home/ubuntu/Fooocus/venv/bin/python /home/ubuntu/Fooocus/entry_with_update.py --listen 127.0.0.1 --port 7865 Restart=on-failure RestartSec=10 StandardOutput=append:/var/log/fooocus.log StandardError=append:/var/log/fooocus.log
Hardening
NoNewPrivileges=true PrivateTmp=true
[Install] WantedBy=multi-user.target
Create the log file with the right ownership, then enable and start the service:
sudo touch /var/log/fooocus.log sudo chown ubuntu:ubuntu /var/log/fooocus.log
sudo systemctl daemon-reload sudo systemctl enable fooocus sudo systemctl start fooocus sudo systemctl status fooocus
Expected output:
● fooocus.service - Fooocus AI Image Generation
Loaded: loaded (/etc/systemd/system/fooocus.service; enabled; preset: enabled)
Active: active (running) since Tue 2026-04-16 09:00:12 UTC; 15s ago
Main PID: 12345 (python)
Tasks: 18 (limit: 38345)
Memory: 4.2GTail the log to watch Fooocus warm up:
tail -f /var/log/fooocus.logFirst-time startup loads models into VRAM and takes 30-90 seconds. Subsequent restarts are faster (~15-30s) because models remain on disk.
Using Fooocus — Style Presets, Image Prompt, Inpainting
Fooocus is deliberately minimal, so most of its power lives behind the Advanced and Input Image toggles.
Style Presets
Click the Advanced checkbox in the bottom-right. A style selector appears with ~150 presets. Pick multiple — they stack additively. High-impact combinations to start with:
- Fooocus V2 + Fooocus Enhance + Fooocus Sharp — the house blend, great general-purpose photography
- Cinematic + Fooocus Masterpiece — dramatic lighting and cinematic composition
- SAI Anime + MRE Anime Nostalgic — clean anime illustration
- Ads Advertising + Fooocus Photograph — product photography for storefronts
- MRE Cinematic Dynamic — for wallpaper-grade landscapes
Image Prompt
Enable the Input Image checkbox, then click the Image Prompt tab. Upload up to 4 reference images. Fooocus extracts visual features (subject, composition, color palette, style) and blends them into the generated output. Sliders for each image control weight (0.0-2.0) and stop-at (fraction of the diffusion process where the image influence ends).
Use cases:
- Brand-consistent product renders — upload 3 photos of your product, describe the new scene in the prompt
- Character consistency across images — upload a reference portrait, generate new poses
- Style transfer — upload art in a style you like, apply to a new subject
Inpainting and Outpainting
In the Input Image panel, select Inpaint or Outpaint. Upload an image, paint a mask over the area you want changed, describe the replacement in the prompt. Fooocus regenerates only the masked region while blending seamlessly with the unmasked surroundings.
Outpaint extends the canvas — select Left, Right, Top, or Bottom to push the image border outward. Fooocus fills the new area consistent with the existing content.
API Access for Automation
Fooocus exposes a Gradio API at /run/predict automatically. For programmatic access, the community-maintained Fooocus-API project wraps Fooocus in a cleaner REST endpoint.
Install it alongside your existing Fooocus:
cd ~ git clone https://github.com/mrhan1993/Fooocus-API.git cd Fooocus-API source ~/Fooocus/venv/bin/activate pip install -r requirements.txt
python main.py --port 7866 --host 127.0.0.1
Expose via a second nginx location block (add a subdomain api.fooocus.yourdomain.com or use a path). Example request:
curl -X POST "https://fooocus.yourdomain.com/v1/generation/text-to-image" \
-u admin:YOUR_PASSWORD \
-H "Content-Type: application/json" \
-d '{
"prompt": "a cyberpunk raccoon hacker, neon rain, cinematic",
"performance_selection": "Speed",
"aspect_ratios_selection": "1152*896",
"image_number": 1,
"image_seed": -1,
"style_selections": ["Fooocus V2", "Fooocus Enhance", "Cinematic"]
}'The response contains base64-encoded image data (or URLs if you configure a static image directory). Integrate with n8n, Make, Zapier, or any workflow tool that speaks HTTP.
Running Multiple Instances on One GPU
On a 12 GB+ GPU, you can host multiple isolated Fooocus instances (one per team, one per tenant, etc.) by launching each with --listen 127.0.0.1 --port <unique-port> and setting PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512.
Each instance should have its own working directory and its own systemd unit file. Duplicate /etc/systemd/system/fooocus.service as fooocus-team2.service, change WorkingDirectory, the --port, and the log path. Add a matching nginx server block per subdomain.
Realistic density:
- 12 GB VRAM — 1 active generation + 1 idle instance loaded
- 16 GB VRAM — 2 concurrent generations
- 24 GB VRAM (RTX 4090, A5000, L4 at peak) — 3 concurrent generations
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
CUDA out of memory on launch | Another process has VRAM | Run nvidia-smi, kill stray processes with sudo kill <PID> |
CUDA out of memory mid-generation | Image size or batch too large | Drop to Speed preset, use 1024x1024, set image_number to 1 |
| First launch hangs at model download | Slow connection to HuggingFace mirror | Interrupt and restart — Fooocus resumes partial downloads |
| 502 Bad Gateway from nginx | Fooocus not listening or wrong port | Check sudo systemctl status fooocus and confirm port 7865 |
| Basic auth prompt appears repeatedly | .htpasswd file missing or wrong path | Re-run sudo htpasswd and check path in nginx config |
| Generation extremely slow (>60s) | CPU fallback — GPU not detected | Re-verify torch.cuda.is_available() returns True |
| Gradio UI loads but Generate does nothing | WebSocket blocked | Ensure nginx config has Upgrade/Connection headers |
ModuleNotFoundError after update | New requirements not installed | source venv/bin/activate && pip install -r requirements_versions.txt |
| Port 7865 already in use | Old process still running | sudo lsof -i :7865 then sudo kill <PID> |
| Styles dropdown empty | Corrupt /sdxl_styles/ directory | cd ~/Fooocus && git checkout -- sdxl_styles/ |
FAQ
Q: What GPU do I really need?
A: 8 GB VRAM is the practical minimum. 12 GB (NVIDIA L4, RTX 4000 Ada) is comfortable. 16 GB+ gives you batch generation and multi-instance capacity. Fooocus supports 6 GB and 4 GB fallback modes but generation times triple or quadruple.
Q: How long does an image take to generate?
A: On an NVIDIA L4 (12 GB) at the default Speed preset with SDXL 1024x1024, figure 4-6 seconds per image. Quality preset: 10-15 seconds. Extreme Speed: 2-3 seconds. CPU-only: 5-15 minutes (do not attempt for real use).
Q: Can I use Fooocus without a GPU?
A: Technically yes, with --always-cpu. Realistically no — a single image takes many minutes and the experience is miserable. Rent a GPU VPS by the hour if you cannot buy one.
Q: How does Fooocus compare to Midjourney?
A: Output quality is genuinely competitive for photorealism, portraits, and cinematic scenes. Midjourney still edges ahead on abstract artistic compositions. Fooocus wins on privacy (local), cost (one-time VPS fee vs $10-60/mo subscription), no content policy, unlimited generations, and API access for automation.
Q: Can I add custom checkpoints or LoRAs?
A: Yes. Drop .safetensors files into ~/Fooocus/models/checkpoints/ (for base models) or ~/Fooocus/models/loras/ (for LoRAs). They appear in the Advanced > Model tab. Download from CivitAI or HuggingFace — stick to SDXL-compatible models, SD 1.5 models will load but produce poor results with Fooocus's tuning.
Q: Is there a Docker option?
A: Yes — several community images exist (bennykok/fooocus-docker, diagonalge/fooocus). They work, but we recommend the bare-metal install on a dedicated GPU VPS because Docker GPU passthrough adds latency and hides NVIDIA driver issues. If you run Fooocus alongside many other containerized services, Docker is reasonable.
Q: How do I update Fooocus?
A: Fooocus auto-updates on launch when started with entry_with_update.py. To pull manually: cd ~/Fooocus && git pull && source venv/bin/activate && pip install -r requirements_versions.txt && sudo systemctl restart fooocus.
Q: Where are generated images saved?
A: ~/Fooocus/outputs/YYYY-MM-DD/. Metadata JSON with the full prompt, seed, and style is saved alongside each PNG. For long-term storage, rsync this directory to object storage (Backblaze B2, Wasabi, S3) nightly.
Q: Can I use Fooocus commercially?
A: Fooocus itself is GPL-3.0 — you can run it commercially. The bundled juggernautXL checkpoint is licensed under the CreativeML OpenRAIL-M license, which permits commercial use with restrictions on malicious content. Review both licenses for your specific use case.
Next Steps
- How to Install Ollama on Ubuntu 24.04 — run local LLMs next to your image model for a complete AI stack
- How to Secure Your VPS with Fail2Ban — protect your basic auth endpoint from brute-force attacks
- How to Set Up Automated Backups — rsync your
~/Fooocus/outputs/to off-server storage - How to Install nginx with Let's Encrypt — deeper dive on the reverse proxy setup
### Skip the Manual Install>
We offer Fooocus as a 1-click app on all GPU VPS plans.
Your server comes pre-configured with NVIDIA drivers, PyTorch, Fooocus, nginx, SSL, and basic auth — ready to generate in under 2 minutes.>
Deploy Fooocus Now | GPU Servers from EUR 89/mo | NVIDIA L4 / RTX 4000 Ada | 9 global locations