Let's follow these steps to add ROS-2 repositories:
- Ensure that you have added ROS-2 apt repositories to your system. You will need to authorize their keys with the package manager using the following command:
$ sudo apt update && sudo apt install curl gnupg2 lsb-release
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
- Then, add the repository to your sources list using the following command:
$ sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
Now that you have added the repositories, let's install the other necessities.