Video tutorial coming soon.
Deploy LocalAI on Ubuntu with Docker — a drop-in OpenAI API replacement that runs entirely on your hardware. Supports LLMs, Whisper speech-to-text, Stable Diffusion image generation, and text-to-speech. One API, every modality, zero cloud costs.
Grab the automated bash script from GitHub to follow along with the video.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/ai/localai/localai-ubuntu.sh
chmod +x localai-ubuntu.sh
sudo bash localai-ubuntu.sh
The script installs Docker and deploys LocalAI. GPU support is auto-detected — if an NVIDIA GPU is present, the CUDA image is used automatically.
wget https://raw.githubusercontent.com/mhmdali94/Docker/main/ai/localai/localai-ubuntu.sh
chmod +x localai-ubuntu.sh
sudo bash localai-ubuntu.sh
Place a GGUF model file into the LocalAI models directory, or use the built-in model gallery to download via the API:
curl http://localhost:8080/models/apply -H "Content-Type: application/json" \
-d '{"id": "huggingface@thebloke__mistral-7b-instruct-v0.2-gguf__mistral-7b-instruct-v0.2.Q4_K_M.gguf"}'
LocalAI exposes an OpenAI-compatible API on port 8080. Test it with a chat completion request — any OpenAI SDK works by changing the base URL:
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"mistral","messages":[{"role":"user","content":"Hello!"}]}'
Point any OpenAI-compatible application at your LocalAI endpoint. Use the same base URL pattern for chat, image generation, transcription, and TTS — all through one unified API.
| Port | Purpose |
|---|---|
| 8080 | LocalAI API (OpenAI-compatible) |