可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have set up a centOS 6.5 server
using VMWare Workstation 9
on a Windows 8.1
host laptop. When trying to use yum
to install packages I get the following error:
[root@localhost ~]# yum update Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. </html>/ removing mirrorlist with no valid mirrors: /var/cache/yum/i386/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base
The VM works on other machines (Windows 7
desktop and an Windows 8.1
laptop), just not the one I need it to work on. I am able to ping the host from the guest and the guest from the host, so there is a connection to the internet.
I have uninstalled and reinstalled Workstation 9. Ungraded to workstation 10. Rebuilt the CentOS 6.5 server. Nothing seems to solve the issue.
When I upgraded from Windows 8 to Windows 8.1, I had VMWare installed. I found out later that I should have uninstalled VMWare before upgrading. Could this have messed up my VMWare network adapters?
Anyone have any ideas?
回答1:
Be sure that you can ping vault.centos.org.
Then edit /etc/yum.repos.d/CentOS-Base.repo
Comment out mirrorlist
and uncomment baseurl
Change all
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
to
baseurl=http://vault.centos.org/$releasever/centosplus/$basearch/
And enjoy your yum update!!! ;)
回答2:
I think another reason for this error message is if your release is no longer supported. None of the suggestions in this thread worked for me, and my internet connectivity was fine, but then I realized that I'm running Centos 5 (I know, ancient...) which reached its end-of-life on 2017 Mar 31 - right around when the yum repo error started showing up.
回答3:
This happened to a system I support on a remote network and I determined it was due to the customer's Check Point firewall interfering with normal HTTP traffic. I ran a sudo tcpdump -nn -c 500 -s0 -X port 80
and watched yum get redirected to some kind of portal:
Location: http://x.x.x.x/UserCheck/PortalMain?....
Funny thing is, it was hard to reproduce with curl
, which retrieved the mirror list without any problem. I found I had to add the User-agent: urlgrabber/3.1.0 yum/3.2.22
HTTP header that yum
uses to trigger Check Point interfering, like this:
$ curl -i \ -H 'User-agent: urlgrabber/3.1.0 yum/3.2.22' \ 'http://108.61.16.227/?release=5&arch=x86_64&repo=os' HTTP/1.1 307 Temporary Redirect Location: http://x.x.x.x/UserCheck/PortalMain?IID=....origUrl=.... Connection: close
Googling for UserCheck/PortalMain shows this is Check Point Firewall. And the IP I obscured there (x.x.x.x
) belonged to the customer. This was sufficient proof to tell the customer he needed to make some kind of change to his firewall to allow my system unobstructed internet access (I have no idea what, but I hope he and/or his network team can figure it out).
回答4:
The answer from @Steve Kehlet above got me on the correct path after finding this Q&A searching for the same symptom. More generally though, the answer turns out to be any sort of filtering web proxy (frequently employed within Corp environments) can cause this when it redirects yum's "http" request. In many of these cases, vendors provide a "web proxy" of some sort (specific to each particular firewall/filtering implementation - ask your sysadmins).
The important part not mentioned in this answer so far is, you can make CentOS yum work with this proxy, by adding the following line to /etc/yum.conf
proxy=http://proxy.yoursite.whatever:port_num
This will let yum know how to work with your company's proxy, and fix the unintuitive "All mirror urls are not using..." error
回答5:
for centos 5.4, you can change /etc/yum.repos.d/CentOS-Base.repo
into like this.
[base] name=CentOS-5.4 - Base #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=os baseurl=http://vault.centos.org/5.4/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-5.4 - Updates #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=updates baseurl=http://vault.centos.org/5.4/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-5.4 - Addons #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=addons baseurl=http://vault.centos.org/5.4/addons/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-5.4 - Extras #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=extras baseurl=http://vault.centos.org/5.4/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-5.4 - Plus #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=centosplus baseurl=http://vault.centos.org/5.4/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-5.4 - Contrib #mirrorlist=http://mirrorlist.centos.org/?release=5.4&arch=$basearch&repo=contrib baseurl=http://vault.centos.org/5.4/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
回答6:
Check if you are able to ping an externals site such as www.google.com. If not insert lines:
nameserver 208.67.222.222 nameserver 208.67.220.220
in /etc/resolve.conf
Also in /etc/yum.repos.d/CentOS-Base.repo
uncommented all the mirrorlist and comment out all the baseurl
If mirrorlist doesn't work for you you can try only the baseurl.
Hope it helps!!
回答7:
There are two things you can do:
- Go to /etc/sysconfig/network-scripts/ and verify your interface file, ifcfg-eth0 for example. Change "NM_CONTROLLED" from "yes" to "no". Restart network.
- Go to /etc/sysconfig/network-scripts/ and edit ifcfg-eth0. Add DNS1=8.8.8.8 and DNS2=. First entry is Google Public DNS. Restart network.
One of these should fix your issue.
Also, if you didn't do this yet, go back to original /etc/yum.repos.d/CentOS-Base.repo file.
回答8:
Comment out metadata_expire directive in /etc/yum.conf and do yum clean all. This worked for me. Not sure how.
回答9:
[root@server1 ~]# yum update Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Update Process Loading mirror speeds from cached hostfile YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. echo/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base
If you see the above error means first you need to check the internet is working or not (ping 8.8.8.8) , if the internet is working means you can debug otherwise check your firewall and get the internet.
回答10:
I faced the same problem with CentOS 5.11 and here complete solution file I ended up with :-
nano /etc/yum.repos.d/CentOS-Base.repo
`
# CentOS-Base.repo # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # http://vault.centos.org/5.11/ # http://vault.centos.org/5.11/updates/ # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. [base] name=CentOS-$releasever - Base baseurl=http://vault.centos.org/5.11/centosplus/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://vault.centos.org/5.11/updates//$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://vault.centos.org/5.11/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://vault.centos.org/5.11/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5