2017-02-09 660 views
0

我想在CentOS上安裝一個軟件包,但是當我運行「yum」命令時會引發錯誤。互聯網連接工作正常。 我嘗試去幹淨所有,但問題仍然存在。centos yum無法安裝任何東西或更新系統

錯誤:

[[email protected] ~]# yum install ntp 

Loaded plugins: fastestmirror 


    One of the configured repositories failed (Unknown), 
    and yum doesn't have enough cached data to continue. At this point the only 
    safe thing yum can do is fail. There are a few ways to work "fix" this: 

     1. Contact the upstream for the repository and get them to fix the problem. 

     2. Reconfigure the baseurl/etc. for the repository, to point to a working 
      upstream. This is most often useful if you are using a newer 
      distribution release than is supported by the repository (and the 
      packages for the previous distribution release still work). 

     3. Run the command with the repository temporarily disabled 
       yum --disablerepo=<repoid> ... 

     4. Disable the repository permanently, so yum won't use it by default. Yum 
      will then just ignore the repository until you permanently enable it 
      again or use --enablerepo for temporary usage: 

       yum-config-manager --disable <repoid> 
      or 
       subscription-manager repos --disable=<repoid> 

     5. Configure the failing repository to be skipped, if it is unavailable. 
      Note that yum will try to contact the repo. when it runs most commands, 
      so will have to try and fail each time (and thus. yum will be be much 
      slower). If it is a very temporary problem though, this is often a nice 
      compromise: 

       yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true 

    Cannot find a valid baseurl for repo: base/$releasever/x86_64 

我百勝repolist是下一個:

[[email protected] ~]# yum repolist list 
Loaded plugins: fastestmirror 
https://yum.dockerproject.org/repo/main/centos/%24releasever/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden 
Trying other mirror. 
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/solutions/69319 

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/ 

repolist: 0 

如果我列出repolist:

[[email protected] ~]# yum repolist 
Loaded plugins: fastestmirror 
https://yum.dockerproject.org/repo/main/centos/%24releasever/repodata/repomd.xml: [Errno 14] HTTPS Error 403 - Forbidden 
Trying other mirror. 
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/solutions/69319 

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/ 

repo id        repo name        status 
base/$releasever/x86_64    CentOS-$releasever - Base    0 
dockerrepo/$releasever    Docker Repository      0 
extras/$releasever/x86_64   CentOS-$releasever - Extras   0 
updates/$releasever/x86_64   CentOS-$releasever - Updates   0 
repolist: 0 
+0

使用命令'yum repolist'列出回購站併發布您嘗試的輸出'yum repolist list',但它看起來像碼頭存儲庫存在問題 –

+0

謝謝!我將輸出添加到描述中。你可以檢查一下嗎? @MichalHainc –

+0

此命令是否顯示一些信息? cat /etc/yum.repos.d/docker.repo –

回答

1

前可以試用一下這個,有一個備份你的機器,你可能會損害你的操作系統更多/完全

看來你的yum變量$ releasever是不知何故損壞的, 它通常是由於一些不明原因在機器上丟失了centos-release包引起的。

您可以檢查是否有包裝方式:

rpm -qi centos-release 

你可能會看到:

"package centos-release is not installed" 

首先發現,你必須以root身份執行確切的CentOS版本:

cat /etc/redhat-release 

你會看到這樣的:

CentOS Linux release 7.3.1611 (Core) 

您可以通過回購獲取centos-release組件:

wget http://vault.centos.org/centos/7.3.1611/updates/x86_64/Packages/centos-release-7-3.1611.el7.centos.2.5.x86_64.rpm 

現在運行通過轉重新安裝centos-release組件:

sudo rpm -Uvh --replacepkgs centos-release-7-3.1611.el7.centos.2.5.x86_64.rpm 

至於未來,你可以嘗試安裝的東西與百勝,你可能會得到:

[[email protected] ikerlan]# sudo yum install wget 
    error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch 
    error: cannot open Packages index using db5 - (-30969) 
    error: cannot open Packages database in /var/lib/rpm 
    CRITICAL:yum.main: 

    Error: rpmdb open failed 

現在你可以嘗試重新啓動Ë機或嘗試使用下面的命令重建轉DB:

rpm --rebuilddb 
0

試圖在CentOS 7.安裝MariaDB的時候我是超級沮喪,並經過多次搜索找到了答案,在這個link我就遇到了這個問題。

這是什麼解決了我的問題。以root身份運行。

# yum --disablerepo "*" --enablerepo epel install [package] 
# yum clean all 

「埃佩爾」可以是任何你喜歡的回購,但這一個爲我工作。將[package]放在命令中就像寫入的一樣,而不是你想要安裝的軟件包。

運行上述步驟後,退出root並在遇到錯誤之前運行您嘗試的任何安裝。