This article explains how to install and configure periodic scans with ClamAV on CentOS7 or Redhat (RHEL) 7 servers. Much of this came from “https://ismailyenigul.wordpress.com/2015/01/05/install-clamav-on-centos-7/”.
I’ve updated this article with a work-around for the (seemingly common) cron issue. Clamscan doesn’t seem to run from “/etc/cron.d/whatever” but does from “crontab -e”.
Install the required packages. Note that you need the EPEL repo’s available first. Do that here “https://fedoraproject.org/wiki/EPEL”.
yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd
Hash out the “Example” commands in “/etc/clamd.d/scan.conf” and “/etc/freshclam.conf”.
Update the AV. This wont work unless you’ve done the step above:
Have the AV scan run daily 9at 3:am) and email the results to the sysadmin:
Add the following entry:
0 3 * * * /bin/freshclam ; /bin/clamscan / --recursive=yes -i > /tmp/clamav.log ; mail -s clamav_log_`hostname` firstname.lastname@example.org < /tmp/clamav.log
Enable and start the AV:
systemctl enable clamd@scan systemctl start clamd@scan
Now you’re done.