Centos 6 yumrepo error

30 ноября 2020 года поддержка операционной системы CentOS 6 была прекращена. Кроме отсутствия новых обновлений это событие привело к невозможности использования утилиты yum для работы со списком пакетов. Решение этой проблемы достаточно простое.

30 ноября 2020 года поддержка операционной системы CentOS 6 была прекращена. Кроме отсутствия новых обновлений это событие привело к невозможности использования утилиты yum для работы со списком пакетов.
При попытке выполнения действий yum update, yum install, yum search и т.п. система начала выдавать ошибку:

~]# yum update
Loaded plugins: fastestmirror
Setting up Update Process
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

Решение этой проблемы достаточно простое, Вы сможете убедиться в этом прямо сейчас.

Решение для исправления работы Yum в CentOS 6

Для начала давайте выполним команду:

yum clean all

Это позволит сбросить все кэши и в дальнейшем избавит от возможных проблем.

Теперь откроем файл /etc/yum.repos.d/CentOS-Base.repo и закомментируем строки «mirrorlist=…» и «baseurl=…»

Т.е. перед ними поставим символ «#» и в результате получим:

#mirrorlist=...
#baseurl=...

Ниже этих двух строк добавляем в каждую секцию baseurl, в котором в качестве хоста указываем https://vault.centos.org, остальные параметры из старого baseurl и сохраняем результат, например:

baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/

В результате для каждой секции файла у нас будет 5 разных вариаций:

baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/contrib/$basearch/

Полный файл /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
# unless you are manually picking other mirrors.
#
# 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
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Вот и все! Теперь Вы сможете ввести любую команду yum (yum install, yum update, yum search…) и насладится прежней работой.
При этом помните, что обновления для CentOS 6 с 30 ноября 2020 года больше не выпускаются, а хостинг VPS/VDS или Dedicated сервер лучше заказывать у хостинг-провайдера Хост.SU.

P.S. Если у Вас в системе установлен Perl, то для быстрой правки файла Вы можете выполнить всего лишь три команды:


perl -pi -e 's/mirrorlist=/#mirrorlist=/' /etc/yum.repos.d/CentOS-Base.repo
perl -pi -e 's/http://mirror.centos.org/https://vault.centos.org/' /etc/yum.repos.d/CentOS-Base.repo
perl -pi -e 's/#baseurl=/baseurl=/' /etc/yum.repos.d/CentOS-Base.repo

P.S.S. При наличии утилиты «sed» можно выполнить:


sed -i 's/mirrorlist=/#mirrorlist=/' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/http://mirror.centos.org/https://vault.centos.org/' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/#baseurl=/baseurl=/' /etc/yum.repos.d/CentOS-Base.repo

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?

Keshava GN's user avatar

Keshava GN

4,1452 gold badges37 silver badges46 bronze badges

asked Jan 28, 2014 at 3:54

TheJimmer's user avatar

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!!! ;)

mwfearnley's user avatar

mwfearnley

3,1372 gold badges31 silver badges35 bronze badges

answered Apr 10, 2015 at 10:40

makidoo's user avatar

makidoomakidoo

6415 silver badges2 bronze badges

7

Centos 6 version met its EOL last month (November 30, 2020)

You can use one of the unofficial mirrors listed by centos in your /etc/yum.repos.d/CentOS-Base.repo. In my case (6.10) I used the mirror http://mirror.nsc.liu.se/centos-store/6.10/ and it worked smoothly:

[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.nsc.liu.se/centos-store/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# same for the others [updates] etc in the file

answered Dec 5, 2020 at 19:25

mateuszb's user avatar

mateuszbmateuszb

1,01213 silver badges26 bronze badges

3

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.

answered Apr 19, 2017 at 13:39

michael bietenholz's user avatar

2

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

answered Oct 1, 2017 at 6:19

lisency's user avatar

lisencylisency

4231 gold badge5 silver badges9 bronze badges

1

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).

answered Jan 8, 2015 at 19:22

Steve Kehlet's user avatar

