歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux基礎知識:CentOS無法使用EPEL源

Linux基礎知識:CentOS無法使用EPEL源

日期:2017/2/28 13:47:40   编辑:Linux教程

問題的產生與解決

作者作為Android應用開發者,對Linux的接觸一直是Ubuntu為主,但是有一個用於科學上網的vps,由於內存只有64M,所以使用的操作系統為CentOS6,最近在上面安裝用於Json處理的jq的時候,發現需要用到epel源,於是,采用了如何在CentOS 5/6上安裝EPEL 源方法進行安裝(http://www.linuxidc.com/Linux/2013-12/93433.htm),過程很順利,但是在安裝完成之後,運行yum repolist的時候,epel源根本就沒有被列出,直接就傻眼了,然後執行yum install jq發現果真報錯了,內容如下:

epel | 4.3 kB 00:00
http://mirror.math.princeton.edu/pub/epel/6/i386/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
https://mirror.csclub.uwaterloo.ca/Fedora/epel/6/i386/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
https://pubmirror1.math.uh.edu/fedora-buffet/epel/6/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again

查看epel.repo是這樣子的:

然後在網上看別說, 直接將發生錯誤的源的***.repo文件中的enabled=1設置為0就好,我信以為真,修改之後,重新安裝,發現真的不報錯了,但是軟件也沒有安裝上啊,直到我查了更多資料才知道,原來這個設置是用來設置是否該源是否可用的,源都不用了,當然就不報錯了.從網上找了很多方法,但是都沒有解決問題,但是[Errno 14] PYCURL ERROR 7 - "couldn't connect to host"這句話給我靈感了,是不是在跟源的連接上出現問題了,我試著把baseurl的注釋去掉,將mirrorlist直接注釋掉,發現果真可用了.結果如下:

最後的結果告訴我們,遇到問題的時候,還是需要多思考,一味地在網上尋找答案,有時候碰巧遇到一樣的時候,一下就解決了,但是當問題不相同時,更多的就是在浪費時間,只有針對性的尋找答案才是王道.

其他資料-*.repo參數含義
name repo的描述
baseurl,mirrorlist 路徑,可以為本地或者遠程地址
enabled 是否可用0/1
gpgcheck 是否進行gpg檢查0/1
gpgkey** rpm包的驗證文件

CentOS 5/6.X 使用 EPEL YUM源 http://www.linuxidc.com/Linux/2013-08/88523.htm

RHEL/CentOS/Fedora各種源(EPEL、Remi、RPMForge、RPMFusion)配置 http://www.linuxidc.com/Linux/2013-05/85077.htm

配置EPEL YUM源 http://www.linuxidc.com/Linux/2012-10/71850.htm

為CentOS/RHEL添加EPEL軟件倉庫 http://www.linuxidc.com/Linux/2010-04/25734.htm

RedHat配置EPEL軟件源 http://www.linuxidc.com/Linux/2012-04/58309.htm

Copyright © Linux教程網 All Rights Reserved