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.
Comments