本想centos7中安装一个google浏览器,于是便遇上了yum报错问题,不管install任何软件,都会报错,真是气煞老夫!
报错内容如下:
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 7.1 kB 00:00
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
docker-ce-stable | 3.5 kB 00:00
epel | 4.7 kB 00:00
extras | 2.9 kB 00:00
teamviewer | 2.5 kB 00:00
http://lnxrelease-02/yum/stable/main/binary-x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: lnxrelease-02; 未知的错误"
正在尝试其它镜像。
One of the configured repositories failed (TeamViewer Internal (Dev Nightly Packages) - x86_64),
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=tvinternal_dev ...
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 tvinternal_dev
or
subscription-manager repos --disable=tvinternal_dev
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=tvinternal_dev.skip_if_unavailable=true
failure: repodata/repomd.xml from tvinternal_dev: [Errno 256] No more mirrors to try.
http://lnxrelease-02/yum/stable/main/binary-x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: lnxrelease-02; 未知的错误"
在网上找了找原因,发现是源的问题!
解决办法: 干它…
第一步:删除 /etc/yum.repos.d 下的所有内容 (或只删除Centos-7.repo,猫哥是都删了)
rm -rf /etc/yum.repos.d/CentOS-*
第二步:下载国内源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/
第三步:清除缓存,更新yum
yum clean all
yum clean metadata
yum update
结果:
[root@localhost yum.repos.d]# yum update
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00
extras | 2.9 kB 00:00
updates | 2.9 kB 00:00
(1/4): base/7/x86_64/group_gz | 153 kB 00:00
(2/4): extras/7/x86_64/primary_db | 190 kB 00:00
(3/4): updates/7/x86_64/primary_db | 168 kB 00:00
(4/4): base/7/x86_64/primary_db | 6.1 MB 00:00
No packages marked for update
[root@localhost yum.repos.d]# ls
删除 /etc/yum.repos.d 下的所有内容可能会存在隐患,不过至今为止,一切正常,还没发现什么幺蛾子!