Installing ROS 2
This guide walks you through installing ROS 2 and setting up a ROS 2 workspace.
ROS 2 (Robot Operating System 2) is a modern, open-source framework for building robotic software: https://www.ros.org/
Prerequisites
- Ubuntu (Install Ubuntu →)
Choose your ROS 2
Select a ROS 2 distribution to install (Humble is recommended).
Install
Click on your chosen ROS 2 distro name and follow the install guide on the website.
Replace humble
with your chosen ROS 2 distro: https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html
Or Quick Install:
Open a new terminal:
# Replace these with your versions:
UBUNTU_VERSION=22.04
ROS_DISTRO=humble
Set Up Your System:
sudo apt update && sudo apt install -y curl gnupg lsb-release
Add the ROS 2 GPG Key and Repository:
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
https://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
Install ROS 2:
sudo apt update
sudo apt install -y ros-$ROS_DISTRO-desktop # or ros-$ROS_DISTRO-ros-base - Minimal setup (no GUI tools)
Source ROS 2 Environment:
echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc
source ~/.bashrc
Install Development Tools (Optional but Recommended): https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html#install-development-tools-and-ros-tools
Verify Installation
Try running:
ros2 --version
ros2 topic list