To run Gemma 4 on Ubuntu 26.04 or 24.04, install Ollama and choose a model size from the table below. If you already have Ollama and your machine can run E4B, use ollama run gemma4 to download it and start chatting. Canonical’s Gemma 4 snap is the shorter setup if you want built-in terminal and browser chat.
Before you begin
Check memory with free -h and free disk space with df -h. Getting a GPU ready? Use our NVIDIA CUDA and AMD ROCm guide to verify GPU detection and driver support.
| Ollama tag | Model | Download | Max context | Where to start |
|---|---|---|---|---|
gemma4:e2b |
Effective 2B | 4.6 GB | 128K | 8 GB RAM CPU laptop |
gemma4:e4b |
Effective 4B, also latest | 6.6 GB | 128K | 16 GB RAM or 8 GB VRAM. On 8 GB RAM, start with E2B. |
gemma4:12b |
12B Unified | 8.0 GB | 256K | 16 GB RAM or 12 GB VRAM |
gemma4:26b |
26B A4B mixture of experts | 19 GB | 256K | 24 GB VRAM or 32 GB RAM. Expect partial CPU offload on 16 GB VRAM. |
gemma4:31b |
31B dense flagship | 20 GB | 256K | 24 GB+ VRAM or 32 GB+ RAM with a short context |
Downloads take disk space. The RAM and VRAM figures are practical starting points for short contexts. Ubuntu, the inference runtime and the context cache all need headroom. The 26B model activates about 3.8B parameters per token, which helps generation speed. Its full set of weights still needs to fit across GPU and system memory.
Ollama also lists Google’s quantization-aware trained (QAT) variants: gemma4:e2b-it-qat (4.3 GB), gemma4:e4b-it-qat (6.1 GB), gemma4:12b-it-qat (7.2 GB), gemma4:26b-a4b-it-qat (16 GB), gemma4:31b-it-qat (19 GB). Leave headroom even with a smaller download.
Install and run Gemma 4 with Ollama
Run E4B with the Ubuntu Inference Snap
Fix memory and GPU problems
Update or remove Gemma 4
Pull the same tag to check for new weights. Use ollama list to check the exact name before removing a tag. Shared files stay on disk while another installed tag uses them.
Snap updates automatically. To check immediately, use sudo snap refresh gemma4. Save any settings or data you need before removing the snap. The purge skips creation of a new automatic snapshot.
Frequently asked questions
Do I need a dedicated GPU to run Gemma 4?
No. Start with E2B on an 8 GB RAM machine, keep the context short and expect slower replies on a CPU.
Can I use Gemma 4 offline?
Yes. Download a local Ollama tag or finish installing the snap while online. The model can then answer local prompts offline.
Does Gemma 4 generate images?
No. It accepts images as input and answers with text. You can ask it to describe a photo or read a chart.
Helpful Resources
Related Ubuntu guides
Try another model family with Llama or DeepSeek.
- Install Qwen on Ubuntu and choose a size for your hardware.
- Install Mistral on Ubuntu for another family of local models.
- Explore open source AI tools for Ubuntu for more chat, coding and creative apps.
