ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats. It is the de facto standard for mail gateway scanning. It provides a high performance mutli-threaded scanning daemon, command line utilities for on demand file scanning, and an intelligent tool for automatic signature updates. The core ClamAV library provides numerous file format detection mechanisms, file unpacking support, archive support, and multiple signature languages for detecting threats.
This article will guide you through the installation of ClamAV on CentOS. Once installed, we will also configure a daily scan on our CentOS 6.0/6.1/6.2/6.3/6.4/6.5 server.
How to install ClamAV on CentOS 6.0/6.1/6.2/6.3/6.4/6.5
Before we can do proceed, you must ensure that you have the EPEL yum repository enabled. Install ClamAV:
# yum install clamav clamd
Start the clamd service on system boot:
# chkconfig clamd on # service clamd start
Note: ClamAV will update automatically, as part of /etc/cron.daily/freshclam.
Configure ClamAV to daily scann
In this example, we will configure a cronjob to scan the /home/ directory every day:
# vi /etc/cron.daily/clamscan_daily
Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan (a am scann /home directory):
#!/bin/bash SCAN_DIR="/home" LOG_FILE="/var/log/clamscan_daily.log" /usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE
Give our cron script executable permissions:
# chmod +x /etc/cron.daily/clamscan_daily
You can even run the above script to ensure that it works correctly.