Install ClamAV on CentOS 6
Step 1. First add yum repository on your system.
The EPEL repo is enabled by simply installing an RPM. Please use the command below to install the EPEL repository on your CentOS server.
#CentOS 6 – 32-bitrpm -Uvh http://mirror.overthewire.com.au/pub/epel/6/i386/epel-release-6-8.noarch.rpm #CentOS 6 – 64-bitrpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm |
Step 2. Install required ClamAV packages.
1 | yum install clamav clamd |
Step 3. Start the clamd service on system boot.
12 | chkconfig clamd onservice clamd start |
Update ClamAV’s signatures:
1 | freshclam |
In this example, I will configure a cronjob to scan the /home/ directory every day:
Step 4. Configuring daily scan.
1 | nano /etc/cron.daily/clamav_scan |
Add following piece of code into clamav_scan file.
#!/bin/bashSCAN_DIR=”/home”LOG_FILE=”/var/log/clamav/manual_clamscan.log”/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE |
Give our cron script executable permissions:
1 | chmod +x /etc/cron.daily/clamav_scan |
Congratulation’s! You have successfully installed ClamAV.