ClamAv is an open source antivirus engine for detecting trojans, viruses, malware and other malicious threats.Here i will explain about its configuration in centos.
First create#vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
priority=10
gpgcheck=0
Create the epel repository based on the centos version you are using.Here Iam configuring for centos6.8.
Save and Close the file
#yum clean all
#yum update
#yum repolist
Install clamav-db rpm package:
#yum install clamav clamd
Start the clamd service and set it to auto-start
# /etc/init.d/clamd start
# chkconfig clamd on (to make service run after reboot)
Update the virus definitions database using command:
# /usr/bin/freshclam
Note: ClamAV will update automatically, as part
of /etc/cron.daily/freshclam.
Set the cron job on a daily / hour / weekly to perform scan
. In below example , we are going to create a cronjob on daily to scan
the folder /home/
# vi /etc/cron.daily/dailyscan
#!/bin/bash
SCAN_DIR="/home"
LOG_FILE="/var/log/clamav/dailyscan.log"
/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE
Set the executable permission
# chmod +x /etc/cron.daily/dailyscan