Install ROS 2 Humble Hawksbill on Ubuntu 22.04 (Jammy Jellyfish)

Steps required to install Robot Operating System (ROS) on Ubuntu

Install ROS 2 Humble Hawksbill on Ubuntu 22.04 (Jammy Jellyfish)

Photo by Eric Krull on Unsplash

The steps are clearly defined here. When I followed the instructions, I didn't encounter any problems but for completeness here I write most of the steps verbatim.

The original instructions start with checking locele. I find that the default locale for standard Ubuntu English installation on x86 PC is already en_US.UTF-8 but I would make sure and check the locale.

Example settings from my machine (Although the selected language was English during installation, my timezone is İstanbul/Turkey and I think this is the reason behind some tr_TR.UTF-8 settings).

Open a terminal and run the command locale.



If you don't see UTF-8, check this section. Let's continue with the installation.

sudo apt install software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install curl
sudo curl -sSL -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-desktop

At the end of the above commands, the most complete ROS2 packages (desktop) should be installed (around 1.1k new packages and 1 GB). By default, ROS Humble is installed on path /opt/ros/humble. To use ros2 commands either we should run source /opt/ros/humble/setup.bash for each terminal session or we should add it the end of the .bashrc. If you are planning to work with ROS, adding it to the end of the .bashrc is more convenient (my recommendation).

Finally, test our setup. Open two terminals then type


source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker

and 2:

source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listener

demo_nodes_cpp and demo_nodes_py use C++ and Python bindings for ROS, respectively. talker sends Hello World message with a counter and listener captures messages and prints them. Both C++ and Python programs support sending and receiving test messages thus all the given commands are valid. But testing both C++ and Python bindings at the same time is a good idea.

# All commands are valid
ros2 run demo_nodes_cpp talker
ros2 run demo_nodes_cpp listener
ros2 run demo_nodes_py talker
ros2 run demo_nodes_py listener
ROS 2 supports TAB completion. Feel free to press TAB while writing commands and parameters (separated by spaces) after ros2 command.

The expected output is shown below.