How To Install ClamAV on DirectAdmin

In this article, we want to teach you How To Install ClamAV on DirectAdmin.

Clam AntiVirus (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, an automatic database updater, and a scalable multi-threaded daemon, running on an anti-virus engine from a shared library. One of its main uses is on mail servers as a server-side email virus scanner.

DirectAdmin is web hosting control panel software, similar to cPanel, that lets you administer your website and hosting options using a graphical, web-based interface.

How To Install ClamAV on DirectAdmin

In this guide, you learn to install ClamAV on DirectAdmin.

May this article about How To Set up DirectAdmin on Centos 7 be useful for you.

Now follow the steps below to complete this article.

Installing ClamAV on DirectAdmin

First, you need to log in to your server as a root user via SSH.

Then, you need to switch to your DirectAdmin “cutombuild” directory with the command below:

cd /usr/local/directadmin/custombuild

Here you can compile your ClamAV with the following commands:

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

This will take some time to complete.

When your installation is completed, run the command below to update the ClamAV virus database:


freshclam is the automatic database update tool for Clam AntiVirus.

Now you can start your ClamAV service on your server with the command below:

service clamd start

At this point, you can start to scan your whole server or specific directory with the following commands:

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

Note: 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 see ‘Killed’ output while scanning.

To increase the swap file you can use the commands below:

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

Then, you can use the command below to verify the increasing the swap file:

free -m

After that, you can start to scan your server by using the ClamAV.


At this point, you learn to easily Install ClamAV on DirectAdmin with Linux commands.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!