问题描述:主要出现在这两个命令上:
1. git clone https://github.com/cartographer-project/cartographer_ros.git
2. sudo apt install liburdfdom-tools如图
解决方案:换源,即更改source list
https://blog.csdn.net/u010368556/article/details/104965055
- 备份源列表
# 首先备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
- 更改source.list
sudo vim /etc/apt/sources.list
- 换源
将原本内容全部替换
Ubuntu 18.04 TLS版本阿里云镜像源:
# https://opsx.alibaba.com/mirror
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
# 仿照清华镜像源,注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
4.刷新
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
-
如果sudo apt-get update仍然报错
问题在于DNS没有配置好
解决方案:
sudo vi /etc/resolv.conf
向其中添加:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.1.1 #这里用的是阿里云的DNS服务器 nameserver 223.5.5.5 nameserver 223.6.6.6