How to install & use ClamAV on FEDORA

Update
This procedure work for FEDORA 15, 16, 17, 18 and 19

Even if, until now, you don’t really need to install an Antivirus on a home desktop (especially if you use only non-Windows System) you may need to check some USB flash drive or optical disk for virus before exchange files with a Windows “Friend”.

First of all, perform a system update under superuser
[root@nowin]# yum update -y

Then install ClamAV
[root@nowin]# yum install clamav freshclam
[root@nowin]# yum install clamav clamav-update
(Thanks to Helio Zwi for the update)

Edit the configuration file with your favorite editor
[root@nowin]# vi /etc/freshclam.conf
and perform the following change:

      1-add a # in front of “Exemple” (to comment/disable it)

# Comment or remove the line below.
#Example

      2-uncomment (remove the # in front of) the line “DNSDatabaseInfo current.cvd.clamav.net”

# Use DNS to verify virus database version. Freshclam uses DNS TXT records
# to verify database and software versions. With this directive you can change
# the database verification domain.
# WARNING: Do not touch it unless you're configuring freshclam to use your
# own database verification domain.
# Default: current.cvd.clamav.net
DNSDatabaseInfo current.cvd.clamav.net

      3-Localized the virus database source to the nearest one by adding a new line “DatabaseMirror db.XY.clamav.net”, and changing XY by your 2 characters country code, here for Vietnam it will be:

# Uncomment the following line and replace XY with your country
# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list.
# You can use db.XY.ipv6.clamav.net for IPv6 connections.
#DatabaseMirror db.XY.clamav.net
DatabaseMirror db.vn.clamav.net

      4-be sure that the following line is uncomment

DatabaseMirror database.clamav.net

Now you can make your first Virus Database update, if everything is ok you may have something like this:
[root@nowin]# freshclam
ClamAV update process started at Sun Apr 17 09:17:12 2011
main.cvd is up to date (version: 53, sigs: 846214, f-level: 53, builder: sven)
daily.cvd is up to date (version: 13004, sigs: 105394, f-level: 60, builder: guitar)
bytecode.cvd is up to date (version: 143, sigs: 40, f-level: 60, builder: edwin)

You may received an error message if you try to frechclam under your user:
[me@nowin]$ freshclam
ERROR: Can't create temporary directory /var/lib/clamav/clamav-0f9ef994d9a44c7f9b939251c41f3c86
Hint: The database directory must be writable for UID 500 or GID 500

then just run the following command as root to give you the right:
[root@nowin]# chown -R 500:500 /var/lib/clamav
[root@nowin]# chmod -R 755 /var/lib/clamav

Of course if the UID GID are different from 500 , just put your ID in chown command, then freshclam again with your user.

It’s the moment of truth ! to scan a USB Flash drive you may use:
[me@nowin]$ clamscan --infected --bell --scan-archive --max-recursion=10 -r /media -l ~/clamav.log
This just list all infected files found.

To remove the infected files:
[me@nowin]$ clamscan --remove=yes --bell --scan-archive --max-recursion=10 -r /media -l ~/clamav.log

Your target media to scan may be mounted in another point so check in:
ls /media
ls /opt
ls /mnt

Don’t forget the man page for more help.

Be safe…

What next:

    Create a scheduled task to daily update your virus definition (coming soon)
    Create your own virus definition repository for local/internal update (coming soon)

-

About these ads

13 Responses to How to install & use ClamAV on FEDORA

  1. Helio Zwi says:

    Correction: freshclam is provided (as of 4/29/11) by clamav-update.
    In other words, the installation line should be

    # yum install clamav clamav-update

    Everything else works perfectly fine.

  2. Den says:

    Outstanding .Old guy 780 years old. I understood perfectly

    Thankyou,
    Den

  3. Ganesh says:

    Thanks, alot .., can you tell about how we can get clamav gui interface

  4. ren says:

    Thanks! This is great help!

  5. maheshkumar india says:

    really a superb and simple presentation. keep it up

  6. Alejandro says:

    Thanks!!!

  7. azare says:

    Thanks. With the steps above, I got it installed.

  8. Truls Sjurelv says:

    These instructions work great also on Fedora 19, thank you!

  9. Jim says:

    Thanks for the instruction, this works good in Fedora 19.
    By the way, if you run “freshclam” and you encounter those error – you can simply type “sudo freshclam” without changing the permissions.

    • LaurentD says:

      Hi Jim,
      You’re right, however i had this mention in order for be able to launch this command using user permission through a cron job for exemple.
      Laurent

  10. cabra219 says:

    TNX for the explanation! this made me use ClamAV in an easy way.

    because more and more oranizations demand proper updated and anti-virus-ed systems I now run both on Fedora 19, almost 20…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 26 other followers

%d bloggers like this: