http:// qmail.jms1.net / fake-smtp.shtml

fake-smtp

One of the problems I've always run into when installing qmail on servers (which have almost always been running RedHat, CentOS, or some other RedHat-derived Linux distribution) is that they all pre-install the sendmail package, and they all have RPM dependencies which prevent you from un-installing the sendmail package.

My solution to this has always been to leave the sendmail package installed, but not use it. I renamed /usr/sbin/sendmail to something else, and then created the symlink from that name to /var/qmail/bin/sendmail as detailed in djb's directions. For the most part, this strategy worked withouth any problems, however sometimes the sendmail package would be updated in the repositories and a "yum upgrade" command would mess up the symlinks and re-install parts of it.

I remembered reading, a long time ago, about an RPM that somebody had made which would satisfy the dependencies which kept the sendmail package from being un-installed, but not actually touch the system. However, the computer where I saved the link suffered a hardware failure and I never did get around to searching for it again, and it was honestly never a big enough issue for me to spend the time to learn how to create RPM files and do it myself.

Earlier today (2006-04-06), Robert Hanson posted a message on the qmailrocks mailing list which contained a spec file for building such an RPM. I tried building and installing an RPM from this on my own server, and then tried to un-install sendmail. It didn't work- two other packages on my sytem (Centos 3.6) had explicit dependencies on the filename /usr/sbin/sendmail.

So, I added this filename to the Provides: line in the spec file, rebuilt the RPM, and re-installed it... and then the system was very happy to allow the sendmail package to be removed.


Downloads

fake-smtp.spec is the modified spec file, which can be used to build an installable RPM file. This has the modified Provides: line, as well as a more complete description of what the "package" does, why somebody might want to use it, and a link to this web page.

fake-smtp-1.0-1.noarch.rpm is an RPM file built using the spec file above, for those who don't want to deal with building their own RPM files.

Files for SuSE Linux

2008-07-16 Rick Widmer sent me an RPM file (and its spec file) which do the same thing, but are written for SuSE Linux instead of RedHat and friends. The email message said:

John:

I've attached a fake-smtp-suse spec file and rpm that work just like yours for Red Hat, except SuSE uses smtp_daemon instead of smtpdaemon. You install it the same as the Red Hat one, then uninstall postfix instead of sendmail.

# rpm -ivh fake-smtp-suse-1.0-1.noarch.rpm
# rpm -e postfix

If you create the RPM from the specfile, SuSE places it in the directory /usr/src/packages/RPMS/noarch/

This has been tested with OpenSuSE 10.3, but I expect it to work with any recent version.

The files: fake-smtp-suse.spec and fake-smtp-suse-1.0-1.noarch.rpm, for your downloading pleasure. Thanks, Rick!


Using the spec file

A spec file is the heart of an RPM file. It lists the directions needed in order to compile and install the underlying package, as well as a list of the files which are installed by the RPM file.

The spec file above is a very simple one- it has a Provides: line, whose information is added to the RPM database on the system when the RPM file is installed, and the sections which would list how to compile and install the program are totally empty- which ends up building an RPM which doesn't actually add or change anything on the system, but it adds a few entries to the RPM database which convince the system that those "features" are there.

If you downloaded the spec file and you want to build an installable RPM file from it, the process will look like this:

As root...

# rpmbuild -ba fake-smtp.spec

Most RedHat systems build new RPM files in the /usr/src/rpm directory. After running this command you will find the following files:


Using the RPM and un-installing the sendmail package

You must install the newly-created fake-smtp package before the system will let you un-install the sendmail package.

As root...

# rpm -ivh fake-smtp-1.0-1.noarch.rpm
Preparing... ########################################### [100%]
1:fake-smtp ########################################### [100%]
# rpm -e sendmail
Saving /etc/aliases as /etc/aliases.rpmsave

If your system creates an /etc/aliases.rpmsave file, you may wish to remove it.

# rm /etc/aliases.rpmsave


Other operating systems

There are packages for other operating systems which do the same thing as this fake-smtp package.