Installed software from source, how to say yum not to install it from package?

Solution 1:

"I've installed foobar version 2, compiled from sources"

Take the extra effort when adding custom software to your system and package your additions in a RPM. See Martin Streicher, 2010-01-12, Building and distributing packages, IBM on how to do that.

Then install that resulting RPM so it can and will play nice with your package manager's conflict and dependency handling, upgrade, downgrade and removal procedures and security reporting.

Solution 2:

Another option (albeit definitely not the best answer): make a dummy rpm file with the name in question.

You will need rpmbuild installed, and a dummy tarball.

mkdir ~/rpmbuild/{RPMS,SOURCES}
touch empty.txt
tar -zcf ~/rpmbuild/SOURCES/example.tar.gz empty.txt

Write the dummy spec file. This one works for me on Fedora 29. It should be good on CentOS 7 too.

Name:           example
Version:        0.0.0
Release:        1%{?dist}
Summary:        Dummy package

Group:          Dummy
License:        CC-BY-SA 3.0
URL:            http://example.com
Source0:    example.tar.gz
BuildArch:  noarch

#BuildRequires:
#Requires:

%description
Dummy for example

%prep
:

%build
:

%install
:

%files
%doc

%changelog

Tweak package name and version number as necessary, and then build the package.

rpmbuild -ba example.spec

The output "binary" rpm file will be ~/rpmbuild/RPMS/noarch/example-0.0.0-1.fc29.x86_64.rpm

Solution 3:

This is not how rpm works.

rpm uses a db where it stores which rpms are installed on the system. If you install some files manually, rpm does not know about it.

The best way to solve this is to install foobar 2 with an rpm. Other solutions would only be workaround and would not work in the long run.