Skip to content

Instantly share code, notes, and snippets.

@sunderee
Created October 14, 2023 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunderee/4c1ef2dabb8a26204475d93b9ef4eeeb to your computer and use it in GitHub Desktop.
Save sunderee/4c1ef2dabb8a26204475d93b9ef4eeeb to your computer and use it in GitHub Desktop.
Install ROS2 on Ubuntu
#!/bin/bash
# Set Locale
echo "Setting Locale..."
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
# Setup Sources
echo "Setting up sources..."
sudo apt install software-properties-common
sudo add-apt-repository universe
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
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
echo "Installing ROS 2 packages..."
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-desktop
# Environment setup
echo "Setting up the environment..."
source /opt/ros/humble/setup.bash
echo "ROS 2 installation completed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment