Installing and configuring ClamAV

Instructions for installing and configuring ClamAV antivirus for Linux

On a dedicated server or VPS, keeping your system secure and regularly checking it for malware is essential. One effective tool for this is ClamAV, a free antivirus solution that allows both manual and automatic database updates and file scanning. In this guide, we’ll go through how to install, configure, update, and remove ClamAV on Debian and Ubuntu.


Installing ClamAV

On Debian and Ubuntu, installing the antivirus is straightforward:

sudo apt install clamav clamav-daemon

file

After installation, it’s recommended to set up automatic database updates and regular system scans.


Updating the Antivirus Database

To manually update the virus database, first stop the automatic update service:

sudo systemctl stop clamav-freshclam

Then run the update:

sudo freshclam

file

Once the update is complete, restart the automatic update service:

sudo systemctl start clamav-freshclam

You can also update the databases manually. To do this, download the main.cvd, daily.cvd, and bytecode.cvd files from the official ClamAV website.

file

Place the files in the /var/lib/clamav/ directory:

cp ~/Downloads/*.cvd /var/lib/clamav/

Then set the owner to the clamav user and assign the correct permissions:

chown clamav:clamav /var/lib/clamav/*.cvd
chmod 644 /var/lib/clamav/*.cvd

To reload the databases, restart the ClamAV service:

sudo systemctl restart clamav

You can check the antivirus version with:

clamd --version

Example output:

root@host:~# clamd --version
ClamAV 0.103.5

Graphical Interface: ClamTK

If you prefer a graphical interface, you can install ClamTK, a user-friendly tool for managing ClamAV. It’s available in the official repositories:

sudo apt install clamtk

You can launch ClamTK from your system’s main menu:

file


Automating Scans

To run scans automatically on a schedule, add a script to cron. Edit your cron jobs:

# crontab -e

Then add a line for daily execution, for example:

39 3 1-5 * * /root/clamav.sh

Removing ClamAV

If you need to uninstall ClamAV, run:

sudo apt remove clamav clamav-daemon

If you installed database files manually, remove them as well:

sudo rm -Rf /var/lib/clamav

Help

If you run into issues with setup or have additional questions, you can contact our support team via the ticket system.

Need help?Our engineers will help you free of charge with any question in minutesContact us