If you’ve recently installed Ubuntu 24.04 and are ready to start working with robotics software, one of the first tools you’ll want to set up is ROS 2 Jazzy. This is the latest official version of the Robot Operating System 2 (ROS 2) tailored for Ubuntu 24.04. In this guide, you’ll learn exactly how to install ROS 2 Jazzy from scratch, following a simple, step-by-step process.
The installation process is straightforward. The best way to approach it is by organizing your workspace: keep a browser window open with the necessary commands on one side of the screen, and a terminal window on the other. This allows you to easily copy and paste each command as you go, reducing the chance of typos and speeding up the setup.
The first step is to make sure your system is updated and configured to support UTF-8 locales, which is important for ensuring compatibility with various ROS 2 tools and libraries. Open your terminal and run the following commands:
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
After setting up the locale, it’s time to prepare your system to fetch ROS 2 packages from the official repositories. Begin by installing a few essential tools and enabling the universe
repository:
sudo apt install software-properties-common
sudo add-apt-repository universe
Next, download and install the ROS 2 GPG key, which is used to verify the authenticity of the packages you’ll be installing:
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
Then, add the official ROS 2 repository to your system’s list of software sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
Once the repository has been added, update your package index and upgrade the existing system packages to their latest versions:
sudo apt update
sudo apt upgrade
Now, you’re ready to install ROS 2 Jazzy. This guide covers the installation of the desktop full version, which includes the core ROS 2 libraries, developer tools, simulators, and graphical interfaces such as Rviz and Gazebo:
sudo apt install ros-jazzy-desktop
The installation will take some time as it involves downloading and configuring several gigabytes of software. Once completed, you’ll also want to install additional development tools specifically designed for ROS 2:
sudo apt install ros-dev-tools
Before you can start using ROS 2 commands in your terminal, it’s important to configure your shell environment to automatically source the ROS 2 setup file each time a new terminal session is opened. To do this, open the .bashrc
configuration file in your home directory:
vim ~/.bashrc
Then, add the following line at the very end of the file:
source /opt/ros/jazzy/setup.bash
Save the file and close the terminal. Open a new terminal window to ensure that the changes take effect.
To confirm that ROS 2 Jazzy has been installed correctly and is accessible from the terminal, type:
ros2 --help
If the terminal responds by displaying the list of available ROS 2 commands and options, the installation was successful.
With your system now fully equipped with ROS 2 Jazzy, you’re ready to begin developing, running nodes, managing packages, and experimenting with the powerful tools and frameworks that ROS 2 offers for robotics development on Ubuntu 24.04.