This beginner-friendly guide walks you through enabling the Linux
development environment on ChromeOS, adding swap space to support
limited memory, and running the gemma:2b AI model locally
using Ollama.
> Note: An 8 GB Chromebook can run small local language models, but memory is tight. The swap space created in this guide helps reduce the risk of crashes, although performance may be slower than on a machine with more RAM.
> Intel Chromebooks: Intel processors typically
have faster processors and more memory than Chromebooks with AMD
processors. This can improve the performance of the Linux development
environment and running the gemma:2b model.
Before you begin, make sure you have:
In the newly opened Linux terminal, update your package lists and
install the zstd compression tool:
bash
sudo apt update && sudo apt install zstd -y
Because 8 GB of RAM is tight for running LLMs, create 4 GB of swap space. Swap space uses storage on your SSD as virtual memory and can help prevent system crashes.
ChromeOS Linux uses the Btrfs file system, so the swap file must be created carefully. In particular, Copy-on-Write must be disabled before allocating the swap file.
Run the following commands in order:
bash
sudo touch /swapfile
sudo chattr +C /swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
To verify that swap is active, run:
bash
free -h
Look for around 4.0Gi in the Swap
column.
> Caution: Swap uses your SSD and is slower than RAM. It is useful on low-memory systems, but it may affect performance while the model is running.
bash
curl -fsSL https://ollama.com/install.sh | sh
bash
ollama run gemma:2b
Ollama will download the model the first time you run this command. After the download finishes, the model should start in your terminal.
ChromeOS deactivates manual swap files whenever the Linux environment shuts down.
Every time you completely close and reopen your Linux Terminal, reactivate your swap space before running the model.
Run:
bash
sudo chmod 0600 /swapfile
sudo swapon /swapfile
Optionally, verify that swap is active:
bash
free -h
Run:
bash
ollama run gemma:2b
You are now ready to use Gemma 2B locally (no internet required) on your Chromebook.