Steve KehletSteve Kehlet

5,9665 gold badges36 silver badges39 bronze badges

1

Adding the following before yum update -y helped me to fix the problem:

yum clean all
echo "http://vault.centos.org/5.11/os/x86_64/" > /var/cache/yum/base/mirrorlist.txt
echo "http://vault.centos.org/5.11/extras/x86_64/" > /var/cache/yum/extras/mirrorlist.txt
echo "http://vault.centos.org/5.11/updates/x86_64/" > /var/cache/yum/updates/mirrorlist.txt

BTW, CentOS 5 had already reached EOL

answered Feb 28, 2019 at 10:58

Sudheesh.M.S's user avatar

Sudheesh.M.SSudheesh.M.S

4981 gold badge7 silver badges13 bronze badges

CentOS 6.10 after 2021-01-15

CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/$basearch//RPM-GPG-KEY-CentOS-6

CentOS-fasttrack.repo

[fasttrack]
name=CentOS-6 - fasttrack
baseurl=https://vault.centos.org/6.10/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://vault.centos.org/6.10/$basearch/RPM-GPG-KEY-CentOS-6

CentOS-SCLo-scl.repo

# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-sclo]
name=CentOS-6 - SCLo sclo
baseurl=https://vault.centos.org/6.10/sclo/$basearch/sclo/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-testing]
name=CentOS-6 - SCLo sclo Testing
baseurl=https://vault.centos.org/6.10/sclo/$basearch/sclo/
gpgcheck=0
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-source]
name=CentOS-6 - SCLo sclo Sources
baseurl=https://vault.centos.org/6.10/sclo/$basearch/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-sclo-debuginfo]
name=CentOS-6 - SCLo sclo Debuginfo
baseurl=https://vault.centos.org/6.10/sclo/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

answered Jan 18, 2021 at 9:56

Intacto's user avatar

IntactoIntacto

5233 silver badges7 bronze badges

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_old

vi /etc/yum.repos.d/CentOS-Base.repo


[base]
name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/6.9/os/$basearch
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
exclude=redhat-logos

yum clean all

yum update -y 

Enjoy!!!!

answered Mar 15, 2021 at 13:14

Ali Raza's user avatar

Ali RazaAli Raza

1481 silver badge3 bronze badges

In the same vein as the other posts regarding the updates to /etc/yum.repos.d/CentOS-Base.repo, I additionally had to modify the baseurl values in the following files:

sudo vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
sudo vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo

You might want to ls /etc/yum.repos.d/ and look over the contents of any other files in there which might need updating for an EOL distro version.

Also, but sure to clear the yum cache with sudo yum clean all.

answered May 4, 2021 at 22:14

BuvinJ's user avatar

BuvinJBuvinJ

9,8435 gold badges79 silver badges93 bronze badges

CENTOS 6.10

  • Backup File /etc/yum.repos.d/CentOS-Base.repo
  • After backup edit file and copy the following content:
[base]

name=CentOS-$releasever - Base

baseurl=https://vault.centos.org/6.10/os/$basearch/

gpgcheck=1

gpgkey=https://vault.centos.org/6.10/os/$basearch//RPM-GPG-KEY-CentOS-6

#released updates 

[updates]

name=CentOS-$releasever - Updates

baseurl=https://vault.centos.org/6.10/updates/$basearch/

gpgcheck=1

gpgkey=https://vault.centos.org/6.10/updates/$basearch//RPM-GPG-KEY-CentOS-6


#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=https://vault.centos.org/6.10/extras/$basearch/

gpgcheck=1

gpgkey=https://vault.centos.org/6.10/extras/$basearch//RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=https://vault.centos.org/6.10/centosplus/$basearch/

gpgcheck=1

gpgkey=https://vault.centos.org/6.10/centosplus/$basearch//RPM-GPG-KEY-CentOS-6


#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib

baseurl=https://vault.centos.org/6.10/contrib/$basearch/

gpgcheck=1

gpgkey=https://vault.centos.org/6.10/contrib/$basearch//RPM-GPG-KEY-CentOS-6

