这个错误引起主要是因为环境读取不到yum引起的可以考虑/etc/sysconfig/network-scripts/ifcfg-eth0 配置出错导致网络不通。或者/etc/resolv.conf的DNS配置出错。或者可以考虑清楚yum缓存影响(yum clean all)
vi /etc/resolv.conf
nameserver 202.106.0.20(今天又出现此错误,这个nameserver加进去就好了。记得配置静态ip的话DNS也需要加入 然后update yum试试成功就OK了)
今天在linux环境通过yum安装软件报了以下错误:
[root@multi-mysql yum.repos.d]# yum install ncurses devel -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base
从字面意义上看是不能解析mirrorlist.centos.org这个地址,应该是跟dns网络配置有关系,最后解决方法是在DNS域名解析的配置文件增加DNS服务器的IP地址:
[root@multi-mysql ~]# vim /etc/resolv.conf
nameserver 8.8.8.8
nameserver 202.106.0.20
重启网络服务
[root@multi-mysql ~]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Determining if ip address 192.168.1.202 is already in use for device eth0...
[ OK ]
重新yum安装,正常
[root@yunwei ncurses-6.1]# yum install gcc gcc-c++ gcc-g77
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: ftp.sjtu.edu.cn
* updates: ap.stykers.moe
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:04
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 8.5 MB 00:10
Setting up Install Process
No package gcc-g77 available.
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-23.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: libgcc >= 4.4.7-23.el6 for package: gcc-4.4.7-23.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-23.el6.x86_64
---> Package gcc-c++.x86_64 0:4.4.7-23.el6 will be installed
--> Processing Dependency: libstdc++-devel = 4.4.7-23.el6 for package: gcc-c++-4.4.7-23.el6.x86_64
--> Processing Dependency: libstdc++ = 4.4.7-23.el6 for package: gcc-c++-4.4.7-23.el6.x86_64
--> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-23.el6.x86_64
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-23.el6 will be installed
---> Package libgcc.x86_64 0:4.4.7-4.el6 will be updated
---> Package libgcc.x86_64 0:4.4.7-23.el6 will be an update
---> Package libgomp.x86_64 0:4.4.7-4.el6 will be updated
---> Package libgomp.x86_64 0:4.4.7-23.el6 will be an update
---> Package libstdc++.x86_64 0:4.4.7-4.el6 will be updated
---> Package libstdc++.x86_64 0:4.4.7-23.el6 will be an update
---> Package libstdc++-devel.x86_64 0:4.4.7-23.el6 will be installed
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
--> Running transaction check
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
gcc x86_64 4.4.7-23.el6 base 10 M
gcc-c++ x86_64 4.4.7-23.el6 base 4.7 M
Installing for dependencies:
cloog-ppl x86_64 0.15.7-1.2.el6 base 93 k
cpp x86_64 4.4.7-23.el6 base 3.7 M
libstdc++-devel x86_64 4.4.7-23.el6 base 1.6 M
mpfr x86_64 2.4.1-6.el6 base 157 k
ppl x86_64 0.10.2-11.el6 base 1.3 M
Updating for dependencies:
libgcc x86_64 4.4.7-23.el6 base 104 k
libgomp x86_64 4.4.7-23.el6 base 135 k
libstdc++ x86_64 4.4.7-23.el6 base 296 k
Transaction Summary
================================================================================
Install 7 Package(s)
Upgrade 3 Package(s)
Total download size: 22 M
Is this ok [y/N]: y