Ubuntu 16.04
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654sudo apt-get updatesudo at-get install ros-kinetic-desktop-fullecho "source /opt/ros/kinetic/setup.bash" >> ~/.bashrcsource ~/.bashrcsudo apt-get install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essentia
Ubuntu 18.04
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654sudo apt-get updatesudo apt-get install ros-melodic-desktop-fullsudo apt-cache search ros-melodicecho "source /opt/ros/melodic/setup.zsh" >> ~/.bashrcsudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
Ubuntu 20.04
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654sudo apt-get updatesudo apt-get install ros-noetic-desktop-fullsudo apt-cache search ros-noeticecho "source /opt/ros/noetic/setup.zsh" >> ~/.zshrcsudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
Ubuntu 22.04
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/ros
2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main
" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ros-humble-desktop
echo " source /opt/ros/humble/setup.zsh" >> ~/.zshrc
Ubuntu 24.04
sudo apt install software-properties-commonsudo add-apt-repository universesudo apt update && sudo apt install curl -ysudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpgecho "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/nullsudo apt update && sudo apt install ros-dev-tools # 可选sudo apt updatesudo apt upgradesudo apt install ros-rolling-desktop# Replace ".bash" with your shell if you're not using bash
# Possible values are: setup.bash, setup.sh, setup.zsh
source /opt/ros/rolling/setup.bash# 卸载
sudo apt remove ~nros-rolling-* && sudo apt autoremovesudo rm /etc/apt/sources.list.d/ros2.listsudo apt updatesudo apt autoremove# Consider upgrading for packages previously shadowed.
sudo apt upgrade