為centos7配置阿里yum源遇到的問題以及解決方法


【問題背景】

卸載安裝的Ambari,之前都是因為卸載不干凈。這次重寫安裝,卸載完之后,發現httpd無法啟動,所以想卸載httpd進行重新安裝,但是執行命令yum list | grep httpd報錯。

【遇到的問題】

配置過程很簡單,去https://opsx.alibaba.com/mirror 獲得執行命令:

 

 但是我在執行yum makecache時報錯,報錯信息如下:

Loaded plugins: fastestmirror, langpacks, priorities
Repository epel is listed more than once in the configuration
Cleaning repos: base epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@hadoop01 yum.repos.d]# yum makecache  
Loaded plugins: fastestmirror, langpacks, priorities
Repository epel is listed more than once in the configuration
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below wiki article 

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
...

【解決方法】

在網上找了好多帖子,都沒能解決我的問題,后來看到是HTTP請求失敗,嘗試本地訪問之前wget下來的 CentOS-Base.repo 發現其中的:

http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

等URL通過http的形式根本無法訪問,此時將變量$releasever改為7(我的系統是centos 7),發現可以訪問了,順便將所有的變量$releasever都改為7。感覺這個變量$releasever根本就沒起作用呀。

改完之后,執行yum clean all 以及 yum makecache 成功。

oaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                 | 3.6 kB  00:00:00     
extras                                                                                                               | 3.4 kB  00:00:00     
updates                                                                                                              | 3.4 kB  00:00:00     
(1/12): base/x86_64/group_gz                                                                                         | 166 kB  00:00:00     
(2/12): base/x86_64/primary_db                                                                                       | 6.0 MB  00:00:00     
(3/12): base/x86_64/filelists_db                                                                                     | 7.1 MB  00:00:00     
(4/12): base/x86_64/other_db                                                                                         | 2.6 MB  00:00:00     
(5/12): extras/x86_64/prestodelta                                                                                    |  73 kB  00:00:00     
(6/12): extras/x86_64/primary_db                                                                                     | 215 kB  00:00:00     
(7/12): extras/x86_64/other_db                                                                                       | 131 kB  00:00:00     
(8/12): extras/x86_64/filelists_db                                                                                   | 249 kB  00:00:00     
(9/12): updates/x86_64/prestodelta                                                                                   | 945 kB  00:00:00     
(10/12): updates/x86_64/filelists_db                                                                                 | 5.2 MB  00:00:00     
(11/12): updates/x86_64/other_db                                                                                     | 764 kB  00:00:00     
(12/12): updates/x86_64/primary_db                                                                                   | 7.4 MB  00:00:00     
Metadata Cache Created

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM