00:00:00
25 Apr

How To Install ClamAV On CentOS 6.X

Oliver Krautscheid Nov 08, 2013
0 1042

As a webmaster it is really good to have a bunch of tools pre-installed on your server. ClamAV is a great antivirus for Linux. In this guide I’ll show you how to install it on CentOS 6.x

Installing The PHP ClamAV Extension (If You Want To Use It Within Scripts!

IMPORTANT: If you want PHP to do the dirty work for you and use CLAMAV within your PHP scripts, then you also need to get PHP extension:

1. Download it here from Sourceforge

2. Enter tar -xzf php-clamav*

3. Enter cd ./php-clamav*

4. Enter phpize

5. Enter ./configure

6. Enter make and make install

This should automatically add the extension to your php.ini – if that did not work for you, add the path to the *.so file to the php.ini – you may have multiple php.ini files!

The Installation

1. To install tools on your server all you need is a good REPO (short for repository) and yum (the popular package installer; the equivalent on Ubuntu is apt-get)

2. Alright, now lets enter yum install clamav clamd

Installing Clamav Via Yum

3.(Optional) – Did Not Work? If you do not have a good REPO in place, you have to install for example the EPEL repo – on a WHM powered server you should already have all of this by default

4. Confirm the download with “y” (without the quotes)

5. Done!

Next Part: Configuration

Tip: After the installation most commands like clamd start, freshclam and clamscan work out of the box – there is little you have to configure manually

1. Enter whereis clamav – you will get something like /usr/share/clamav

2. Enter cd /usr/share/clamav

3. Enter pico README*

4. As explained in the README file, place the config file in /etc/clamd.d/.conf

5.

clamd.logrotate:
  * set the correct value for the logfile
  * place it into /etc/logrotate.d

clamd.sysconfig:
  * set the name of the config-file and the local socket
  * copy it to /etc/sysconfig/clamd.

clamd.init:
  * set the service-name
  * place it into /etc/init.d/ with an unique name and activate it
    (e.g. with /sbin/chkconfig clamd. on)

Starting The ClamAV Service

1. Enter clamd start

2. You can stop it again with clamd stop

Update Your Virus Definitions

1. Enter freshclam

2. Wait until the update is done

Schedule A Scan Using ClamAV

If you want to schedule a scan on your CentOS server, you will only need to know the command clamscan

1. Create a blank file and paste clamscan -i -r $SCAN_DIR >> $LOG_FILE

2. Specify an absolute path for SCAN_DIR and and a path to a LOG_FILE that actually exists

3. Example: clamscan -i -r /home/ >> /root/scripts/clamav.log

Still have questions? Let us know in the comments, we’re here to help

About Us

Webmaster .Net is your all-in-one resource for blogging tips, system administration guides, industry news and a growing community of webmasters.

Can't find something or want to tip us?Contact@webmaster.net

Bulls and Bears
Webmaster Tutorials, Wordpress
0 shares603 views

WordPress SQL Query: Select And Delete Posts Between Two Dates

Oliver Krautscheid - Apr 08, 2017

If you are wondering how to delete posts for a certain date, you will need to know how Wordpress stores…

Advertising and Ad Networks, Copywriting
0 shares758 views

15 Tips For Increasing Facebook Ads CTR – Full Guide [2017 Update]

Cam Connor - Mar 30, 2017

In this article, we'll talk a lot about how you can write quality text ads on Facebook Ads to get…

Webmaster Tutorials
0 shares1424 views

10 Steps To Configure Nginx For WordPress, Drop Varnish And Cut Your CPU Load By 50%

Oliver Krautscheid - Oct 10, 2016

Are you using Varnish on your Wordpress blog? Possibly the Varnish script by Unixy? Great! Get rid off it. Here's…

Follow Us And get latest news

© 2016 Webmaster.Net - Property of Peakstone Media Ltd. - All rights reserved. | Privacy Policy | DMCA | Contact Us | Advertise