Install ROS2 Humble in Ubuntu 22.04

Install ROS2 Humble in Ubuntu 22.04

This is identical to the instructions available from the Official Documentation:

Update and Upgrade existing system packages:

sudo apt update && sudo apt upgrade -y

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

Verify Locale

locale

Output:

LANG=C.UTF-8
LANGUAGE=
LC_CTYPE="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_PAPER="C.UTF-8"
LC_NAME="C.UTF-8"
LC_ADDRESS="C.UTF-8"
LC_TELEPHONE="C.UTF-8"
LC_MEASUREMENT="C.UTF-8"
LC_IDENTIFICATION="C.UTF-8"
LC_ALL=

Setup Sources

Ensure that the Ubuntu Universe repository is enabled

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

Add ROS2 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

Add repository to 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 ROS2 Packages

sudo apt update && sudo apt upgrade -y
sudo apt install ros-humble-desktop ros-dev-tools -y

Add Environmental script to .bashrc

echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
source ~/.bashrc

Initialize Rosdep

sudo rosdep init
rosdep update