All Products
Search
Document Center

:Resolve the yum error: "HTTP Error 404 - Not Found Trying other mirror"

Last Updated:Nov 12, 2025

Causes

This error occurs when yum cannot find the required repository metadata at the configured path. Potential causes include:

  • Operating system end-of-life (EOL): The OS provider has moved the official yum repositories for your EOL version to an archive server (vault), so the original mirror URLs are invalid. You must switch the mirror source to the archive repository. For more information, see handling the OS EOL.

  • Incorrect HTTP proxy in environment variables: An incorrect HTTP or HTTPS proxy is configured in your environment variables (for example, in the /etc/profile file), which prevents yum from connecting to the mirror server. For more information, see check and fix incorrect environment variable configurations.

  • Missing centos-release package: If this package is missing, yum cannot find any available repositories. yum cannot resolve variables in the configuration files and therefore generates incorrect URLs. For more information, see install the centos-release package.

Solution

Handle the OS EOL

Important

EOL systems are a security risk because they no longer receive security updates. The following steps are a temporary workaround. We strongly recommend that you replace and migrate the operating system as soon as possible.

CentOS 6

  1. Back up the source configuration files.

    # Back up the Base source configuration.
    sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    
    # Back up the EPEL source configuration.
    sudo cp  /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
  2. Switch the Base repository to the archive mirror.

    sudo vim /etc/yum.repos.d/CentOS-Base.repo 

    Replace the content of the CentOS-Base.repo file with the following:

    [base]
    name=CentOS-6.10
    enabled=1
    failovermethod=priority
    baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/os/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
    
    [updates]
    name=CentOS-6.10
    enabled=1
    failovermethod=priority
    baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/updates/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
    
    [extras]
    name=CentOS-6.10
    enabled=1
    failovermethod=priority
    baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/extras/$basearch/
    gpgcheck=1
    gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
  3. Switch the EPEL repository to the archive mirror.

    vim /etc/yum.repos.d/epel.repo

    Replace the content of the epel.repo file with the following:

    [epel]
    name=Extra Packages for Enterprise Linux 6 - $basearch
    enabled=1
    failovermethod=priority
    baseurl=http://mirrors.cloud.aliyuncs.com/epel-archive/6/$basearch
    gpgcheck=0
    gpgkey=http://mirrors.cloud.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6
  4. Run the yum repolist command. If the command lists the repositories without a 404 error, the issue is resolved.

CentOS 7

  1. Back up the source configuration file.

    sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  2. Download the new source configuration file.

    sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  3. Clear and rebuild the yum cache.

    yum clean all && yum makecache
  4. Run yum repolist. If the command lists the repositories without a 404 error, the issue is resolved.

Check and fix incorrect environment variable configurations

  1. Check the proxy environment variables.

    echo $http_proxy
    echo $https_proxy
  2. Remove the proxy configuration.
    If the previous step returned a proxy address, edit the /etc/profile file. Find the lines that contain export http_proxy= or export https_proxy= and comment them out by adding a # at the start of each line.

    sudo vim /etc/profile
    # export http_proxy="http://your.proxy.address:port"
    # export https_proxy="https://your.proxy.address:port"
  3. Run the yum repolist command. If the command lists the repositories without a 404 error, the issue is resolved.

Install the centos-release package

  1. Check if the package is installed.

    If the command returns package centos-release is not installed, install the package.

    sudo rpm -q centos-release
  2. Download the package.

    Go to the official mirror site, find the latest version of the centos-release-*.rpm package, and copy its link.

    Replace <URL> with the copied link.

    sudo wget <URL>
    For example, for CentOS 7, <URL> is https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/centos-release-7-9.2009.0.el7.centos.x86_64.rpm.
  3. Install the package.

    Replace <file_name> with the filename of the downloaded package.

    sudo rpm -ivh <file_name>
    For example, for CentOS 7, <file_name> is centos-release-7-9.2009.0.el7.centos.x86_64.rpm.
  4. Run the yum repolist command. If the command lists the repositories without a 404 error, the issue is resolved.