Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Update yum repositories on your server

This guide shows you how to refresh and fix the software sources that yum uses.

Dedicated Servers2 min read8 steps

What is yum?

Yum is a tool that installs and updates software on Red Hat style Linux, such as CentOS, AlmaLinux and Rocky Linux. A repository is an online store of software. Yum reads a list of these stores. Each store has a small settings file. If the file is old or wrong, installs and updates fail.

You need root access for this guide. Root is the main administrator login of the server.

Tip: Yum is old. Newer systems use dnf, and yum is often just a link to it. The commands below work the same way with dnf.

Steps

  1. Connect to your server with SSH.
  2. List the stores yum knows.
    yum repolist
    This shows each active repository.
  3. Clear old saved data.
    yum clean all
    This removes saved lists, so yum fetches new ones.
  4. Build a fresh list.
    yum makecache
    This downloads the latest package lists.
  5. Update the software.
    yum update
    This shows what will be updated. Read it, then type y to continue.

Add a new repository

  1. Go to the settings folder.
    cd /etc/yum.repos.d/
  2. Many repositories come as a package. For example, EPEL:
    yum install epel-release
    This adds the EPEL store.
  3. Run yum repolist again to see it.

If a repository fails

  • Read the error. It names the repository.
  • Check that the server reaches the internet.
  • CentOS 7 and 8 have reached end of life. Their old addresses moved. Update the baseurl lines in the files in /etc/yum.repos.d/ or move to a supported system.
  • To skip a broken store once, use yum --disablerepo=name update.
Warning: Updates can change software that your sites use. On a live server, take a backup or snapshot first. Do not edit files in /etc/yum.repos.d/ without copying them first.

Quick recap

  • Yum gets software from repositories listed in /etc/yum.repos.d/.
  • Run yum clean all and yum makecache to refresh.
  • Add stores with packages like epel-release.
  • Take a backup before big updates.