How to Install ClamAV Antivirus and Configure Daily Scanning on CentOS

clamav_logoClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux.

Install EPEL repository
For 64-bit
~# rpm -Uvh

For 32-bit
~# rpm -Uvh

Install CLAMAV
~# yum install clamav clamd

Start Daemon
~# /etc/init.d/clamd start

Daily Scan Scheduling
Create a new cron file in /etc/cron.daily/ directory. If you want to run scan weekly, then file location will be /etc/cron.weekly/

~# vim /etc/cron.daily/clamav_scan
Add following piece of code into clamav_scan file.

/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE

Exit vim editor and give this script executable permissions.

Execute Permission::
~# chmod +x /etc/cron.daily/

Update ClamAV’s signatures
~# /usr/bin/freshclam

Done! [OK]

Content credit :o2cinemas