How to install ClamAV on CentOS

This document will guide you through the installation of ClamAV on CentOS.

ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux.

Install ClamAV

1. Install EPEL repo

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

yum install epel-release -y

2. Install required ClamAV packages

yum install clamav clamd

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

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

4. Update ClamAV’s signatures


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:

1. Create cron file:

vim /etc/cron.daily/manual_clamscan

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

/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE

Give our cron script executable permissions:

chmod +x /etc/cron.daily/manual_clamscan

You can even run the above script to ensure that it works correctly.

Was this answer helpful?

 Print this Article

Also Read

How do I block an IP address in my Linux Server?

If you want to block an IP to access your linux server, you will need to login to the shell as...

Do you provide DDoS protection? How does it work?

We provide inbound DDoS filtering options for all our services where stated.DDoS Protection is...

What is a DDoS attack?

DDoS attacks are an attempt by a malicious party to overload systems and networks with malicious...

How to Harden PHP in WHM/cPanel Servers

PHP exploits are responsible for the vast majority of compromised servers. OverviewThis document...

Installing DOS Deflate to mitigate small SYN attacks

(D)DoS Deflate is a lightweight bash shell script designed to assist in the process of blocking a...