Set Up Ubuntu for ROS 2
Use this reference once, before starting the ROS 2 Package Guide. The commands below are intentionally exact because package installation is not the creative part of this project.
Choose Your Ubuntu Terminal
Section titled “Choose Your Ubuntu Terminal”Windows: Open an administrator PowerShell window and run:
wsl --install -d Ubuntu-24.04Restart if Windows asks, then launch Ubuntu 24.04 from the Start menu. Complete the Linux username and password prompt. All later Linux and ROS commands belong in that Ubuntu terminal, not PowerShell.
Ubuntu Linux: Open your normal terminal and continue below.
macOS: Use an Ubuntu 24.04 virtual machine or a remote Ubuntu 24.04 computer. ROS 2 Jazzy packages in this guide target Ubuntu so the development environment matches the Raspberry Pi.
Add the ROS 2 Package Source
Section titled “Add the ROS 2 Package Source”Run this setup on every Ubuntu machine that will use ROS 2: your computer now, and the Raspberry Pi later.
sudo apt updatesudo apt install -y locales software-properties-common curlsudo locale-gen en_US en_US.UTF-8sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8export LANG=en_US.UTF-8
sudo add-apt-repository universe -ysudo apt updateexport ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F'"' '{print $4}')curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo ${UBUNTU_CODENAME:-${VERSION_CODENAME}})_all.deb"sudo dpkg -i /tmp/ros2-apt-source.debInstall the Right ROS 2 Package Set
Section titled “Install the Right ROS 2 Package Set”On the development computer, install the desktop tools and RViz:
sudo apt updatesudo apt install -y ros-jazzy-desktop ros-dev-toolssudo rosdep initrosdep updateros-jazzy-desktop includes RViz and the desktop tools.
On the Raspberry Pi later, install the smaller robot package set instead:
sudo apt updatesudo apt install -y ros-jazzy-ros-base ros-dev-toolssudo rosdep initrosdep updateThe Pi does not need to render RViz, so ros-jazzy-ros-base leaves more of its limited memory and storage for the robot. The official Ubuntu deb installation instructions are the source of truth if a command changes in a future release.
Verify It Works
Section titled “Verify It Works”Every fresh terminal needs the ROS environment loaded:
source /opt/ros/jazzy/setup.bashros2 run demo_nodes_cpp talkerLeave that running. Open a second Ubuntu terminal, source ROS again, and run:
source /opt/ros/jazzy/setup.bashros2 run demo_nodes_py listenerThe listener should report messages from the talker. Stop both with Ctrl+C.