
1) Download and untar free sophos9 from Sophos under /root folder
-----------------------------------------------------------------
This is the path where you can register and get the product :
https://www.sophos.com/products/free-tools/sophos-antivirus-for-linux.aspx
Then rtansfer it into Centos /root
[root@SERVER ~]# ls -l
total 4
drwxr-xr-x 2 root root 4096 Oct 26 17:59 sophos-av


2) Remove noexec from /etc/fstab and reboot (this is needed for installation)
-----------------------------------------------------------------------------
[root@SERVER sophos-av]# vi /etc/fstab
#/dev/mapper/vg_00-lv_tmp /tmp                    ext4    nosuid,noexec,noatime 1 2
/dev/mapper/vg_00-lv_tmp /tmp                    ext4    nosuid,noatime 1 2
[root@SERVER sophos-av]# reboot


3) Install from folder and answer N to on-access scanning
---------------------------------------------------------
[root@SERVER ~] cd /root/sophos-av
[root@SERVER sophos-av]# ./install.sh
Do you want to enable on-access scanning? Yes(Y)/No(N) [Y]
> N
Do you wish to install the Free (f) or Supported (s) version of SAV for Linux? [s]
> f
[root@SERVER ~] rm -rf /root/sophos-av


4) Restore noexec from /etc/fstab
---------------------------------
[root@SERVER sophos-av]# vi /etc/fstab
/dev/mapper/vg_00-lv_tmp /tmp                    ext4    nosuid,noexec,noatime 1 2


5) Download and unpack SAVI-Perl-0.30
-------------------------------------
[root@SERVER ~]# cd /opt
[root@SERVER opt]# wget https://cpan.metacpan.org/authors/id/P/PH/PHENSON/SAVI-Perl-0.30.tar.gz
[root@SERVER opt]# tar zxvf SAVI-Perl-0.30.tar.gz
[root@SERVER opt]# rm zxvf SAVI-Perl-0.30.tar.gz
[root@SERVER ~]# cd SAVI-Perl-0.30
[root@SERVER SAVI-Perl-0.30]#


6) Put correct path of 64bit sophos libraries on Makefile.PL
------------------------------------------------------------
[root@SERVER SAVI-Perl-0.30]# cp Makefile.PL Makefile.PL.old
[root@SERVER SAVI-Perl-0.30]# vi Makefile.PL
(MODIFICATION)
    'LIBS'      => ['-L/opt/sophos-av/lib64 -R/opt/local/lib -lsavi'],


7) Modify sav_if to support 64bit compilation
---------------------------------------------
[root@SERVER SAVI-Perl-0.30]# cd sav_if
[root@SERVER sav_if]# cp s_comput.h s_comput.h.old
[root@SERVER sav_if]# vi s_comput.h
(FIRST MODIFICATION)
/*
 * Clear everything to start with, apart from
 * those things that the build environment must
 * define by hand.  These are:
 *   __SOPHOS_BANYAN_VINES__
 *   __SOPHOS_WINNT__
 *   __SOPHOS_WIN95__
 */
#define __SOPHOS_X86_64__                  <---- ADDED LINE
(SECOND MODIFICATION)
/*
 * Hardware platform.
 */

# if defined(__SOPHOS_X86_64__)   <---- ADDED LINE
#  define __SOPHOS_I386__         <---- ADDED LINE
# elif defined(__i386__)          <---- CHANGED LINE (elif INSTEAD if)
#  define __SOPHOS_I386__
# elif (defined(__hppa__) && defined(_PA_RISC1_1))
#  define __SOPHOS_HP_PA__
# elif defined(__sparc__)
#  define __SOPHOS_SPARC__
# elif (defined(_POWER) || defined(__ppc__) || defined(__POWERPC__) || defined(__PPC__))
#  define __SOPHOS_POWERPC__
# elif (defined(TARGET_CPU_68K) || defined(__CFM68K__) || defined(m68k) || defined(_M_M68K))
#  define __SOPHOS_68000__
# elif defined(__alpha__)
#  define __SOPHOS_ALPHA__
# elif defined (__s390__)
#  define __SOPHOS_S390__
# elif defined(__VAX)
#  define __SOPHOS_VAX__
# else
#  error Unsupported GNU C/C++ target hardware platform
# endif


8) Add line with 64 bit library path to ld.so.conf and run ldconfig
[root@SERVER sav_if]# vi /etc/ld.so.conf
(THIS LINE CAN BE ADDED AS FIRST LINE)
/opt/sophos-av/lib64
[root@SERVER sav_if]# ldconfig


9) Compile
----------
[root@SERVER sav_if]# cd /opt/SAVI-Perl-0.30
[root@SERVER SAVI-Perl-0.30]# perl Makefile.PL
 (This answer : Looks good, Writing Makefile for SAVI)
[root@SERVER SAVI-Perl-0.30]# make
[root@SERVER SAVI-Perl-0.30]# make test
 (This answer : Result: PASS)
[root@SERVER SAVI-Perl-0.30]# make install


10) All is done, now add sophossavi to MailScanner and test it
-------------------------------------------------------------
[root@SERVER SAVI-Perl-0.30]# vi /etc/MailScanner/MailScanner.conf
(FIRST MODIFICATION)
##Virus Scanners = clamd
Virus Scanners = clamd sophossavi
(SECOND MODIFICATION)
##Sophos Lib Dir = /opt/sophos-av/lib
Sophos Lib Dir = /opt/sophos-av/lib64
[root@SERVER SAVI-Perl-0.30]# service MailScanner restart
[root@SERVER SAVI-Perl-0.30]# MailScanner --lint
(This answer : 
Virus Scanning: Found 2 viruses
===========================================================================
Virus Scanner test reports:
Clamd said "eicar.com was infected: Eicar-Test-Signature"
SophosSAVI said "eicar.com was infected by EICAR-AV-Test"
)

