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 finished installing CentOS 6, but when I tried running yum update
I got:
[root@centos6test ~]# yum update
Loaded plugins: fastestmirror, refresh-packagekit
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=i386&repo=os
error was 14: PYCURL ERROR 6 - "" Error: Cannot find a valid baseurl for repo: base
Why is that happening? How can I fix it?
asked Oct 19, 2011 at 9:14
2
First you need to get connected, AFAIK CentOS 6 minimal set your network device to ONBOOT=No
, just do a dhclient
with admin privileges to your network interface and you should be up and running:
$ sudo dhclient
answered Oct 23, 2011 at 20:01
JorgeJorge
1,7421 gold badge11 silver badges2 bronze badges
3
I had been struggling with the same problem on Centos6.4 x86_64. I got the following error
:
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
So, I fixed it by these steps:
edit network interface. For my case, I used eth0
in CentOS 6.X
In CentOS 7 you can use the «ensxxx» interface.
vim /etc/sysconfig/network-scripts/ifcfg-eth0
update NM_CONTROLLED to no
ONBOOT=no
NM_CONTROLLED=no
BOOTPROTO=dhcp
DNS1=8.8.8.8
DNS2=8.8.4.4
restart the network interface
ifdown eth0
ifup eth0
nnsense
3993 silver badges11 bronze badges
answered Apr 15, 2014 at 18:47
Raja DavidRaja David
3663 silver badges5 bronze badges
6
I had the same issue and it got resolved after I edited /etc/yum.conf
file. If you are running on proxy server and the IP which is given to the server is bypassed but still when you open in browser (IE — we need to give check mark on proxy but no need to give username and password.)
Add this following line in the main section of the file /etc/yum.conf file.
proxy=http://xxx.xxx.xx.xx:8080
ie, substituting the proxy address with actual proxy. Also change the port number if it is not 8080.
If proxy requires authentication, add this also to the file
proxy_username=username
proxy_password=password
Anthon
77k42 gold badges159 silver badges217 bronze badges
answered Oct 3, 2013 at 12:25
Anand TSAnand TS
1511 silver badge3 bronze badges
I edited the file /etc/yum.repos.d/CentOS-Base.repo
and uncommented baseurl
:
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
answered May 26, 2013 at 23:09
MastergalenMastergalen
2522 silver badges7 bronze badges
1
If pinging a well known host by its name (e.g. ping www.google.com
) returns ping: unknown host
but pinging an ip (e.g. ping 8.8.8.8
) works fine then you have a DNS resolution issue — try adding these entries to /etc/resolv.conf
:
nameserver 8.8.8.8
nameserver 8.8.4.4
ndemou
2,4391 gold badge19 silver badges27 bronze badges
answered Dec 4, 2011 at 7:03
Happened to me on CentOS 6 as it has reached end-of-life due to which no mirrors work now. Though you can use Vault repo where everything has been moved.
For CentOS 6, do:
curl https://www.getpagespeed.com/files/centos6-eol.repo --output /etc/yum.repos.d/CentOS-Base.repo
or take a look here.
This should fix up yum.
answered Jan 7, 2021 at 12:32
2
I had the same problem yesterday and I spent hours trying to solve it. The solution ended up being simple.
Delete the contents of /etc/yum.repos.d/remi.repo
and then execute
# yum update
It’s done! The file’s content will start the download again and be configured.
ndemou
2,4391 gold badge19 silver badges27 bronze badges
answered May 4, 2012 at 17:16
4
Here’s yet another possibility that I stumbled upon, causing this problem:
I was using a Puppet module to create the EPEL repo for CentOS, the stahnma/epel module.
Within the module it constructed the repo URL with the variable ::os_maj_version
which didn’t exist in my list of facts. I had to replace that with ::operatingsystemmajrelease.
So the URL in /etc/yum.repos.d/epel.repo
was malformed.
slm♦
356k112 gold badges753 silver badges860 bronze badges
answered Feb 8, 2014 at 0:50
MojoMojo
1113 bronze badges
It happened to me on a Centos 7 environment, and I was able to solve it with the following command:
yum clean all
I had not run any yum command for a few months, seems like the cached metadata got obsolete.
answered Oct 1, 2018 at 9:11
All previous answers are correct but unfortunately did not work for me.
The below command worked for me:
Warning this will delete all of you Centos repos !!!
use this at your own risk
mkdir ~/backup
cp -r /etc/yum.repos.d/Cen* ~/backup
rm /etc/yum.repos.d/Cen*
answered Sep 6, 2018 at 22:04
grepitgrepit
2132 silver badges6 bronze badges
2
When using VirtualBox with a Centos6 image I cannot do yum udpate anymore, I have checked on the internet and it looks that Centos6 is deprecated.
[root@centos69 ~]# yum makecache
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, security
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
[root@centos69 ~]# yum update
Failed to set locale, defaulting to C
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. 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
asked Feb 20, 2021 at 11:39
Yes, like red hat 6.x centos 6 did go EOL in november 2020, hope you don’t have anything sensitive stuff in that vm.
https://forums.centos.org/viewtopic.php?t=72710
You can change to use the vault at vault.centos.org. First you should disable any repo that no longer work. You can get a list of repos with
yum repolist
then you can disable them with
yum-config-manager --disable {reponame} {reponame}
like
yum-config-manager --disable base update
or just disable all of them
yum-config-manager |grep ^\[|tr -d ']['|xargs yum-config-manager --disable
Once the broken repos are disabled you need to add the vault repo.
yum-config-manager --add-repo=https://vault.centos.org/6.10/os/x86_64/
After that you can install packages as needed but remember — it’s no updates to anything so if security is a concern you need to change os to something newer that is supported.
answered Feb 20, 2021 at 17:15
lpaseenlpaseen
1,1598 silver badges8 bronze badges
Stuck with the Error – Cannot find a valid baseurl for repo: base? We can help you.
Generally, we come across this error when we try to interact with yum, use EasyApache or run updates.
As part of our Server Management Services, we assist our customers with several CloudLinux queries.
Today, let us see how we can resolve this error.
Error – Cannot find a valid baseurl for repo: base
Recently, our customers informed us that they came across the below error while trying to interact with yum, use EasyApache, or run updates:
This can be due to two major reasons:
- The base, epel, extras, and updates repositories come default on CentOS 6 systems. However, we don’t use it on CloudLinux systems. Accidentally reactivation can cause issues.
- The error indicates, YUM is incapable of accessing the base repository that it uses to find package information.
In most cases, there are two possible causes of the error:
- Network issues
- Base URL being commented out in the repository configuration file.
Fix the error
Moving ahead, our Support Techs suggest two methods to fix the error.
1. We disable these repositories to ensure that the system continues to function properly:
# yum-config-manager –disable base # yum-config-manager –disable epel # yum-config-manager –disable extras # yum-config-manager –disable updates
2. a. Firstly, we ensure the system is connected to the Internet.
For example, google.com.
# ping google.com
The ping result will indicate either a DNS problem or no Internet connectivity.
Here, we edit network interface configuration files. We can find the network interface, via the IP command.
To edit the configuration for interface enp0s8, open the file /etc/sysconfig/network-scripts/ifcfg-enp0s8.
# vi /etc/sysconfig/network-scripts/ifcfg-enp0s8
If it is a DNS problem, we add the Nameservers in the configuration file.
DNS1=10.0.2.2 DNS2=8.8.8.8
Then we restart the Network Manager service with the systemctl command.
# systemctl restart NetworkManager
Once done, we run a ping once more.
# ping google.com
Eventually, run the yum update or any yum command that gave us the above error.
b. Suppose, the connection and DNS are working fine. Then the issue will be with the repo configuration file /etc/yum.repos.d/CentOS-Base.repo.
Firstly, we open the file using any command-line editor.
# vi /etc/yum.repos.d/CentOS-Base.repo
In the [base] section, we uncomment the baseurl by removing the leading # on the baseurl line.
Then we save the changes and close the file.
Finally, we run the yum command again.
# yum update
[Need help with the resolution? We’d be happy to assist]
Conclusion
To conclude, we saw how our Support Techs fix the Cannot find a valid baseurl error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
I was initially going to put this onto an Ansible group, as I first noticed the issue when manually running an Ansible playbook. But I checked and this is indeed CentOS, as the issue appears on the host on question.
When I run yum check-update on one of my hosts, it displays the error:
Code: Select all
[darren@dhost ~]$ sudo yum check-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/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
My /etc/yum.repos.d/CentOS-Base.repo looks like this:
Code: Select all
[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/
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/
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/
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/
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/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
I checked google and of course, there are a lot of suggestions. I tried to uncomment baseurl and comment out mirror. I did this, and it didn’t fix the issue.
This would be frustrating enough, if it were not for the fact that there are six other VMs sitting on that ESXi host, and they have what I believe are identical yum repos. They all point to the same DNS server, and they can all ping mirror.centos.org.
EDIT: I just took a ‘working’ /etc/yum.repos.d/CentOS-Base.repo from my database server, backed up the ‘faulty’ one and placed the working file onto the host in question. Same error.
I should also add that the server which is having these problems is the DNS server itself, so whilst the other boxes point to it, it points to itself.
Code: Select all
[~] darren@database1% (175) grep nameserver /etc/resolv.conf
nameserver 192.168.1.19
nameserver 192.168.1.15
nameserver 192.168.1.254
nameserver 8.8.8.8
But ..
Code: Select all
[~] darren@dns1% (175) grep nameserver /etc/resolv.conf
nameserver 127.0.0.1
nameserver 192.168.1.15
nameserver 192.168.1.254
But I don’t think that this is related to name resolution, as every box can ping any host I choose — inside or outside our LAN.
Anyone care to offer a suggestion?
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.
One of the commonest errors CentOS users encounter when using YUM package manager (for example running yum update command), especially on a freshly installed system is the “Cannot find a valid baseurl for repo: base/7/x86_64”.
In this short article, we will show how to fix “cannot find a valid baseurl for repo” error in CentOS Linux distribution.
The following screenshot shows the above error after running a yum command to search for a package.
# yum search redis
The error indicates that YUM is not capable of accessing the base repository that it uses to find package information. In most cases, there are two possible causes of the error: 1) network issues and/or 2) base URL being commented out in the repository configuration file.
You can fix this error in the following ways:
1. Make sure that your system is connected to the Internet. You can try to ping any internet direction, for example, google.com.
# ping google.com
The ping result indicates either a DNS problem or no Internet connectivity. In this case, try to edit network interface configuration files. To identify your network interface, run the ip command.
# ip add
To edit the configuration for interface enp0s8, open the file /etc/sysconfig/network-scripts/ifcfg-enp0s8 as shown.
# vi /etc/sysconfig/network-scripts/ifcfg-enp0s8
If it is a DNS problem, try to add the Nameservers in the configuration file as shown.
DNS1=10.0.2.2 DNS2=8.8.8.8
Then restart the Network Manager service with the systemctl command.
# systemctl restart NetworkManager
For more information, read our article: How to Configure Network Static IP Address and Manage Services on RHEL/CentOS 7.0.
After making changes in the network settings, try to run a ping once more.
# ping google.com
Now run try to run the yum update or the any yum command that was showing the above error, once more.
# yum search redis
2. If the system is connected to the Internet and DNS is working fine, then there should be an issue with the repo configuration file /etc/yum.repos.d/CentOS-Base.repo.
Open the file using your favorite command-line editor.
# vi /etc/yum.repos.d/CentOS-Base.repo
Look for the [base]
section, try uncommenting the baseurl
by removing the leading #
on the baseurl line as shown in the following screenshot.
Save the changes and close the file. Now try to run yum command again.
# yum update
In this article, we have explained how to fix the “Cannot find a valid baseurl for repo:” error in CentOS 7. We would like to hear from you, share your experience with us. You can also share solutions you know to fix this issue, via the feedback form below.
If You Appreciate What We Do Here On TecMint, You Should Consider:
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
Фиксим ошибку обновления и установки приложений в 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
If you’re on any of the Linux distributions that use the yum package manager, then you might end up seeing an error that reads Cannot find a valid baseurl for repo: base shortly after you finishing installing the operating system. This is most commonly an error associated with the Fedora, Red Hat and CentOS Linux distributions, but you might also get it when attempting to update yum on compatible versions of SUSE. You’ll normally only get the error when trying to update, but fortunately, there’s a fairly simple way around it.
Method 1: Forcing yum to Find a baseurl
This error message indicates that, for whatever reason, the Yellowdog Updater, Modified (yum) system isn’t capable of accessing the base that it uses to find package information. To reproduce the error message, run sudo yum update or simply yum update if you’re the root user. If it updates this time, then the error was merely caused by a networking hiccup and you don’t need to do anything else.
On the other hand, you might find that you’ve reproduced the error message. The first thing to check is to make sure that you’re connected to the network. You’ll want to be sure that you’re not experiencing an Internet outage, which is by far the most common cause of this error. If you’re on the Internet and still aren’t able to find a valid baseurl, then try ping mirrorlist.centos.org and see what happens. Push Ctrl+C to end the pinging process and see what results you received. If you’re using Red Hat or Fedora, then you might want to substitute the mirrorlist URL that the error reported to you instead of the CentOS URL we used.
Should you be unable to ping the servers, then you might have to wait because they could be experiencing a temporary outage. Otherwise, if you’re having networking issues, try the path shown in the image and toggle the ONBOOT= line to either yes or no. You might want to try both of them. Once you have it set, run sudo dhclient as long as you’re not working through ssh and then attempt to update yum again. Should you still be struggling to get the package manager to update, then try editing that file again.
You’ll find an option called NM_CONTROLLED, which you should set to no. If you do this, then make sure that ONBOOT= is also set to no. When you set options to no, make sure that you’re typing the words only in lower case as some versions of CentOS and Fedora might actually have some sort of case sensitivity in this respect.
Once you’ve finished editing the file, make sure that you have an Ethernet cable attached to the first networking interface on the machine and try running ifdown eth0; ifup eth0 to reset the network. Users of CentOS 7, like in our example, might not be able to find this file because things were changed. If that’s the case, then try looking for what’s shown in the image below or something else that resembles that pattern. CentOS’ developers decided to make some changes the last time that they revamped the minimal install code, and that changed the name of some of the networking interfaces as a result.
Once everything looks good, then try updating yum again and see if it works.
Method 2: Uncommenting the baseurl
In a few rare situations, this error might not be caused by a networking issue. If you’re sure that you’re connected and still can’t get anything to work, then open the file shown in the image below as the root superuser with your favorite text editor. Once again, if you’re not using CentOS like we were then you’ll need a simple name change to find the right file.
You should see a line that reads:
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
Make sure that this doesn’t start with a comment flag like the # symbol. If it does, then remove it and then save the file. Try updating again. This should have forced the system to update properly this time, which it can’t do if it can’t find this line because it was hidden by a comment flag.
Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.