Install antivirus ClamAV on Linux machine

samba

Registered
Oct 12, 2006
3
0
151
Hello,

How can I install antivirus ClamAV on Linux machine. Please provide me the exact steps to install it on server. i have my own dedicated linux server.

It’s urgent. :eek:

Thanks,

Samba
 

mrcbrown

Well-Known Member
Jun 5, 2003
99
1
168
samba said:
Hello,

How can I install antivirus ClamAV on Linux machine. Please provide me the exact steps to install it on server. i have my own dedicated linux server.

It’s urgent. :eek:

Thanks,

Samba
Most standard distros have a clam RPM/DEB nowdays, but if your doing it for cPanel, check the add-on's in WHM, it has a option to install it.
 

sssathish

Member
Jul 19, 2006
22
0
151
Madurai, Tamil Nadu, India
How to Get it

Now here is how NOT to do it! Hop to INRIA in France at www.rpmfind.net and get the following RPM files for Mandrake i586:

clamav-0.61-0.20030829.1mdk.i586.rpm
libclamav1-0.61-0.20030829.1mdk.i586.rpm
clamav-db-0.61-0.20030829.1mdk.i586.rpm
libgmp3-4.1.2-4mdk.i586.rpm

A quick check revealed that libgmp is already installed (rpm -q libgmp); one less for me to worry about. Lib files should be installed before other files, but when I try to install clamav-db, it says that it requires clamav and when I try to install clamav, it says it requires clamav-db, blech...

# rpm -i libclam[tab]
# rpm -i --nodeps clamav-db[tab]
# rpm -i clamav[tab]

The --nodeps option fixes the circular dependency and off we go.

It seemed OK up to this point, but when I tried to run the clamd daemon, it was nowhere to be found, so what exactly was in those schtoopidttt RPMS???

...and here is the better way to do it: Get the source tarball from http://clamav.sourceforge.net and compile it:

# tar -zxvf clamav.0.7[tab]
# cd clamav.0.7[tab]
# ./configure --sysconfdir=/etc
configure: WARNING: ****** GNU MP 2 or newer NOT FOUND - digital signature support will be disabled !

Bah, humbug! - this is getting annoying. Off to find GNU MP2 or newer at http://www.swox.com/gmp/ and compile it:

# tar -zxvf gmp[tar]
# cd gmp[tab]
# ./configure
# make
# make install

Well, hot damn, that was a looong wait. Let's get back to Clam AV and see how it goes this time around:

# cd ../clamav0.7[tab]
# ./configure --sysconfdir=/etc
# make
# make install
# clamd
ERROR: Please edit the example config file /etc/clamav.conf.
ERROR: Can't open/parse the config file /etc/clamav.conf

Cool, now we know clamd exists and where the configuration file should go. We shall Never surrender!
------------------------------------------------------

Configuration

We need a user and group clamav. This may already exist. Do the following, if it already exists, then nothing much will happen:

# groupadd clamav
# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav

Edit file /etc/clamav.conf. Comment out Example and increase the number of threads to 10 or more. Try to scan the source directory recursively:

# cd ..
# clamscan -r -l scan.txt clamav-0.75.1

It should find the virus examples in the source distribution - worked for me. If it doesn't, then you are SOL and need to try another version, an older one maybe.
----------------------------------------------------------------

Updater

A virus tool goes stale faster than a hotdog bun in Arizona. We need to automate the database update, else it won't be effective for more than a few days:

# touch /var/log/clam-update.log
# chmod 600 /var/log/clam-update.log
# chown clamav /var/log/clam-update.log
# freshclam -d -c 2 -l /var/log/clam-update.log

Also add that last line to the bottom of /etc/rc.d/rc.local to start the daemon after a reboot.

Now we have ClamAV installed and it should stay up to date all by itself.