Fix CentOS 7 Repositories Not Working (2025)

CentOS Linux 7 reached its End of Life (EOL) on June 30, 2024. This is to mean no updates and security patches, and even the system repositories are discontinued and moved to vault. By using vault enable you to access packages build for CentOS 7 after EOL, but without any updates.

This method is not recommended for production workloads, you should consider migrating to other alternative distributions such as RHEL, Rocky Linux, AlmaLinux, Oracle Linux 9 or 8. This OS migration will ensure you enjoy continued security updates and support for your critical workloads.

On July 1, 2024, the CentOS team moved all its repositories to archive (vault.centos.org). We can easily confirm CentOS 7 Linux repositories are not working anymore:

$ sudo yum makecache -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=genclo error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"


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

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     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:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64

Fixing CentOS 7 YUM Repositories

We have created a git repository with two scripts:

  • generate_base_repos.sh: Use this to generate vault repositories into .repo files.
  • enable_repos.sh: This is used to optionally enable or disable the repositories.

Step 1: Download and run the scripts

Visit our Github repository and follow provided instructions to clone the repo or download scripts using curl.

To generate repositories run:

$ bash generate_base_repos.sh
Created centos7_repos/atomic.repo
Created centos7_repos/centosplus.repo
Created centos7_repos/dotnet.repo
Created centos7_repos/extras.repo
Created centos7_repos/fasttrack.repo
Created centos7_repos/os.repo
Created centos7_repos/rt.repo
Created centos7_repos/updates.repo
Generated .repo files for all repositories in centos7_repos.

Choose the ones to enable:

$ bash enable_repos.sh
Do you want to enable repository 'atomic' (y/n)? n
Disabled repository 'atomic'.
Do you want to enable repository 'centosplus' (y/n)? y
Enabled repository 'centosplus'.
Do you want to enable repository 'dotnet' (y/n)? n
Disabled repository 'dotnet'.
Do you want to enable repository 'extras' (y/n)? y
Enabled repository 'extras'.
Do you want to enable repository 'fasttrack' (y/n)? y
Enabled repository 'fasttrack'.
Do you want to enable repository 'os' (y/n)? y
Enabled repository 'os'.
Do you want to enable repository 'rt' (y/n)? n
Disabled repository 'rt'.
Do you want to enable repository 'updates' (y/n)? y
Enabled repository 'updates'.
Repository enablement process completed.

Step 2: Backup current repositories

Backup your OS repositories in case you will want to reference.

mkdir ~/repos_backup
sudo mv /etc/yum.repos.d/* ~/repos_backup

Step 3: Copy generated repository files

Copy the repository files generated, they are stored in centos7_repos directory:

sudo cp -r centos7_repos/* /etc/yum.repos.d/

We are copying them into /etc/yum.repos.d/. Once done clean your repositories package cache.

$ sudo yum clean all
Loaded plugins: fastestmirror
Cleaning repos: atomic centosplus dotnet extras fasttrack os rt updates
Cleaning up list of fastest mirrors

Update the index of the packages.

$ sudo yum makecache fast
Loaded plugins: fastestmirror
Determining fastest mirrors
atomic                                                                                                                                                                         | 2.9 kB  00:00:00
centosplus                                                                                                                                                                     | 2.9 kB  00:00:00
dotnet                                                                                                                                                                         | 2.9 kB  00:00:00
extras                                                                                                                                                                         | 2.9 kB  00:00:00
fasttrack                                                                                                                                                                      | 2.9 kB  00:00:00
os                                                                                                                                                                             | 3.6 kB  00:00:00
rt                                                                                                                                                                             | 2.9 kB  00:00:00
updates                                                                                                                                                                        | 2.9 kB  00:00:00
(1/9): dotnet/7/x86_64/primary_db                                                                                                                                              | 162 kB  00:00:00
(2/9): extras/7/x86_64/primary_db                                                                                                                                              | 253 kB  00:00:00
(3/9): fasttrack/7/x86_64/primary_db                                                                                                                                           |  36 kB  00:00:00
(4/9): atomic/7/x86_64/primary_db                                                                                                                                              | 101 kB  00:00:00
(5/9): centosplus/7/x86_64/primary_db                                                                                                                                          | 8.3 MB  00:00:00
(6/9): os/7/x86_64/group_gz                                                                                                                                                    | 153 kB  00:00:00
(7/9): os/7/x86_64/primary_db                                                                                                                                                  | 6.1 MB  00:00:00
(8/9): updates/7/x86_64/primary_db                                                                                                                                             |  27 MB  00:00:00
(9/9): rt/7/x86_64/primary_db                                                                                                                                                  | 6.6 MB  00:00:01
Metadata Cache Created

Step 4: Test Vault repositories

Check list of enabled repositories in the system.

$ sudo  yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                                                                        repo name                                                                                        status
atomic/7/x86_64                                                                                CentOS-7 - atomic                                                                                   137
centosplus/7/x86_64                                                                            CentOS-7 - centosplus                                                                               277
dotnet/7/x86_64                                                                                CentOS-7 - dotnet                                                                                   395
extras/7/x86_64                                                                                CentOS-7 - extras                                                                                   526
fasttrack/7/x86_64                                                                             CentOS-7 - fasttrack                                                                                 44
os/7/x86_64                                                                                    CentOS-7 - os                                                                                    10,072
rt/7/x86_64                                                                                    CentOS-7 - rt                                                                                       227
updates/7/x86_64                                                                               CentOS-7 - updates                                                                                6,173
repolist: 17,851

Try package installation to test if they are working.

$ sudo yum install vim wget
...
Transaction Summary
======================================================================================================================================================================================================
Install  2 Packages (+30 Dependent packages)

Total download size: 19 M
Installed size: 62 M
Is this ok [y/d/N]: y

Validate if the installation was successful:

$ which vim
/usr/bin/vim

$ which wget
/usr/bin/wget

When a full OS upgrade is done, the CentOS default repositories are configured on the system. You can delete them by running the following commands:

sudo rm -rf  /etc/yum.repos.d/CentOS-*

That’s all. You now have working Vault repos working in your CentOS 7 Linux which is enjoying its retirement!. We hope this was helpful.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

2 thoughts on “Fix CentOS 7 Repositories Not Working (2025)”

  1. Hi guys,

    Newbie to CentOS, yum, repos etc but needed to use CentOS as this was used for a course environment I’m following. Found this page, applied the fixes, worked like a dream.

    Thanks a million!!!!

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

In this tutorial, we are going to look at how to install Jenkins on Ubuntu 24.04|22.04. First, let us learn […]

Can I install and Use PowerShell on my macOS?. PowerShell is a cross-platform task automation and configuration management framework, consisting of […]

Fish, short for Friendly Interactive Shell, is an easy to install and use shell for Unix systems. The shell comes […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.