ubuntu18.04 apt update失败问题

问题现象
 

Err:1 http://us.mirrors.ustc.edu.cn/ubuntu bionic InRelease

Connection failed [IP: 202.141.176.110 80]

Err:2 http://us.mirrors.ustc.edu.cn/ubuntu bionic-updates InRelease

Connection failed [IP: 202.141.176.110 80]

Err:3 http://us.mirrors.ustc.edu.cn/ubuntu bionic-backports InRelease

Connection failed [IP: 202.141.176.110 80]

Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease

Reading package lists... Done

Building dependency tree

Reading state information... Done

186 packages can be upgraded. Run 'apt list --upgradable' to see them.

W: Failed to fetch http://us.mirrors.ustc.edu.cn/ubuntu/dists/bionic/InRelease Connection failed [IP: 202.141.176.110 80]

W: Failed to fetch http://us.mirrors.ustc.edu.cn/ubuntu/dists/bionic-updates/InRelease Connection failed [IP: 202.141.176.110 80]

W: Failed to fetch http://us.mirrors.ustc.edu.cn/ubuntu/dists/bionic-backports/InRelease Connection failed [IP: 202.141.176.110 80]

W: Some index files failed to download. They have been ignored, or old ones used instead.

看了某大佬的博客,发现是ubuntu的源有问题,更换成阿里云的源,果然可以使用了

具体步骤:1.sudo vi /etc/apt/sources.list ,(保险起见备份该文件)替换内容如下

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse


deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse


deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse


deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse


deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse


deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse


deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse


deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse


deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse


#centos源(放心使用):


deb http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiverse


deb http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiverse


deb http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiverse


deb http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiverse


deb http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse


deb-src http://centos.bitcomm.cn/ubuntu trusty main restricted universe multiverse


deb-src http://centos.bitcomm.cn/ubuntu trusty-security main restricted universe multiverse


deb-src http://centos.bitcomm.cn/ubuntu trusty-updates main restricted universe multiverse


deb-src http://centos.bitcomm.cn/ubuntu trusty-backports main restricted universe multiverse


deb-src http://centos.bitcomm.cn/ubuntu trusty-proposed main restricted universe multiverse

2.保存,退出,重新sudo apt update

 

/etc/resolv.conf 里面添加这个服务地址

nameserver 127.0.0.53 

或者 nameserver 8.8.8.8

 

 

18.10版本可以使用下面的源

# 默认注释了源码镜像以提高 apt update 速度(未认证)
deb http://old-releases.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-backports main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ cosmic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-security main restricted universe multiverse

# 预发布软件源(可有可无)
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ cosmic-proposed main restricted universe multiverse

~                    

 

 

 


https://blog.csdn.net/weixin_38707040/article/details/97133100?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: ubuntu18.04 apt-get update是用于更新Ubuntu 18.04操作系统的命令。它会从Ubuntu软件源中获取最新的软件包列表,并将其下载到本地计算机上。这个命令可以确保您的系统保持最新,并且可以修复一些已知的安全漏洞和错误。 ### 回答2: Ubuntu18.04是一个最新版本的操作系统,它使用的是该发行版的包管理器Apt-get,它是一个用于Ubuntu系统上安装、更新和卸载软件包的工具。通过使用Apt-get,用户可以通过命令行轻松地维护软件包,并且可以通过更新软件包来确保其系统的安全性。 关于Apt-get update命令,它是用于更新系统软件包列表的命令,它会从Ubuntu的软件包源列表中获取最新的软件包信息。我们可以通过打开终端并输入以下命令来运行Apt-get update命令: sudo apt-get update sudo表示我们需要以管理员权限运行该命令。该命令会请求远程服务器查看是否有可用的软件包更新,并基于本地的软件包列表加载所有可用更新、安全补丁和修复程序。通常情况下,我们可以在终端中看到该命令的输出结果。如果有任何可用的更新,则Apt-get update将列出这些更新以及它们的依赖关系和源。 需要注意的是,Apt-get update命令只会更新软件包列表,但不会实际安装软件包。要安装软件包,需要使用Apt-get install命令。如果您使用的是图形界面版本的Ubuntu,您还可以使用软件中心来查找和安装软件包。 总而言之,通过定期运行Apt-get update命令,可以帮助您保持您的Ubuntu系统最新,享受更好的性能和更高的安全性。 ### 回答3: Ubuntu18.04是当前最新版本的Ubuntu操作系统,是一款以稳定性与安全性著称的开源操作系统。在Ubuntu操作系统中,软件安装和更新通过apt-get命令进行,而apt-get update命令则是更新Ubuntu的软件仓库列表,使其与官方源同步更新。 更新软件仓库列表对于Ubuntu操作系统非常重要。因为软件仓库中存储了大量的软件包和依赖库文件,在安装或者升级软件时都需要从仓库中获取安装或升级的软件包和依赖库文件,这需要连接官方源服务器,通过apt-get update命令使仓库列表与官方源同步更新,保证能够顺利获取到软件包和依赖库文件。 通过ubuntu18.04中的apt-get update命令,我们可以更新Ubuntu操作系统中的软件仓库列表,使其包含最新的软件包和依赖库文件。在终端中执行apt-get update命令需要使用root用户或者有sudo权限的用户身份。 apt-get update命令的步骤如下: 1.打开终端,输入sudo apt-get update命令,按下Enter键。 2.Ubuntu会自动执行apt-get update命令,并连接Ubuntu官方源服务器,同步更新软件仓库列表。 3.在更新过程中,您可以看到终端输出的更新进度,当更新完成时,apt-get命令会自动退出。 需要注意的是,apt-get update命令只更新软件仓库列表,不会对已经安装的软件进行升级,要升级软件需要使用apt-get upgrade命令。更新软件仓库列表是保证Ubuntu操作系统能够正常安装和升级软件的重要步骤,在定期更新的同时,我们也可以选择添加其他的依赖库,以便我们获取更多的软件包。 总之,在Ubuntu18.04中使用apt-get update命令是非常重要的,它可以保证软件仓库列表与官方源同步更新,让我们可以及时获取到最新的软件包和依赖库文件,保证Ubuntu操作系统的稳定性和安全性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

NineDays66

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值