sɐunıɔןɐqɐp's user avatar

sɐunıɔןɐqɐp

3,13715 gold badges34 silver badges39 bronze badges

answered Jul 17, 2021 at 19:08

TRV's user avatar

0

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

answered Jan 10, 2017 at 0:33

JesseM's user avatar

JesseMJesseM

1914 silver badges7 bronze badges

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

answered Apr 7, 2018 at 0:04

Salem's user avatar

SalemSalem

6127 silver badges24 bronze badges

For anybody else stuck in the past,

From within a docker container centos:centos5

# cat CentOS-Base.repo
[base]
name=CentOS-5.11 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=os
baseurl=http://archive.kernel.org/centos-vault/5.11/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-5.11 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=updates
baseurl=http://archive.kernel.org/centos-vault/5.11/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.11 - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=addons
baseurl=http://archive.kernel.org/centos-vault/5.11/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.11 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=extras
baseurl=http://archive.kernel.org/centos-vault/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-5.11 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=centosplus
baseurl=http://archive.kernel.org/centos-vault/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-5.11 - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=5.11&arch=$basearch&repo=contrib
baseurl=http://archive.kernel.org/centos-vault/5.11/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

I had to also change this libselinux.repo

# cat libselinux.repo
[libselinux]
name=CentOS-$releasever - libselinux
baseurl=http://archive.kernel.org/centos-vault/5.11/os/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
includepkgs=libselinux*

answered Sep 20, 2019 at 5:59

amacvar's user avatar

amacvaramacvar

3113 silver badges8 bronze badges

Here we need to only put correct baseurl in /etc/yum.repos.d/CentOS-Base.repo

check this URL http://mirror.cisp.com browse your OS and take that URL

If you have Centos6.10 then your baseurl as follow

baseurl=http://mirror.cisp.com/CentOS/6.10/

answered Dec 10, 2020 at 12:44

user14801220's user avatar

  1. vim /etc/yum.repos.d/myrepo.repo
  2. Paste these lines:
[centos]
name=CentOS-6.10 - Base
baseurl=http://mirror.nsc.liu.se/centos-store/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  1. save file and exit.
  2. yum repolist.
  3. yum install nmap

answered Mar 28, 2022 at 11:30

Gopesh Bharadwaj's user avatar

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!!

answered Jan 28, 2014 at 14:16

Amar's user avatar

AmarAmar

2,1411 gold badge13 silver badges16 bronze badges

2

There are two things you can do:

  1. Go to /etc/sysconfig/network-scripts/ and verify your interface file, ifcfg-eth0 for example. Change «NM_CONTROLLED» from «yes» to «no». Restart network.
  2. 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.

answered Feb 19, 2014 at 18:09

lkhudisman's user avatar

Comment out metadata_expire directive in /etc/yum.conf and do yum clean all. This worked for me. Not sure how.

answered Aug 6, 2014 at 11:37

Bharath Tupaki's user avatar

