Operations 5 min read

How to Fix Common yum Errors on CentOS 7: 404, Failed Install, and Missing Python

This guide walks through diagnosing and fixing typical yum command failures on CentOS 7, covering repository 404 errors, package installation failures caused by immutable directories, and missing Python interpreter issues, with concrete commands and step‑by‑step solutions.

ITPUB
ITPUB
ITPUB
How to Fix Common yum Errors on CentOS 7: 404, Failed Install, and Missing Python

Introduction

This article explains how to diagnose and resolve common yum command failures on CentOS 7, including 404 repository errors, failed package installations, and missing Python interpreter.

1. yum 404 error

Check that the yum repository is correctly configured, for example by downloading the Aliyun repo file:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

If the error mentions $releasever, verify that the centos-release package is installed. Install it if missing:

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/centos-release-7-7.1908.0.el7.centos.x86_64.rpm
rpm -ivh centos-release-7-7.1908.0.el7.centos.x86_64.rpm

2. yum install fails (example: telnet)

The error may indicate that the target directory has the immutable attribute ( i) set, preventing file writes. Remove the attribute:

chattr -i /usr/bin

3. yum reports missing Python interpreter

yum is a Python script; if /usr/bin/python is missing, reinstall Python.

Steps:

Inspect the shebang line in /usr/bin/yum to confirm the expected Python path.

Check whether the Python binary exists: ls -al /usr/bin/python If the file is absent, locate a working CentOS 7 system, download the Python packages, and copy them to the affected host:

mkdir /python/
yum install python --downloadonly --downloaddir=/python/
scp /python/* [email protected]:/tmp/
cd /tmp
rpm -ivh *

Alternatively, adjust any renamed or moved Python binaries (e.g., /usr/bin/python.bak) back to /usr/bin/python.

Conclusion

Following these steps should resolve the most frequent yum failures on CentOS 7.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxtroubleshootingpackage managementCentOSyum
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.