Installing ClamAV on Windows Server 2012

Anti Virus Clamav Server 2012 Windows

This documents how I got ClamAV (clamd) working on Windows Server 2012

I downloaded the 64 bit package <clamav-0.99-x64.msi> from sourceforge

UPDATE: 01/2020 – The download location has moved to:

https://www.clamav.net/downloads#otherversions

I then created folders, as I wanted everything in the root of c:\ I have:

c:\ClamAV-Conf\
c:\ClamAV-x64
|-\db
|-\log

Created config files:
clamd.conf

TCPAddr 192.168.1.251
TCPSocket 3310
MaxThreads 2
LogTime true
LogFile c:\ClamAV-x64\log\clamd.log
DatabaseDirectory C:\ClamAV-x64\db

freshclam.conf

# URL of server where database updates are to be downloaded from
# If this option is given multiple times, each will be tried in
# the order given until an update is successfully downloaded
#MAKE SYU
DatabaseDirectory "c:\ClamAV-x64\db\"
DatabaseMirror database.clamav.net
# Number of times to try each mirror before moving to the next one
MaxAttempts 3
#LogFile c:/ClamAV-x64/log/freshclam.log
NotifyClamd c:\ClamAV-Conf\clamd.conf
LogFileMaxSize 20480000
LogTime true
UpdateLogFile c:\ClamAV-x64\log\freshclam.log

Scheduled scan command line:

c:\ClamAV-x64\clamscan.exe -d c:\ClamAV-x64\db\ -l c:\ClamAV-x64\log\scan.log --recursive --exclude="[^\]*\.dbx$" --exclude="[^\]*\.tbb$" --exclude="[^\]*\.pst$" --exclude="[^\]*\.dat$" --exclude="[^\]*\.log$" --exclude="[^\]*\.chm$" -i E:\

Downloaded database files:

C:\ClamAV-x64\freshclam.exe --config-file c:\ClamAV-Conf\freshclam.conf

The above is also run as a daily scheduled task.

Running ClamAV as a service

I downloaded runassvc.zip from http://www.pirmasoft.de/downloads/runassvc.zip
I then used this to install the clamav service, by running it in interactive mode.
You will be prompted for: (options I used are in code tags)

Service Name:

Clamd Antivirus

Description:

Clam Anti virus http://www.clamav.net

Path to executeable:

C:\ClamAV-x64\clamd.exe

Parameters:

-c c:\ClamAV-Conf\clamd.conf

Working Directory:

C:\ClamAV-x64

One you have provided all the detail required, click ok and the new service will be created.

Note: Some versions of clamd.exe have an option to install as a service by running

clamd.exe --install

The version I used didn’t have this option.

The only options I had were:

PS C:\ClamAV-x64> .\clamd.exe -h

Clam AntiVirus Daemon 0.99
By The ClamAV Team: http://www.clamav.net/about.html#credits
(C) 2007-2015 Cisco Systems, Inc.

--help -h Show this help.
--version -V Show version number.
--debug Enable debug mode.
--config-file=FILE -c FILE Read configuration from FILE.