A step by step guide on how to install FuzzyOCR on FreeBSD
This guide will show you how to Install FuzzyOcr to catch image spam. “Ocr stands for Optical Character Recognition”
Important FuzzyOcr now requires SpamAssassin 3.2.x or later.
Installing FuzzyOcr is quite easy. A few people seem to have trouble getting this to work, I have a feeling it’s because they are installing FuzzyOcr from the wrong port. FuzzyOcr is present two places in FreeBSD ports collection. And my guess is that these people are installing the wrong version.
Note: FuzzyOcr can be found here /usr/ports/mail/p5-FuzzyOcr and here /usr/ports/mail/p5-FuzzyOcr-devel
Right in order for FuzzyOcr to work probably we need “Tesseract” installed as well Tesseract is the optical character recognition engine that FuzzyOcr uses. Tesseract does not get installed automatically as a dependency so we’ll have to do this ourselves. We will installed Tesseract first before installing FuzzyOcr.
cd /usr/ports/graphics/tesseract
make install clean
When the option screen appears [Screenshot] just accept the defaults and press “OK” The last option screen for Tesseract is for png [Screenshot] again accept the defaults and press “OK”. This will take some time to complete.
Next up is FuzzyOcr.
cd /usr/ports/mail/p5-FuzzyOcr-devel
make install clean
Depending on what you’ve already installed you may not receive all questions. Don’t worry something probably installed that component for you. Below are the default questions you normally get and the action you need to take.
netpbm | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
jasper | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
gifsicle | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
libcheck | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
python | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
libxlt | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
tk | [Screenshot] | Just accept the default hit “Tab” and then “OK” | ||
tcl | [Screenshot] | Just accept the default hit “Tab” and then “OK” |
Now copy the defaults configuration file to the right place. Theres no need to edit it as it works right out of the box.
cp /usr/local/share/examples/FuzzyOcr/FuzzyOcr.* /usr/local/etc/mail/spamassassin
All we need now is to enable the FuzzyOcr module in Spamassassin.
vi /usr/local/etc/mail/spamassassin/init.pre
Add the following lines to init.pre somewhere at the bottom.
# FuzzyOcr
loadplugin Mail::SpamAssassin::Plugin::FuzzyOcr
And that’s it all that’s left is to restart SpamAssassin
svc -t /service/spamd/
svstat /service/spamd/ /service/spamd/log/
If you like you can test if this is working with some sample mails containing image spam.
cd ~
fetch http://www.xfiles.dk/content/qmail/fuzzyocr/fuzzytest.tar.gz
tar -zxvf fuzzytest.tar.gz
rm fuzzytest.tar.gz
cd fuzzytest
spamassassin -t < ocr-gif.eml
spamassassin -t < ocr-jpg.eml
spamassassin -t < ocr-png.eml
补充:cd /usr/ports/devel/p5-Tie-Cache
make install clean
References:http://www.xfiles.dk/guide-on-how-to-install-fuzzyocr-on-freebsd/