cannot find a valid baseurl for repo base 7 x86 64 centos 7 как исправить
Исправляем Cannot find a valid baseurl в CentOS 6
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
Для начала давайте выполним команду:
Это позволит сбросить все кэши и в дальнейшем избавит от возможных проблем.
Теперь откроем файл /etc/yum.repos.d/CentOS-Base.repo и закомментируем строки «mirrorlist=. » и «baseurl=. »
Т.е. перед ними поставим символ «#» и в результате получим:
Ниже этих двух строк добавляем в каждую секцию baseurl, в котором в качестве хоста указываем https://vault.centos.org, остальные параметры из старого baseurl и сохраняем результат, например:
В результате для каждой секции файла у нас будет 5 разных вариаций:
Полный файл /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.
#
#
Вот и все! Теперь Вы сможете ввести любую команду yum (yum install, yum update, yum search…) и насладится прежней работой. При этом помните, что обновления для CentOS 6 с 30 ноября 2020 года больше не выпускаются, а хостинг VPS/VDS или Dedicated сервер лучше заказывать у хостинг-провайдера Хост.SU.
How to Fix “Cannot find a valid baseurl for repo” in CentOS
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.

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

To edit the configuration for interface enp0s8, open the file /etc/sysconfig/network-scripts/ifcfg-enp0s8 as shown.
If it is a DNS problem, try to add the Nameservers in the configuration file as shown.
Then restart the Network Manager service with the systemctl command.
After making changes in the network settings, try to run a ping once more.
Now run try to run the yum update or the any yum command that was showing the above error, once more.

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.
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.
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.
💻 Как исправить «Cannot find a valid baseurl for repo» в CentOS
Одной из самых распространенных ошибок, с которыми пользователи CentOS сталкиваются при использовании диспетчера пакетов YUM (например, при запуске команды обновления yum), особенно в недавно установленной системе, является «“Cannot find a valid baseurl for repo: base/7/x86_64”.».
В этой короткой статье мы покажем, как исправить ошибку “Cannot find a valid baseurl for repo в дистрибутиве CentOS Linux.
На следующем снимке экрана показана вышеупомянутая ошибка после выполнения команды yum для поиска пакета.
Ошибка указывает на то, что YUM не может получить доступ к базовому репозиторию, который он использует для поиска информации о пакете.
В большинстве случаев возможны две причины ошибки: 1) проблемы с сетью и / или 2) базовый URL закомментирован в файле конфигурации репозитория.
Вы можете исправить эту ошибку следующими способами:
1. Убедитесь, что ваша система подключена к Интернету.
Вы можете попробовать пропинговать любое интернет-направление, например, google.com.
Результат проверки связи указывает либо на проблему DNS, либо на отсутствие подключения к Интернету.
В этом случае попробуйте отредактировать файлы конфигурации сетевого интерфейса.
Чтобы определить сетевой интерфейс, выполните команду ip.
Чтобы изменить конфигурацию интерфейса enp0s8, откройте файл /etc/sysconfig/network-scripts/ifcfg-enp0s8, как показано далее:
Если это проблема DNS, попробуйте добавить серверы имен в файл конфигурации, как показано на рисунке.
Затем перезапустите службу Network Manager с помощью команды systemctl.
Для получения дополнительной информации прочитайте нашу статью:
После внесения изменений в настройки сети попробуйте еще раз запустить пинг.
Теперь выполните попытку еще раз запустить обновление yum или любую команду yum, которая показала вышеуказанную ошибку.
2. Если система подключена к Интернету и DNS работает нормально, то должна быть проблема с файлом конфигурации репозитория /etc/yum.repos.d/CentOS-Base.repo.
Откройте файл, используя ваш любимый редактор командной строки.
Найдите раздел [base], попробуйте раскомментировать baseurl, удалив начальный символ # в строке baseurl, как показано на следующем снимке экрана.
Сохраните изменения и закройте файл.
Теперь попробуйте снова запустить команду yum.
В этой статье мы объяснили, как исправить ошибку «Cannot find a valid baseurl for repo:» в CentOS 7.
Мы хотели бы услышать ваше мнение.
Вы также можете поделиться решениями, которые вы знаете, чтобы решить эту проблему, с помощью формы обратной связи ниже.
CentOS
The Community ENTerprise Operating System
Cannot find a valid baseurl for repo: base/7/x86_64
Cannot find a valid baseurl for repo: base/7/x86_64
Post by nike » 2018/07/03 05:49:20
Re: Cannot find a valid baseurl for repo: base/7/x86_64
Post by avij » 2018/07/03 06:34:50
Perhaps that will lead you to find the source of the problem.
Re: Cannot find a valid baseurl for repo: base/7/x86_64
Post by nike » 2018/07/09 10:12:02
Perhaps that will lead you to find the source of the problem.
Re: Cannot find a valid baseurl for repo: base/7/x86_64
Post by avij » 2018/07/09 10:28:29
OK, that looks good. Please show the full output of «yum update». There should be other errors shown before the «Cannot find a valid baseurl» message.
Additionally, are you using a proxy? Should you be using a proxy? If a proxy is involved or if you think it might be involved, see the proxy config in /etc/yum.conf
Re: Cannot find a valid baseurl for repo: base/7/x86_64
Post by nike » 2018/07/09 10:48:57
OK, that looks good. Please show the full output of «yum update». There should be other errors shown before the «Cannot find a valid baseurl» message.
Additionally, are you using a proxy? Should you be using a proxy? If a proxy is involved or if you think it might be involved, see the proxy config in /etc/yum.conf
thanks for your reply
i do not use proxy.
here is yum update.
[root@myserver oracle]# yum update
Loaded plugins: fastestmirror, langpacks
One of the configured repositories failed (Unknown),
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).
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:
Cannot find a valid baseurl for repo: base/$releasever/x86_64
Error: Cannot find a valid baseurl for repo: base [closed]
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
I need some help please, I am trying to install yum update in CentOS 5.9 but I get error
please help me how to fix this
update content of CentOS-Base.repo
Thank you in advance.
2 Answers 2
This is because Centos 5 is deprecated and requires manual update of the Base repo file to point everything to the Centos vault.
Backup your /etc/yum.repos.d/Centos-Base.repo
Replace with the following will get you going again:
This might be caused by two possibilities.
1. Repo too old to find
Base on your centos version, I tried to find the os via the link. And getting this information from readme file.
This directory (and version of CentOS) is deprecated. For normal users, you should use /5/ and not /5.9/ in your path. Please see this FAQ concerning the CentOS release scheme:
If you know what you are doing, and absolutely want to remain at the 5.9 level, go to http://vault.centos.org/ for packages. Please keep in mind that 5.9 no longer gets any updates
In this link, it suggest you to find old version via another link. Thus, you need to modify CentOS-Base.repo.
2. Network Issue
checking the mirrorlist server is accessible.








