Running Zephyr OS on a DigitalOcean Ubuntu 22.04 Droplet with QEMU.

Overview

This guide walks you through installing, building, and running Zephyr OS on a DigitalOcean Ubuntu 22.04 (Intel) droplet using QEMU.
We’ll also make a small change to the Hello World sample to prove it’s your own build.

1) Install host dependencies (Ubuntu 22.04)

sudo apt update
sudo apt install --no-install-recommends git cmake ninja-build gperf   ccache dfu-util device-tree-compiler wget python3-dev python3-venv python3-tk   xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1

These are the officially listed packages for Ubuntu 22.04 in Zephyr’s Getting Started Guide.
Getting Started Guide — Zephyr Project Documentation

2) Create a workspace & install Zephyr (via west)

# create a Python virtual env for Zephyr tools (recommended)
python3 -m venv ~/zephyrproject/.venv
source ~/zephyrproject/.venv/bin/activate

# install west and fetch Zephyr + all its modules
pip install --upgrade pip west
west init ~/zephyrproject
cd ~/zephyrproject
west update

# export CMake package & install Python deps for modules
west zephyr-export
west packages pip --install

These are the current upstream steps for cloning and preparing Zephyr.

3) Install the Zephyr SDK (toolchains + Zephyr’s QEMU)

cd ~/zephyrproject/zephyr
west sdk install

Accept the defaults, or select only the architectures you care about (x86 and Arm are common).
This also provides a Zephyr‑tuned QEMU on Linux.

Disk space note: the SDK is a few gigabytes. Make sure your droplet has room.

4) First run in QEMU (Hello World on x86)

cd ~/zephyrproject/zephyr
west build -p always -b qemu_x86 samples/hello_world
west build -t run

Expected output:

*** Booting Zephyr OS build ...
Hello World! qemu_x86

On a headless droplet, this runs without a GUI: output appears directly in your terminal (UART redirected to stdio).

5) Make a tiny change to prove it’s your build

# tweak the message
sed -i 's/Hello World!/Hello from Zephyr on my DO droplet!/'   samples/hello_world/src/main.c

# rebuild and run again
west build -p always -b qemu_x86 samples/hello_world
west build -t run

Expected output:

Hello from Zephyr on my DO droplet! qemu_x86

6) Optional: also try an Arm board in QEMU

cd ~/zephyrproject/zephyr
west build -p always -b qemu_cortex_m3 samples/hello_world
west build -t run

Troubleshooting Quick Hits

  • west: command not found — Activate the venv:
    source ~/zephyrproject/.venv/bin/activate
    
  • CMake can’t find toolchain / Zephyr SDK — Re‑run west sdk install.
  • Dependencies missing — Reinstall packages from step 1 and verify:
    cmake --version
    python3 --version
    dtc --version
    

References: