Install ClamAV Antivirus on CentOS /RHEL

What is ClamAV ?

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.

Before we begin installation of ClamAV, we need to install and enable EPEL (Extra Packages for Enterprise Linux) repository.

Steps to Install ClamAV Antivirus on CentOS

You can directly download the latest Source form the official site and compile and install it.

Step 1. Install EPEL Repository.

CentOS / RHEL 64bit

rpm -Uvh

CentOS / RHEL 32bit

rpm -Uvh

Step 2. Install required ClamAV packages.

yum -y install clamav clamd

After completion of installation, Start the clamd service and set it to auto-start.

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

Step 3. Update ClamAV’s signatures


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

A. 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.

chmod +x /etc/cron.daily/clamav_scan

View more posts in this category !!!

Install clamav antivirus in Ubuntu.


Linuxtweaks Blog helping Server Admin to Manage their servers, Desktop users for making more friendly with linux. Tutorials , guides and tips for linux server maintenance. Here you can learn how to tweak linux servers with code and how to manage it properly.

You may also like...

Leave a Reply

Your email address will not be published.