You're reading the documentation for a development version. For the latest released version, please have a look at Kilted.

Installing on Ubuntu - how-to

ROS is supported on a range of different platforms. In this article, you will learn how to install ROS deb packages on Ubuntu. After you follow these steps, you’ll be ready to work with ROS.

Area: ROS-installation | Content-type: how-to | Experience: beginner, intermediate

Summary

Deb packages for Rolling Ridley are available for Ubuntu Resolute Raccoon (26.04). We recommend using this current distribution for most situations, the support for this platform is stable.

Resources for this distribution are as follows:

The Rolling Ridley development distribution may be supported on different platforms, as new platforms are selected for development. Future plans for target platforms are defined in REP 2000.

Prerequisites

Check the installation requirements.

Steps

1 Set up your system

  1. Set your locale.

    Make sure you have a locale which supports UTF-8. If you are in a minimal environment (such as a docker container), the locale may be something minimal like POSIX. We test with the following settings. However, it should be fine if you’re using a different UTF-8 supported locale.

    $ locale  # check for UTF-8
    $ 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
    $ locale  # verify settings
    
  2. Enable the required repositories.

    You will need to add the ROS 2 apt repository to your system.

    1. Ensure that the Ubuntu Universe repository is enabled.

      $ sudo apt install software-properties-common
      $ sudo add-apt-repository universe
      
    2. Install the ros-apt-source packages.

      These provide keys and apt source configuration for the various ROS repositories.

      $ sudo apt update && sudo apt install curl -y
      $ 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}')
      $ 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}.$(. /etc/os-release && echo ${UBUNTU_CODENAME:-${VERSION_CODENAME}})_all.deb"
      $ sudo dpkg -i /tmp/ros2-apt-source.deb
      

      Installing the ros2-apt-source package configures ROS repositories for your system. Updates to repository configuration occur automatically when new versions of this package are released to the ROS repositories.

  3. Optional: Install development tools.

    For building packages or other ROS development work, install ros-dev-tools:

    $ sudo apt update && sudo apt install ros-dev-tools
    

2 Install ROS

  1. Update your apt repository caches.

    $ sudo apt update
    
  2. Ensure your system is up to date.

    ROS packages are built on frequently updated Ubuntu systems. Always make sure that your system is up to date before installing new packages.

    $ sudo apt upgrade
    
  3. Install ROS using one of the following methods:

    Desktop install (Recommended): ROS, RViz, demos, tutorials.

    $ sudo apt install ros-rolling-desktop
    

    ROS-Base install (Bare Bones): Communication libraries, message packages, command line tools. No GUI tools.

    $ sudo apt install ros-rolling-ros-base
    
  4. Optional: Install additional RMW implementations.

    You can install optional RMW packages when your project needs a supported DDS or Zenoh vendor other than the default. The default middleware that ROS 2 uses is Fast DDS, but the middleware (RMW) can be replaced at runtime. See the guide on how to work with multiple RMWs.

3 Set up your environment

  1. Set up your environment by sourcing the following file.

    $ source /opt/ros/rolling/setup.bash
    

    Note

    If you are not using bash, replace .bash with your shell. Possible values are: setup.bash, setup.sh, setup.zsh.

4 Test the installation

If you installed ros-rolling-desktop, you can try some examples to check if the installation has been successful.

  1. In one terminal, source the setup file, then run a C++ talker:

    $ source /opt/ros/rolling/setup.bash
    $ ros2 run demo_nodes_cpp talker
    
  2. In another terminal, source the setup file, then run a Python listener:

    $ source /opt/ros/rolling/setup.bash
    $ ros2 run demo_nodes_py listener
    

    You should see the talker saying that it’s publishing messages and the listener saying that it hears those messages. This verifies both the C++ and Python APIs are working properly.

If you have issues with the installation, check the troubleshooting techniques.

If you want to use other RMW implementations, you can check the guide.

Next steps

After the installation is complete, you can proceed with configuring your environment.

We recommend that you get familiar with key ROS concepts and check out the tutorials:

FAQs

Which Ubuntu platforms are supported?

ROS 2 Rolling Ridley is available for Ubuntu Resolute Raccoon (26.04).

Why am I seeing <some error or symptom of installation issue>?

See Installation troubleshooting.

Can I switch from binaries to a source-based install?

Yes. See Ubuntu (source).

How do I uninstall ROS?

If you need to uninstall ROS or switch to a source-based install once you have already installed from binaries, run the following command:

$ sudo apt remove '~nros-rolling-*' && sudo apt autoremove

You may also want to remove the repository:

$ sudo apt remove ros2-apt-source
$ sudo apt update
$ sudo apt autoremove
$ sudo apt upgrade # Consider upgrading for packages previously shadowed.