Skip to content

Instructions to set up ROS 2 for the first time


  • This document is made for ros2 humble
  • Ensure that system has internet connection.
  • Make a laptop Hotspot name swiftPro and set password to swift123.
  • On the raspberry Pi connect it to screen login using the credentials that we set during setup.
  • Ensure it is connected to hotspot and get the wlan0: inet address eg. 192.168.0.15 using the command ip a.
  • Do SSH ssh swiftPro@IP-ADDRESS and enter password swift123 in another system which is connected to the swiftPro hotspot.
  • Run the below commnads.

Set 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

Setup Sources

sudo apt install software-properties-common
sudo add-apt-repository universe

Now add the ROS 2 GPG key with apt.

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 repository to your sources list.

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

Install ROS 2 packages

sudo apt update && sudo apt upgrade
sudo apt install ros-humble-ros-base
sudo apt install ros-dev-tools

Environment setup

nano ~/.bashrc
  • Go to end of the file and paste the below path.
source /opt/ros/humble/setup.bash
  • And you are set to go.