![无法在新安装的 CentOS 上安装/更新软件包](https://linux22.com/image/19605/%E6%97%A0%E6%B3%95%E5%9C%A8%E6%96%B0%E5%AE%89%E8%A3%85%E7%9A%84%20CentOS%20%E4%B8%8A%E5%AE%89%E8%A3%85%2F%E6%9B%B4%E6%96%B0%E8%BD%AF%E4%BB%B6%E5%8C%85.png)
我安装了CentOS6,这是第一次。我尝试安装/更新软件包。但我不能。这是输出并且它不会停止。我该如何解决这个问题?
[root@localhost suranga]# yum update
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: mirror.nus.edu.sg
* extras: mirror.nus.edu.sg
* updates: mirror.nus.edu.sg
base | 3.7 kB 00:00
http: //mirror.nus.edu.sg/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror.nus.edu.sg/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
http: //centosmirror.go4hosting.in/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //centosmirror.go4hosting.in/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
http: //mirrors.ispros.com.bd/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirrors.ispros.com.bd/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
http: //mirror.vietoss.com/CentOS/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror.vietoss.com/CentOS/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
http: //centos.vr-zone.com/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //centos.vr-zone.com/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
http: //ftp.cuhk.edu.hk/pub/Linux/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //ftp.cuhk.edu.hk/pub/Linux/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
http: //mirror-fpt-telecom.fpt.net/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: [Errno 12] Timeout on http: //mirror-fpt-telecom.fpt.net/centos/6.0/os/i386/repodata/2b014e1fcde80ec1cc69d6a048f260f712b1ae2d83d1fc04d3b3c00ade817ec9-primary.sqlite.bz2: (28, '')
Trying other mirror.
答案1
您看到的 URL 只是您需要能够在浏览器上提取并遍历的 URL。我抓住了第一个 URL 并开始沿着链向下查找,直到我到达http://mirror.nus.edu.sg/centos/6.0/。其中有一个自述文件包含此
该目录(以及 CentOS 版本)已被弃用。对于普通用户,您应该在路径中使用 /6/ 而不是 /6.0/ 。请参阅有关 CentOS 发布方案的常见问题解答:
http://www.centos.org/modules/smartfaq/faq.php?faqid=34
如果您知道自己在做什么,并且绝对想保持在 6.0 级别,请访问http://vault.centos.org/对于包裹。请记住,6.0 不再获得任何更新
所以看起来你有一个过时的回购列表。编辑您的存储库 (/etc/yum.repos.d/) 并将 6.0 更改为 6。然后获取这些 URL 并遍历它们,看看它们是否会将您带到正确的位置。如果没有,请在网络上搜索更新的存储库列表。
CentOS 将 centos/6 目录指向最新的版本。 6.1 只是被认为是 6.0 的修补版本,而他们认为是“6”。
答案2
$ sudo yum clean all
$ sudo yum update
如果需要,重复 2 次。
答案3
您的网络设置和/或连接存在问题。尝试(重新)配置网络接口。第一步,您可能需要运行“netstat -i -e”来列出接口并确保它们已分配正确的 IP 地址。
答案4
编辑您的存储库设置文件/etc/yum.repos.d/
(您可以在其中找到您连接的每个存储库的文件),并在这些文件中取消注释以 开头的行#baseurl
并注释以mirrorlist
.