[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

  • Answer

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.

answered Jun 23, 2016 at 5:13

john3's user avatar

Фиксим ошибку обновления и установки приложений в CentOS6

02 Feb 2021 | Автор: dd |

В связи с прекращением поддержки CentOS 6.Х, случившейся в конце ноября 2020 года, начинают возникать проблемы как с обновлением системы, так и установки пакетов в произвольной конфе, т.к система начинает ругаццо на отсутствие репозитариев

# yum -y update
или
# yum -y install %любой пакет%
Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

Все что там нужно – это подправить репы на актуальные, для чего открываем файл репозиториев CentOS-Base.repo и комментируем все mirrorlist и меняем все baseurl (а точнее добавляем к закомментированым) на актуальный вариант
baseurl=https://vault.centos.org/6.10/os/$basearch/

если почему то вдруг не зайдет, то меняем целиком первые три пункта в файле
# vi /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# released updates
[updates]
name=CentOS-$releasever - Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
# additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

сохраняем файло, чистим кэши и запускаемся по новой
# yum clean all
# yum -y update

Rating: 3.9/10 (53 votes cast)

Rating: +1 (from 19 votes)

Фиксим ошибку обновления и установки приложений в CentOS6, 3.9 out of 10 based on 53 ratings

Теги: centos

Думаю всем уже известно, что поддержка обновлений системы Centos 6 уже завершена, поэтому при попытке установить какой-либо пакет вы можете получить некоторые ошибки. Рассмотрим некоторые из них.

yum error “Cannot retrieve metalink for repositoryepelPlease verify its path and try again

В EPEL теперь, по умолчанию, используется HTTPS вместо HTTP в названии URL, а установка HTTPS соединения требует, чтобы у вас в системе стояли свеженькие корневые и местные SSL-сертификаты. Некоторые советуют тупо заменить в файле /etc/yum.repos.d/epel.repo все «https» на «http». Да, так тоже работать будет, но это очень кривой способ. Проще и правильней обновить нужные пакеты, указав временное выключение репозитория EPEL.

И так, запускайте для правильного способа эти команды:
yum makecache --disablerepo=epel
yum upgrade --disablerepo=epel ca-certificates nss nss-tools nss-utils

или не очень правильно…
sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo

вручную
nano /etc/yum.repos.d/epel.repo
Приведем оригинальную строку к следующему виду — укажем http вместо https:
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
заменим на
mirrorlist=http://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Ошибка: Cannot find a valid baseurl for repo: base

30 ноября 2020 года поддержка операционной системы CentOS 6 была прекращена. Поэтому, для возобновления работы менеджера пакетов YUM нужно обновить ссылки на репозитории.

Перейдем в директорию cd /etc/yum.repos.d/

За бэкапим оригинальный файл:

cp CentOS-Base.repo CentOS-Base.repo.old

Теперь откроем файлик репозитория редактором «nano 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
# unless you are manually picking other mirrors.
#
# 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
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
baseurl=https://vault.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Осталось только очистить кэш YUM и можно начать ставить нужные вам пакеты:

yum clean all

When you try to update or install any software inside your centos 6/7 you might will see the following issues

YumRepo Error and Cannot find valid baseurl

To fix this issue you need to login to your server using ssh software such as putty

Problem

Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Update Process
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

Cause of this error here is not an issue with your OS but the EOL of using this linux template has reached to the end of the life

So we are going to update the links inside SSH

The Solution:

To fix this problem you edit /etc/yum.repos.d/CentOS-Base.repo and replace all mirrorlist

1. Go to /etc/yum.repos.d/ directory:

# cd /etc/yum.repos.d/

2. Make copy of original file:

# cp CentOS-Base.repo CentOS-Base.repo.old

3. Open and edit file with any text editor:

# vi CentOS-Base.repo

4. Replace mirrorlist‘s

Replace sections:

[base]
[updates]
[extras]

With following:

[base]
name=CentOS-$releasever — Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# released updates
[updates]
name=CentOS-$releasever — Updates
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# additional packages that may be useful
[extras]
name=CentOS-$releasever — Extras
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
# baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

5. Clean yum cache

# yum clean all

6. Run again yum update command:

# yum update

Now you can successfully update your CentOS 6.

Voiced by Amazon Polly

First of all, if you can, you really should upgrade, to either CentOS Stream if a rolling release works for you, or Alpine or Rocky Linux if you want the same sort of release cadence as CentOS historically had, and before anyone points out that there’s no direct upgrade path, I know, and that makes upgrading basically a reprovision exercise, but still in the longer term, you’ll be better off. This is a small note I found regarding the current CentOS 6 status:

CentOS 6 is *dead* and *shouldn't* be used anywhere at *all*

Also, if you’re considering the last non-rolling release of CentOS, CentOS 8, keep in mind that CentOS 8 has had the rug pulled from under it in terms of lifecycle and should have been supported until the end of 2029, but that was brought forward to the end of 2021, and so is also end of life.

For the purposes of what follows though, I’m assuming that you can’t upgrade easily for some reason and that’s why you’re here, stuck in the same hole I was.

So, you’ll see an error similar to the below when you run the usual yum update commands:

Setting up Upgrade Process
YumRepo Error: All mirror URLUniform Resource Identifiers are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

The fix here is fairly simple and it’s to use the CentOS vault repos, which are snapshots of older release trees.

So to fix the base repo, just copy the following into /etc/yum.repos.d/CentOS-Base.repo

[C6.10-base]
name=CentOS-6.10 - Base
baseurl=http://linuxsoft.cern.ch/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never

[C6.10-updates]
name=CentOS-6.10 - Updates
baseurl=http://linuxsoft.cern.ch/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never

[C6.10-extras]
name=CentOS-6.10 - Extras
baseurl=http://linuxsoft.cern.ch/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
metadata_expire=never

[C6.10-contrib]
name=CentOS-6.10 - Contrib
baseurl=http://linuxsoft.cern.ch/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never

[C6.10-centosplus]
name=CentOS-6.10 - CentOSPlus
baseurl=http://linuxsoft.cern.ch/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=0
metadata_expire=never

Then to fix the epel repo, this is the vault config to go into /etc/yum.repos.d/epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://mirror.math.princeton.edu/pub/fedora-archive/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://mirror.math.princeton.edu/pub/fedora-archive/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

If you prefer you can just curl the files down that contain the above config and overwrite the existing old configs:

curl https://www.mark-gilbert.co.uk/wp-content/uploads/2021/08/CentOS-Base.repo --output /etc/yum.repos.d/CentOS-Base.repo
curl https://www.mark-gilbert.co.uk/wp-content/uploads/2021/08/epel.repo --output /etc/yum.repos.d/epel.repo

Update – Dec 2021 – Someone posted in the comments to say they couldn’t download the configs using the commands I included in the article, and I realise this is due to the various https settings I employ on the website and older CentOS installs not being compatible with what I enforce, so I’ve added the same commands but pulling from AWS S3 below to get around this.

AWS S3 hosted versions of the same files and the relevant commands are below:

curl http://mark-gilbert-co-uk.s3-website-eu-west-1.amazonaws.com/CentOS-Base.repo –output /etc/yum.repos.d/CentOS-Base.repo
curl http://mark-gilbert-co-uk.s3-website-eu-west-1.amazonaws.com/epel.repo –output /etc/yum.repos.d/epel.repo

Update – Feb 2022 – I’ve had to amend the details here again as more and more http mirrors are moving to redirect to https, meaning that on a server with extremely old software packages, you won’t be able to connect as you’ll be pushed to https. Unfortunately this is just to happen more and more, and you really, really should migrate to something more modern, that’s still supported.

Update – April 2022 – I’ve updated the epel mirrors to use the Princeton University servers in the US, as someone in the comments pointed out that the epel mirrors were also not working now.

The error looks like-

And here goes the resolution (please carefully update/use the exact CentOS version you are using, in my case it was CentOS 6.9)

1. Go to /etc/yum.repos.d/ directory:

# cd /etc/yum.repos.d/

2. Make copy of original file:

# cp CentOS-Base.repo CentOS-Base.repo.old

3. Open and edit file with any text editor:

# vi CentOS-Base.repo looks

4. After editing it should looks like:

[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://vault.centos.org/6.9/os/$basearch
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
exclude=redhat-logos

5. Clean yum cache

# yum clean all

6. Run again yum update command:

# yum update

That’s It

An alternate Repo other than CentOS vault-

[base]
name=CentOS-$releasever - Base
# mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://ftp.uem.br/linux/CentOS/6.10/os/$basearch
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
exclude=redhat-logos

Ref: https://arstech.net/yumrepo-error-all-mirror-urls-are-not-using-ftp-https-or-file/

Понравилась статья? Поделить с друзьями:
  • Centipede destiny 2 как исправить
  • Center h1 500 internal server error h1 center
  • Cemu ошибка при инициализации рендера vulkan
  • Cem 8d02 ошибка вольво
  • Cem 5f4f вольво ошибка