I have accidentally removed the symlink to /bin/rpm from my Centos7 installation. Now the rpm command is not working. Does anyone know how to fix this one or how to add this again as symlink ?


The /bin/rpm is typically not a symlink. There is a symlink /bin which points to /usr/bin directory.

So if you have removed /bin/rpm - you have removed an actual file, not a symlink.

For restoring it, you will need access to another CentOS 7 machine, running the same architecture (e.g. x86_64).

Copy it from the other machine by uploading it to the server via SFTP.

Ensure matching version afterward, by running:

yum reinstall rpm
  • Thanks , just "yum reinstall rpm" works for me. – Damithdev Feb 19 '20 at 7:16

Just reinstall rpm (yum reinstall rpm, or even yum reinstall /bin/rpm -- if you don't know the package's name). The yum program uses RPM format and databases, but doesn't run rpm itself.

Lucky you. Next time you'll delete something really critical. Be careful when running as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.