Install ClamAV antivirus

Install ClamAV antivirus software
Install EPEL repo:

For CentOS 6 32-bit execute command:
rpm -Uvh http://mirror.overthewire.com.au/pub/epel/6/i386/epel-release-6-8.noarch.rpm

For CentOS 6 64-bit execute command:
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Install required packages:

yum install clamav clamd

Start the clamd service and set it to auto-start

/etc/init.d/clamd on
chkconfig clamd on
/etc/init.d/clamd start

Update ClamAV's signatures:

/usr/bin/freshclam

Note: ClamAV will update automatically, as part of /etc/cron.daily/freshclam.


Configure daily scan

In this example, we will configure a cronjob to scan the /var/www directory every day. Create cron file:

nano /etc/cron.daily/man_clamscan

Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan:

#!/bin/bash
SCAN_DIR="/var/www"
LOG_FILE="/var/log/clamav/man_clamscan.log"
/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE

Give our cron script executable permissions:

chmod +x /etc/cron.daily/man_clamscan

That's it. 

Was this answer helpful?

 Print this Article

Also Read

Troubleshoot slow internet connection

This article describes some of the most common causes for slow Internet connection. Follow these...

Working with a compromised VPS

An exploited or hacked VPS is one that is no longer fully under your control. Someone else is now...

Secure VPS Tips

Here is a simple, straightforward guide to improve VPS security. Change the SSH port One of the...

Secure mail server checklist

Setup of email server in Linux is simple, but your job does not end there. Customer had...

Make cPanel/WHM VPS more secure

Use secure passwords Insecure passwords are the most common security vulnerability for most...