# MailScanner Installation Guide - FreeBSD

If you run into problems installing MailScanner, please ask for help on the mailing list. Please ensure you include your

- Operating System and version
- Perl version (Do "perl -v" to find out)
- MailScanner version
- SpamAssassin version
- Installation info: rpm or tar, fresh install or update

## Assumptions and Pre-requisites

For the purposes of this installation guide, it is assumed that you have installed a FreeBSD server (4.x or 5.x), and acquired a current version of the ports tree (have a look at http://www.freebsd.org/ports/index.html).

There are two versions of the MailScanner port:

· /usr/ports/mail/mailscanner is the stable version of MailScanner

· /usr/ports/mail/mailscanner-devel is the latest beta/development version of MailScanner

Make sure you have read and understood the “Using the Ports Collection” chapter of the FreeBSD Handbook.

## Installation

In order to install one of these versions for the first time please change to the corresponding directory and run make install:

    cd /usr/ports/mail/mailscanner

    make install

Note: You cannot install both port versions at the same time. If you want to change from lets say mailscanner to mailscanner-devel you must first deinstall the old version and then install the other:

    cd /usr/ports/mail/mailscanner

    make deinstall

    cd /usr/ports/mail/mailscanner-devel

    make install

The installation procedure will install MailScanner in the FreeBSD directory structure:

· Configuration goes into /usr/local/etc/MailScanner

· Libs (MailScanner perl modules) go into /usr/local/lib/MailScanner

· Executables (virus wrappers, autoupdate scripts etc.) go into /usr/local/libexec/MailScanner

· Documentation go into /usr/local/share/doc/MailScanner

· Reports go into /usr/local/share/MailScanner/reports

· etc.

Moreover the wrappers etc. get patched so that everything should run on FreeBSD without problems. If you find something unusual please do not hesitate to contact the port maintainer at j.koopmann@seceidos.de.

All configuration files, rules, reports etc. are installed as .sample files only. This is to make sure that installing a newer version of the port will not overwrite your current configuration. If you are installing the MailScanner port for the first time you should do a

    make initial-config

in the ports dir. This will copy all .sample files to the correct locations (MailScanner.conf.sample to MailScanner.conf etc.). The installation creates two new startup scripts in /usr/local/etc/rc.d

· mta.sh allows you to start/stop Exim/Sendmail (whatever you like)

· mailscanner.sh allows you to start/stop MailScanner

You might have to adjust those scripts in order to make them work in your environment. Moreover please have a look at http://www.sng.ecs.soton.ac.uk/mailscanner/install/exim.shtml and http://www.sng.ecs.soton.ac.uk/mailscanner/install/postfix.shtml. These pages contain information on how to configure Exim/Postfix in order to work with MailScanner. If you choose to use the mta.sh script you must remember to disable sendmail/exim startup in /etc/rc.conf.

## Upgrading

You can upgrade the port like every other FreeBSD port. First you need to get the latest version of the port (using cvs or preferably updating the entire ports-tree using cvsup). If you are using portupgrade (another FreeBSD port), upgrading MailScanner is as simple as typing

    portupgrade mailscanner

or

    portupgrade mailscanner-devel

The upgrade procedure will automatically download the current version of MailScanner, delete the old version, install the new version and upgrade the MailScanner.conf file. A few things to remember though:

1. The upgrade will not touch your current MailScanner.conf but rather install a MailScanner.conf.versionnumber (e.g. MailScanner.conf.4.25.14) in /usr/local/etc/MailScanner. This file will contain all your settings in addition to new options and default values that Julian might have added in that release. You should therefore save your old config and rename MailScanner.conf.versionnumber to MailScanner.conf.

2. The upgrade will not touch your virus wrappers and autoupdate scripts in /usr/local/libexec/MailScanner but will only overwrite the .sample files in case you made special adjustments to any of those scripts yourselves. If you choose to update the virus wrappers and autoupdate scripts automatically, you should enter
make renew-wrapper
make renew-autoupdate

3. The upgrade will not touch your reports and language.conf but also only install new .sample files. You can update those files automatically by running
make renew-reports

If you choose not to use the portupgrade port (sysutils/portupgrade) you can still upgrade MailScanner by first deinstalling the old version and then install the new version:

    cd /usr/ports/mail/mailscanner (or cd /usr/ports/mail/mailscanner-devel)

    make deinstall

    make install

Deinstallation will only delete the libraries, binaries and .sample files but will not delete your configuration (MailScanner.conf, reports, rules etc.).

## Sophos

If you are using Sophos you will have to install the Sophos anti-virus package as well. In order to Sophos to work under FreeBSD you should consider using the script Sophos.install.freebsd which is located in /usr/local/share/doc/MailScanner. You must run this script from inside the directory in which you have copied and unpacked the Sophos distribution.

## Starting MailScanner

The MailScanner will automatically start the next time you reboot the PC, or else you can start it immediately with the command

    /usr/local/etc/rc.d/mailscanner.sh start

Jan-Peter Koopmann