Install ClamAV on CentOS

Install ClamAV on CentOS

Install ClamAV on CentOS

From time to time you need AV on Linux Servers, but if you have Samba Shares, a GUI, or share files, it’s a good idea

login as root

rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm installing the RPMforge repo

Download/Install the Repo

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Same screenshot: rpm -Uhv installing the rpmforge-release package

done!

now if we do a “yum search clam”

there’s a few things we may need, depending on the situation

yum search clam listing clamav, clamd, clamav-db and related packages

here’s what we’re going with, just the basic

yum install clamd.x86_64 clamav.x86_64

great, installed! Now we need to do some housekeeping

freshclam command at the root prompt

set the service to start on reboot, and start it

chkconfig clamd on and service clamd start warning the virus database is older than 7 days

uh oh…. looks like our virus definitions are out of date, to bring them current do the following:

Same screenshot: freshclam to update the ClamAV virus definitions

this may take a little bit, and there may be a bit on the screen

freshclam warning: ClamAV installation is OUTDATED, local version 0.97.7

you should see some sort of progress indicator though

freshclam progress: Downloading daily.cvd 35%

once all done:

daily.cvd and bytecode.cvd updated, Clamd successfully notified about the update

success, HOWEVER there is a few things we need to do yet:

1) Update virus definitions on an hourly Basis

2) Run a Scan on a Weekly Basis

mkdir /var/log/freshclam, touch freshclam.sh and chmod +x freshclam.sh

here’s a basic backup script for the AV Definitions update

freshclam.sh script: freshclam > /var/log/freshclam/LastUpdate.txt

edit your cron jobs/crontab

crontab -e to edit the root crontab

add the following to fstab

crontab entry @hourly /root/freshclam.sh to update ClamAV definitions

as an example, here’s how we do a manual scan:

clamscan /root scan summary: 13 files scanned, 0 infected

however, for a script, we need to modify it a bit

touch clamscan.sh, chmod +x clamscan.sh and mkdir /var/log/clamscan

here’s a look at a basic script:

clamscan.sh script: clamscan -vr --remove /home > /var/log/clamscan/LastScan.txt

basically clamscan with Verbose Logging, Recursive into sub-directories, and –remove infections found in /home (or whatever directory you choose) and then output to a log

now ad to Cron as a scheduled job

crontab entry @weekly /root/clamscan.sh to scan /home every week

That’s it!

to get a Hosted Linux Server visit www.zwiegnet.com/go to get started

Related guides: Configure Fail2Ban on CentOS | Configure Samba CentOS 6

Leave a Reply

Your email address will not be published. Required fields are marked *