如何解决apt update 时遇到的问题

apt update 时报错
在这里插入图片描述

Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Err:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
302 Found [IP: 91.189.91.39 80]
Err:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease
302 Found [IP: 91.189.91.38 80]
Err:4 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease
302 Found [IP: 91.189.91.39 80]
Reading package lists… Done
N: See apt-secure(8) manpage for repository creation and user configuration details.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
E: The repository ‘http://us.archive.ubuntu.com/ubuntu bionic InRelease’ is no longer signed.
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic/InRelease 302 Found [IP: 91.189.91.39 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease 302 Found [IP: 91.189.91.38 80]
E: The repository ‘http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease’ is no longer signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease 302 Found [IP: 91.189.91.39 80]
E: The repository ‘http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease’ is no longer signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

1. 查看ubuntu版本

cat /etc/lsb-release

2. 复制对应版本的阿里云镜像

阿里云镜像

3. 用上一步复制的阿里云镜像替换文件/etc/apt/sources.list中的内容

可以使用命令
因为sudo只对最近的一个命令有用,所以不能用
sudo echo “” >文件名,这样sudo只对echo有用,对写入命令无效

echo "" | sudo tee /etc/apt/sources.list #清空文件内容
echo "复制的内容" | sudo tee /etc/apt/sources.list #写入
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值