首頁 > 運維 > CentOS > 主體

centos7 yum fastestmirror不能用怎麼辦

藏色散人
發布: 2020-05-06 15:18:40
轉載
10147 人瀏覽過

下面由centos基礎教學專欄跟大家介紹centos7 yum fastestmirror不能使用的解決辦法,希望對需要的朋友有幫助!

centos7 yum fastestmirror不能用怎麼辦

centos7 yum fastestmirror不能使用

[root@localhost ~]# yum install lrzsz
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
登入後複製

========================= ===========================

第一步:

[root@localhost ~]# vi  /etc/yum/pluginconf.d/fastestmirror.conf 
[main]
enabled=1//把1改为0  
verbose=0
always_print_best_host = true
socket_timeout=3
#  Relative paths are relative to the cachedir (and so works for users as well
# as root).
hostfilepath=timedhosts.txt
maxhostfileage=10
maxthreads=15
#exclude=.gov, facebook
#include_only=.nl,.de,.uk,.ie
登入後複製

====== ======================================

第二步:

[root@localhost ~]# vi /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1//将plugins的值修改为0
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release
#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
登入後複製

=============================================

繼續運行,出現以下錯誤

[root@localhost ~]# yum install lrzsz
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
 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

      and distribution release than

#      and distribution.

        packages for the previous distribution release still work)。

     3. Run the command with the repository temporarily disabled

#     4. Disable the repository permanently, so yum won't use it by default. Yum

        will then just ignore the repository until you perman perman mmable will then just ignore the repository until you perman permanm able for temporary usage:

            yum-config-manager --disable

        or

oid#c _lt );

     5. Configure the failing repository to be skipped, if it is unavailable.

        Note that yum will tr​​y to contact the repo. when     Note that yum will  to contact the repo. when it runs most mandman 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

# . #            yum-config-manager --save --setopt=.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

#>


#############' ===============================================##### #原因:沒有配置resolv.conf#########解決方法:######到/etc目錄下配置resolv.conf加入nameserver IP,如:###
[root@localhost ~]# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
登入後複製
###保存再次運行命令就可以。 ######更多centos技術文章,請當######centos教學######欄位! ###

以上是centos7 yum fastestmirror不能用怎麼辦的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:csdn.net
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!