官方的安装教程:
https://wiki.ros.org/noetic/Installation/Ubuntu
添加apt包管理器的索引源
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 install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
安装软件
更新索引源
sudo apt-get update
安装ROS
sudo apt-get install ros-noetic-desktop-full # 桌面完全版
sudo apt-get install ros-noetic-desktop # 桌面基础班
sudo apt-get install ros-noetic-ros-base # ros基础版本,无UI界面
上面的noetic是ros的代号,该代号与ubuntu的版本绑定,需要根据ubuntu的版本号进行对应的修改。
配置环境变量
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
安装构建所需的依赖包
安装工具包
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
初始化rosdep
sudo apt-get install python3-rosdep
sudo rosdep init
rosdep update