ubuntu安装ros并换源适⽤于16.04和18.04
ROS安装
在安装源部分需要区分版本,这⾥提供了16.04和18.04两个安装版本。值得注意的是,这⾥仅实验了x86架构。
ubuntu 16.04
这是ubuntu16.04版本的ros安装教程,不适⽤其他版本。
sudo vim /etc/apt/sources.list #修改镜像⽂件
# 这⾥的内容是针对ubuntu16.04,其他版本不适⽤
#将这⾥的所有信息直接复制粘贴即可,先删除原⽂件中的所有内容
# 默认注释了源码镜像以提⾼ apt update 速度,如有需要可⾃⾏取消注释
deb mirrors.tuna.tsinghua.edu/ubuntu/ xenial main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ xenial main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ xenial-updates main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ xenial-backports main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ xenial-security main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启⽤
# deb mirrors.tuna.tsinghua.edu/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ xenial-proposed main restricted universe multiverse
# 默认注释了源码仓库,如有需要可⾃⾏取消注释
deb mirrors.ustc.edu/ubuntu/ xenial main restricted universe multiverse
# deb-src mirrors.ustc.edu/ubuntu/ xenial main restricted universe multiverse
deb mirrors.ustc.edu/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src mirrors.ustc.edu/ubuntu/ xenial-updates main restricted universe multiverse
deb mirrors.ustc.edu/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src mirrors.ustc.edu/ubuntu/ xenial-backports main restricted universe multiverse
deb mirrors.ustc.edu/ubuntu/ xenial-security main restricted universe multiverse
# deb-src mirrors.ustc.edu/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启⽤
# deb mirrors.ustc.edu/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src mirrors.ustc.edu/ubuntu/ xenial-proposed main restricted universe multiverse
ubuntu vim命令sudo sh -c '. /etc/lsb-release && echo "deb mirrors.ustc.edu/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo sh -c '. /etc/lsb-release && echo "deb mirrors.tuna.tsinghua.edu/ros/ubuntu/ $DISTRIB_CODENAME main" >> /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update && sudo apt upgrade
sudo apt-get install ros-kinetic-desktop-full
Ubuntu 18.04
# 这⾥的是18.04的镜像需要根据不同版本进⾏选择
# 默认注释了源码镜像以提⾼ apt update 速度,如有需要可⾃⾏取消注释
deb mirrors.tuna.tsinghua.edu/ubuntu/ bionic main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ bionic main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ bionic-updates main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ bionic-backports main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ bionic-security main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启⽤
# deb mirrors.tuna.tsinghua.edu/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src mirrors.tuna.tsinghua.edu/ubuntu/ bionic-proposed main restricted universe multiverse
sudo sh -c 'echo "deb mirrors.tuna.tsinghua.edu/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt update
sudo apt install ros-melodic-desktop-full
Initialize rosdep
在这⼀步的update命令上可能会由于⽹络原因多次失败,重复命令即可,直到成功。
sudo apt-get install python-rosdep
sudo rosdep init
rosdep update
Environment setup
更改过终端的要把下⾯的内容进⾏对应更改。不知道啥是终端更改的忽略这句话。
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
我更改了终端为zsh,因此命令修改如下
echo "source /opt/ros/kinetic/setup.zsh" >> ~/.zshrc
source ~/.zshrc
Dependencies for building packages
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
启动ROS
roscore
启动成功即可。最后使⽤Ctrl+c 退出ROS系统。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论