Steps to Install ClamAV (Virus Scanner) on Directadmin

Posted on May 9th, 2021

ClamAV is a free software, cross-platform and open-source antivirus software toolkit able to detect many types of malicious software, including viruses. It includes a number of utilities: a command-line scanner, automatic database updater and a scalable multi-threaded daemon, running on an anti-virus engine from a shared library.

Here we’re explaining steps to install ClamAV in the Directadmin (VPS/Dedicated):

1. Login as root (ssh root@ip_address) to server via Putty or Xshell

2. Change the current working directory to ‘custombuild’

 # cd /usr/local/directadmin/custombuild

3. We need to compile ClamAV now. This process will take bit time.

./build update
./build set clamav yes
./build clamav

4. Once the installation is completed, run following commands to update the ClamAV virus database manually and to check whether the configuration is successfully set

# freshclam

5. We can now start the ‘clamd’ service

# service clamd start

That’s it!! Done. You will be able to scan the whole server or specific directory using below one’s:

# clamscan -r -i / (full scan)
# clamscan -r -i /home/admin/domains/ (to specific directory)

Kindly note that ClamAV (or any virus scanner) is a memory hog service. You need to make sure to have enough swap memory in your server, otherwise you will likely to see ‘Killed’ output while scanning. You can increase the swap file via:

swap file

# swapoff -a
# dd if=/dev/zero of=/swapfile count=4096 bs=1MiB
# chmod 600 /swapfile
# mkswap /swapfile
# swapon /swapfile

You can confirm by running ‘free -m’. Sample output:


Feel free to contact our Live Chat support from Our support team will be able to assist you with any service you have ordered through us.

One Response to “Steps to Install ClamAV (Virus Scanner) on Directadmin”

  1. Lescarret says:

    Je viens vers vous car je veux utiliser ClamAV pour scanner des clé usb des que le les branches pour detecter des virus.
    J’ai crée une règle pour automatiser l’ajout de la clé dans /etc/udev/rules.d qui fait
    ACTION==”add”,KERNEL==”sd[b-z]”,RUN+=”/usr/local/bin/” (Cette ligne sert a exécuter le script des l’insertion de la clé USB)
    Apres dans /usr/local/bin/ j’ai mis
    #! /bin/bash

    clamscan -i -r /media/

    J’ai mis les droits d’exécution du script via chmod +x
    J’ai plus ma clé mais aucune donnée ne ressort, par contre quand je lance la commande clamscan -i -r /media/ il me ressort bien mon analyse de la clé
    Auriez-vous une idée pour m’aider ?


Leave a Reply