How to Install ClamAV and Configure Daily Scanning on CentOS


How to Install ClamAV and Configure Daily Scanning on CentOS

This article will guide you through the installation of ClamAV on CentOS. Once installed, we will also configure a daily scan on our CentOS server.

ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. In this article, we will only be configuring ClamAV to run scheduled/on-demand scans; not resident scans.

Install ClamAV

1. Install EPEL repo

Before we can do proceed, you must ensure that you have the EPEL yum repository enabled.

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

2. Install required ClamAV packages

# yum install clamav clamd

3. Start the clamd service and set it to auto-start

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

4. 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 /home/ directory every day:

Create cron file:

#  vim /etc/cron.daily/manual_clamscan

Add the following to the file above. You can change SCAN_DIR to the directory that you want to scan:

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

Give executable permissions to the script:

# chmod +x /etc/cron.daily/manual_clamscan

Please comments and Share also suggestions are always welcome.


Keywords: ClamAV, Linux Antivirus, Linux AV, Linux ClamAV, CentOS AV.

Comments

Popular posts from this blog

Observium: Configuring Microsoft Windows 2008 Server SNMP Agent

AWS: Introduction to AWS (Amazon Web Services)

System/Server Health Status using PowerShell