Fixing HTTP Error 404 Not Found While Trying Other Mirror in CentOS 7

CentOS 7 is one of the most popular Linux distributions for servers, valued for its stability and security. However, as CentOS 7 nears its end of life, users are increasingly encountering the "HTTP Error 404 Not Found" issue when trying to install or update software via yum. This error often occurs when CentOS mirrors or repositories become deprecated or unavailable.

In this guide, we’ll walk through the causes of this error and provide multiple methods to resolve the "HTTP Error 404 Not Found" problem when yum tries to use outdated mirrors in CentOS 7.


Causes of "HTTP Error 404 Not Found Trying Other Mirror"

This error is triggered when yum attempts to connect to repositories or mirrors that:

  • No longer exist due to the age of CentOS 7 and deprecation of active mirrors.
  • Are temporarily down due to traffic or maintenance.
  • Are misconfigured in your repository files, pointing to invalid or unavailable mirrors.

A typical error looks like this:

bash

http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found Trying other mirror.

 

Here’s how you can resolve the issue.


Step-by-Step Solutions to Fix HTTP Error 404 in CentOS 7

1. Switch to CentOS Vault Repositories

As CentOS 7 approaches its end of life, some of its mirrors may no longer be maintained. The CentOS project moves older packages to vault.centos.org, which stores archived versions of CentOS. By updating your repository configuration to point to these vaults, you can continue to install and update software on CentOS 7.

Quick Fix: Use the following commands to replace the default mirrors with CentOS Vault:

 

sudo sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo

sudo sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo

sudo sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo

sudo -- bash -c 'echo "sslverify=false" >> /etc/yum.conf'

 

These commands will:

  • Replace all instances of mirror.centos.org with vault.centos.org in the .repo files.
  • Uncomment baseurl lines to ensure yum is pulling from the correct URL.
  • Comment out mirrorlist to avoid using outdated mirrors.

2. Disable SSL Verification (Optional)

·         In some cases, SSL verification errors may prevent yum from accessing vault repositories or mirrors. You can disable SSL verification to bypass this issue (though be cautious as this reduces security):

sudo -- bash -c 'echo "sslverify=false" >> /etc/yum.conf'

This adds sslverify=false to your /etc/yum.conf file, instructing yum not to verify SSL certificates.

3. Clear yum Cache

Clearing the yum cache ensures that any old or corrupted metadata is removed, and yum fetches fresh data from the vault repositories.

Run the following commands to clear and rebuild the yum cache:

sudo yum clean all

sudo yum makecache

 

4. Restart yum and Verify

                sudo yum update

Final Thoughts

As CentOS 7 nears the end of its support lifecycle, issues like the "HTTP Error 404 Not Found" will become more common. By switching to CentOS Vault repositories and using the steps outlined above, you can continue maintaining your CentOS 7 system without being blocked by unavailable mirrors.

Keep in mind that CentOS 7 will eventually be fully deprecated, so it’s a good time to start planning a migration to a newer system, such as CentOS Stream, Rocky Linux, or AlmaLinux, for long-term stability and security.

If you have any questions or further suggestions, feel free to share them in the comments below!

 

Previous Post Next Post