ros官方的指导文件
主流程还是得看官方流程
http://wiki.ros.org/melodic/Installation/Ubuntu
问题记录
1,sudo apt update 无法更新
尝试了网上很多源,都没有成功,最后找到一个可以更新成功的源,不知道是不是偶然,记录一下,如果你也碰到了类似错误,尝试一下:
备份原来的源文件:sudo cp /etc/apt/source.list /etc/apt/source.list_bak
修改/etc/apt/source.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main restricted universe multiverse
换上这个源,本机就可以更新成功来,不会出现类似下列的错误
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/dists/bionic/main/binary-arm64/Packages 404 Not Found [IP: 113.142.77.244 80]
2,添加密钥出现链接不上服务器
这里采用的是文档中的备选方案
curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | sudo apt-key add -
但是这里我们要安装工具:
sudo apt install curl
最后成功的话,会显示一个ok
3,sudo rosdep init出现链接不上
试试这个网址:链接
网页能打开https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
实质就是下载这个文件 /etc/ros/rosdep/source.list.d/gedit 20-default.list文件夹
cd /etc/ros/rosdep/source.list.d/gedit 20-default.list
sudo gedit 20-default.list
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
方法:
1,我们先在终端中尝试ping 这个链接不上的网址
ping raw.githubusercontent.com
会得到:
64 bytes from raw.githubusercontent.com (199.232.28.133): icmp_seq=1 ttl=51 time=212 ms
64 bytes from raw.githubusercontent.com (199.232.28.133): icmp_seq=2 ttl=51 time=211 ms
64 bytes from raw.githubusercontent.com (199.232.28.133): icmp_seq=3 ttl=51 time=211 ms
64 bytes from raw.githubusercontent.com (199.232.28.133): icmp_seq=4 ttl=51 time=236 ms
2,我们把
199.232.28.133 raw.githubusercontent.com
加到 /etc/hosts文件中去
注意:我们也可以把ping raw.github.com 的结果也写道/etc/hosts中,可能有关系吧,没有去验证
151.101.228.133 raw.github.com
3,修改/etc/hosts后,我们重启下电脑,在开机后,请立即执行
sudo apt update
sudo rosdep init
4,sudo rosdep update出现超时
错误
urlopen error timed out
1,重启电脑,开机立即:
sudo apt update
sudo rosdep update
应该问题不大,如果还出现超时显现,尝试以下操作,但是修改完后,建议重启,开机立即执行上述命令,(为什么要开机立即执行,这个别人告诉的经验,估计是重启联网后台还没有来得及更新)
操作一:更改超时时间,重启后立即操作1中命令
https://blog.csdn.net/qq_38649880/article/details/87903654
还不行,操作二
ping raw.githubsercontent.com
添加
103.224.212.222 raw.githubsercontent.com
到/etc/hosts中,重启,开机立即执行上述更新操作,不行可以多执行几次,开机更新哦