📞 🇺🇸 +1 361 304 4309 📞 🇮🇳 +91 76769 02281 ✉️ [email protected]
AI & Servers

How to Run Stable Diffusion on Ubuntu Server

How to Run Stable Diffusion on Ubuntu Server

Stable Diffusion lets you generate AI images on your own server — no API costs, no content restrictions and full privacy. This guide covers both GPU and CPU-only setups.

System Requirements

# With GPU (recommended)
NVIDIA GPU: 4GB+ VRAM (8GB for best quality)
RAM: 16GB minimum
Storage: 20GB+ for models

# CPU only (slow but works)
RAM: 16GB minimum
Storage: 20GB+
Expect: 2-5 minutes per image

Step 1 — Install Dependencies

sudo apt install python3 python3-pip python3-venv git wget -y

# For GPU support
sudo apt install nvidia-driver-550 -y
sudo reboot

Step 2 — Install AUTOMATIC1111 WebUI

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
cd stable-diffusion-webui
./webui.sh --listen --port 7860

First run downloads ~5GB of model files automatically.

Step 3 — Access the Interface

http://your-server:7860

Step 4 — Run as Service

sudo nano /etc/systemd/system/stable-diffusion.service
[Unit]
Description=Stable Diffusion WebUI
After=network.target

[Service]
ExecStart=/bin/bash /home/ubuntu/stable-diffusion-webui/webui.sh --listen --port 7860 --api
WorkingDirectory=/home/ubuntu/stable-diffusion-webui
Restart=always
User=ubuntu

[Install]
WantedBy=multi-user.target
sudo systemctl enable stable-diffusion --now

Step 5 — Use the API

curl http://localhost:7860/sdapi/v1/txt2img   -H "Content-Type: application/json"   -d '{
    "prompt": "a beautiful mountain landscape, photorealistic",
    "negative_prompt": "blurry, low quality",
    "steps": 20,
    "width": 512,
    "height": 512
  }' | python3 -c "import sys,json,base64; data=json.load(sys.stdin); open('output.png','wb').write(base64.b64decode(data['images'][0]))"

Conclusion

Stable Diffusion on your own server provides unlimited image generation. Our team configures GPU server environments for AI image generation workloads.

#stable-diffusion #image-generation #ubuntu #ai #gpu
Share this guide:
🛠️ Need Expert Help?

Don't want to do this yourself?

Our certified engineers implement this for you — correctly, securely, and within hours. Available 24/7 with 15-minute emergency response.

  • ✅ 19+ years experience
  • ✅ 60+ certified engineers
  • ✅ 1,600+ servers managed
  • ✅ 40+ countries served
  • ✅ Plans from $49/mo

Get Expert Help — Free Consultation

We respond within 4 hours · No commitment required

Please enter your name and a valid email.

No spam. Privacy Policy

Comments