CodeTheRobot

ROS 2 Lyrical lab 01 ยท 45 min

Install ROS 2 Lyrical

Prepare Ubuntu 26.04 and install the supported ROS 2 desktop packages.

Practice this lab in your browser: Verify a ROS 2 Lyrical install

Understand before building

How this part of ROS 2 works

The ROS distribution and Ubuntu release are a tested pair. Using the matching package repository avoids mixing incompatible libraries.

Sourcing changes only the current terminal's search paths. Test it once before adding it to your shell startup file.

Before you start

  • Ubuntu 26.04 (Resolute), 64-bit
  • An administrator account
  • A reliable internet connection

Files you will touch

  • /opt/ros/lyrical/
  • ~/.bashrc

Step 1

Set up

sudo apt install software-properties-common curl
sudo add-apt-repository universe
export 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}')
. /etc/os-release
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}.${UBUNTU_CODENAME:-$VERSION_CODENAME}_all.deb"
sudo dpkg -i /tmp/ros2-apt-source.deb
sudo apt update && sudo apt upgrade
sudo apt install ros-lyrical-desktop ros-dev-tools python3-colcon-common-extensions
source /opt/ros/lyrical/setup.bash
echo $ROS_DISTRO

Step 2

Create the file

# Add this only after the one-time source command works.
echo 'source /opt/ros/lyrical/setup.bash' >> ~/.bashrc

What each part does

  1. 1.apt refreshes package information, then installs the Lyrical desktop and development tools.
  2. 2.source loads ROS paths into this shell; echo verifies the distribution before a demo starts.

Step 3

Build, run and inspect

ros2 run demo_nodes_cpp talker
# In a second sourced terminal:
ros2 run demo_nodes_py listener

Proof that it works

  • echo $ROS_DISTRO prints lyrical
  • The talker publishes numbered messages
  • The listener receives the same messages

Recovery notes

  • If ros2 is not found, source /opt/ros/lyrical/setup.bash in that terminal.
  • If the package cannot be located, confirm the machine is Ubuntu 26.04 and the ROS apt source is configured from the official installation guide.
ROS 2 Lyrical installation