Hi everyone :)
I have a Cent OS 5
without grafical user interface
I want to install a program of flash memory
how to change the CentOS-Media.repo in etc/yum.repo.d without editor?
I want to change enable = 0 to 1 in CentOS-Media.repo
and want that baseurl = file:///media
but did not know how to do it.?
plz help me
tnx

Dani AI

Generated

A few focused checks and a safe, non‑interactive way to fix this. is right that using vi/nano works, but if you need to change the repo file without an editor the usual cause of the repodata error is either the repo file points at the wrong path or the repo is still disabled. Back up the repo, make sure the ISO/DVD is actually mounted at the path you use, and confirm that the mount contains a repodata/repomd.xml directory.

Backup + non‑interactive edits (adjust the mount path as needed):

cp /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo.bak
grep -Ei 'enabled|baseurl' /etc/yum.repos.d/CentOS-Media.repo

sed -i 's/^[[:space:]]*enabled[[:space:]]*=.*/enabled=1/' /etc/yum.repos.d/CentOS-Media.repo
sed -i 's|^[[:space:]]*baseurl[[:space:]]*=.*|baseurl=file:///media/|' /etc/yum.repos.d/CentOS-Media.repo

Verify mount and repository metadata, then refresh yum cache:

# mount the ISO (example)
mount -o loop /path/to/CentOS-5.5.iso /media

# find the repomd file under the mount point
find /media -maxdepth 3 -name repomd.xml -print

# refresh yum metadata and list repos
yum clean all
yum repolist all

Notes and troubleshooting: the repo key is enabled (not enable) and baseurl must point to the directory that contains repodata/repomd.xml (use the full absolute path; file:/// requires three slashes). If repomd.xml is missing, you mounted the wrong directory (mount the ISO root). If problems persist, check permissions/SELinux on the mount and as a last resort install the RPM directly with rpm -Uvh. : because CentOS 5 is long out of support, consider using a supported release when possible.

Recommended Answers

All 2 Replies

how to change the CentOS-Media.repo in etc/yum.repo.d without editor?

Why not just use an editor? Use Vi/Vim (vi is availible on all unix systems), nano, or Emacs, etc...

thank u
:D
I can change my CentOS-Media but yet can not install software with flash memory
when I write :
#yum --disablerepo=\* --enablerepo=c5-media install mysoft

I see an error :
Error : cannot retrieve repository metadata (repomd.xml) for repository:c5-media .please verify its path and try again

:(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.