How to Install and Configure ClamAV Anti Virus on Debian/Ubuntu Server

Screenshot From 2021 01 12 12 17 14

If you’re currently using mail server on vps or cloud server you should be installed anti virus and anti spam as well to protect your mail server from any attack. That’s way ClamAC come to protect your mail server from any spam or junk emails. So, what’s actually ClamAV?

For newbie like you on the web hosting industries, you may only know ClamAV is run on Windows operating system. But, ClamaV is also available on Linux distros as an open source and completely free antivirus engine which everyone can use it. Well, ClamAV can detect any trojans, malwares, virures, and other malicious content.

It can also be using to scan malware or combined it with another paid malware scanner software like ISPprotect for example. ClamAV can also be joined with another malware scanner engine, including Linux Malware Detect. Usually ClamAV is standard antivirus engine for mail server, which always used on cPanel-WHM. Also, ClamAV supports scanning on multiple file formats, archive unpacking, and multiple signature languages.

However, what’s I don’like on ClamAV that is usually using more server resource, including RAM and vCPU. Since, ClamAV is high-performance and powerfull multi-threaded scanner aplication, so I strongly recomend you to install ClamAV on server with minimum 2GB RAM and 4 vCPU.

Well, on this today guide I will teach you on how to deploying ClamAV daemon on virtual private server. Simply take your time for a moment or you must at leats have relax time to perform installation.

* Cloud Server with Debian/Ubuntu Linux
* Server IPv4 Address
* Full Root Access
* gNome Terminal for Linux
* PuTTy SSH client for Windows/Mac

* PLEASE NOTE: On this tutorial I’m using Debian 10 (Buster) running on Oracle Virtual Box

1.) Install ClamAV and ClamAV Daemon

Step one, update your system and then install clamav and clamav-daemon.

$ apt update && sudo apt upgrade

The, run the following command to install both software.

$ apt-get install clamav clamav-daemon -y

After that start clamav-daemon

$ service clamav-daemon start

2.) Update ClamAV Virus Definition

After that we must update ClamAV virus definition in order to gets new viruses signatures from ClamAV server

Stop freshclam first

$ /etc/init.d/clamav-freshclam stop

To update viruses definition, run the following command.

$ freshclam

After that, start freshclam again

$ /etc/init.d/clamav-freshclam start

3.) Let’s Run ClamAV Scanner

Simply run the following command to scan directory and files on your server.

$ clamscan -r /path/to/your_directory/

4.) Restart Clamav

As for restart ClamAV simply run the following commands.

$ systemctl start clamav-daemon
$ systemctl start clamav-freshclam


Installing and configuring ClamAV antivirus on vps or cloud serveris quite easy, you just have relax time to perform this installation procedure. This method can also be apllied on dedicated or colocation servers.