Tutorials: 2025
ROS 2 Humble is a versatile and popular distribution of the Robot Operating System, designed to facilitate efficient robotics development.
This guide will help you install ROS 2 Humble and create a workspace (ros2_ws) tailored for development.
Operating System: Ubuntu 22.04 LTS or later.
Dependencies:
Python 3.8 or later.
CMake 3.10 or later.
An active Internet connection for package downloads.
First, ensure your system is updated with the latest packages.
sudo apt update && sudo apt upgrade -y
Install the required dependencies and tools for adding the ROS repository.
sudo apt install -y curl lsb-release apt-transport-https ca-certificates software-properties-common
Download the GPG key for the ROS 2 repository and save it securely.
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
Note: If the key file already exists, you will be prompted to overwrite it. Type Y to confirm and proceed.
File '/usr/share/keyrings/ros-archive-keyring.gpg' exists. Overwrite? (y/N) Y
Verify that the key file was saved correctly:
ls -l /usr/share/keyrings/ros-archive-keyring.gpg
The output should show the file, for example:
-rw-r--r-- 1 root root 1167 12月 23 17:48 /usr/share/keyrings/ros-archive-keyring.gpg
Add the ROS 2 repository to your system's package sources:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2-latest.list
Check the ROS 2 repository configuration to ensure it points to the correct location.
cat /etc/apt/sources.list.d/ros2-latest.list
The output should look like this:
deb [arch=amd64 signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu jammy main
Update the package lists to include the ROS 2 repository.
sudo apt update
You have two main options for installing ROS 2:
Option 1: Full Desktop Install
This includes the full ROS 2 development environment with Rviz, demos, and tools.
sudo apt install ros-humble-desktop
Option 2: Base Install
This is a minimal installation without GUI tools.
sudo apt install ros-humble-ros-base
Add the ROS 2 setup script to your shell configuration file to make ROS 2 commands available globally.
For Bash users:
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source ~/.bashrc
For Zsh users:
echo "source /opt/ros/humble/setup.zsh" >> ~/.zshrc
source ~/.zshrc
Check that ROS 2 is installed correctly by running:
ros2 --version
You should see the ROS 2 version output, such as:
humble 2.6.0
To confirm ROS 2 Humble is installed:
ros2 --help
This should display a list of available ROS 2 commands. If this works, your installation is likely correct.
Verify the ROS Distribution
You can check the active ROS distribution by inspecting the ROS_DISTRO environment variable:
echo $ROS_DISTRO
It should output:
humble
If you plan to develop or build ROS 2 packages from source, install additional tools:
sudo apt install python3-colcon-common-extensions python3-rosdep
Initialize rosdep
rosdep is used to install system dependencies for ROS packages.
sudo rosdep init
rosdep update
Create a workspace named ros2_ws:
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws
colcon build
In the ~/ros2_ws directory:
colcon build
source install/setup.bash
Make the workspace available in every terminal session:
echo "source ~/ros2_ws/install/setup.bash" >> ~/.bashrc
source ~/.bashrc
If you need to remove ROS 2:
sudo apt remove --purge ros-humble-*
sudo rm /etc/apt/sources.list.d/ros2-latest.list
sudo apt autoremove -y
sudo apt clean
Introduction: Overview of ROS 2 Humble and setting up the development environment.
System Prerequisites: Necessary system configurations and dependencies.
Installation Steps: Step-by-step guide to installing ROS 2 Humble.
Setting Up the Workspace: Instructions for creating and setting up a development workspace.
Verifying the Installation: Methods to confirm a successful ROS 2 Humble installation.
Create and build space : Create and build an workspace for future works.