Here's some information about using Razor with Amavis and SpamAssassin that I collected in the process of getting stuff working.

  • Install Razor

If you are using Debian there is a package for Razor. There are probably RPMs out there also. You could install things by downloading, untar'ing, and Make'ing. But Why? (smile)
Do this as root: "apt-get install razor"

After saying yes to downloading the dependencies and installing you have to some other steps. These are much like the RazorSiteWide steps, but specialized for Amavis.

  • Configure Razor

Do these things as root and substitute the right directory and user names.

  • You will substitute {amavis-home} for the diretory specified in your /etc/amavis/amavisd.conf file. Here's the variable: $MYHOME = '/var/lib/amavis'
  • You will substitute {user} and {group} for the user and group specificed in your /etc/amavis/amavisd.conf file.
    The variables are: $daemon_user = 'amavis'; $daemon_group = 'amavis';
  • "razor-client"
  • "razor-admin -home={amavis-home}/.razor -create"
  • "razor-admin -home={amavis-home}/.razor -discover"
  • "razor-admin -home=/var/lib/amavis/.razor -register -user" # Note I have filled in the directory here as an example. Substitute yours.
  • "cd /var/lib/amavis"
  • "chown {user}:{group} .razor"
  • "chown amavis:amavis .razor/*" # Note I have filled in the user and group here as an example. Substitute yours.


  • IF Amavisd-new daemon runs as the user/group "amavis" and /etc/passwd has "/var/lib/amavis" as it's home directory (which you should do when using adduser)
    THEN the environment variable HOME will equal "/var/lib/amavis" when Amavisd launches SpamAssassin and also when SpamAssassin then launches Razor.
  • SO, since SpamAssassin is looking for its configuration/home in /var/lib/amavis/.spamassasin and Razor is looking for its home in /var/lib/amavis/.razor, everything thing is wonderful.
  • To check things out do a "razor-check -d" (for debug) and look how and what it discovers.
  • Edit your "/etc/mail/spamassassin/"
  • Change the "use_razor2 0" line to "use_razor2 1"
  • Restart Things
  • No labels