centos7 yum fastestmirror不能使用怎么办


本文摘自PHP中文网,作者藏色散人,侵删。

下面由centos基础教程栏目给大家介绍centos7 yum fastestmirror不能使用的解决办法,希望对需要的朋友有所帮助!

centos7 yum fastestmirror不能使用

1

2

3

4

[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"

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

第一步:

1

2

3

4

5

6

7

8

9

10

11

12

13

[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

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

第二步:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

[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

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

继续运行,出现如下错误

1

2

3

4

5

6

[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

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/7/x86_64

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

原因:没有配置resolv.conf

解决方法:

到/etc目录下配置resolv.conf加入nameserver IP,如:

1

2

3

4

[root@localhost ~]# vi /etc/resolv.conf

nameserver 8.8.8.8

nameserver 8.8.4.4

search localdomain

保存再次运行命令就可以。

更多centos技术文章,请当centos教程栏目!

以上就是centos7 yum fastestmirror不能使用怎么办的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

CentOS7下不能使用yum命令怎么办

CentOS7如何安装php扩展

CentOS7安装完毕后无法联网的解决方法

CentOS7怎么使用yum安装lnmp环境

CentOS7不能上网怎么办

CentOS7下httpd无法访问怎么办

CentOS7如何支持中文显示

如何解决CentOS7下中文乱码问题

CentOS7怎么进入单用户模式

CentOS7系统找不到网卡

更多相关阅读请进入《CentOS7》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...