一、异常错误
- apt install 时遇到这个问题,无法获取某些存档
二、原因
- 网络连接超时
三、解决方法
1.网络问题
- 网关错误拦截了数据包或者防火墙故意将其屏蔽在外
- 可以尝试更换网络或者代理,再次下载
- 或者更改配置文件
sudo vim /etc/resolv.conf
- 添加
nameserver 8.8.8.8
2.source的问题
可以尝试运行
apt-get update
- 或
apt-get update --fix-missing
依然报错,则更换source源
- 修改Ubuntu默认apt下载源
sudo vim /etc/apt/sources.list
将文件内容替换成
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
参考: Ubuntu 16.04 source.list 国内更新源
最后要更新一下,这个命令就相当于更新软件商店里面的目录
sudo apt-get update
再升级,相当于与软件目录对比,更新本地已经下载的软件
sudo apt-get upgrade