Skip to content


How to install ClamAV

If you Want to install ClamAV on your Red Hat Enterprise Linux, CentOS, or Fedora Core box to scan your server files & folders as well as your all mails,please use the following steps to install the Open sources Anti-Virus “Clam-AV”.

In Clam AV :-

Clamd is the scanning daemon, clamav-milter is the milter, and freshclam is the process that updates the virus definitions on regular basis.

1.Install gmp, gmp-devel, sendmail, sendmail-cf, sendmail-devel, zlib, zlib-devel, bzip2, bzip2-devel.

2.Get the sendmail source from sendmail.org. Extract it, go into the libmilter subdirectory. Run “make” and “make install”. That will install libmilter into /usr, where sendmail can find it. No need to build the whole sendmail.

3. Download the latest stable ClamAV distribution from http://www.clamav.net or from sourgeforge http://sourceforge.net/projects/clamav/files/

4. Next you will need to create a user & group for clamav to use:

# useradd clamav

Some OS’s require you to add the group as well:

# groupadd clamav

#useradd -g clamav -s /bin/false -c “Clam AntiVirus” clamav

5. Extract the ClamAv tar ball, build it, install it (three lines, two are make):

# ./configure –prefix=/usr/local/clamav –disable-zlib-vcheck –enable-milter

# make

# make install

6. Configure /usr/local/clamav/etc/clamd.conf. I changed the following:

# Example (default is uncommented you just add the # or comment that line )

And uncomment the following lines :-

LogTime: yes

LogSyslog yes

LogFacility LOG_MAIL

PidFile /var/run/clamav/clamd.pid

TemporaryDirectory /tmp

LocalSocket /var/run/clamav/clamd.socket or LocalSocket /tmp/clamd

FixStaleSocket yes

User clamav

7. Configure /usr/local/clamav/etc/freshclam.conf. I changed the following:

# Example (default is uncommented you just add the # or comment that line )

And uncomment the following lines :-

LogSyslog yes

LogFacility LOG_MAIL

PidFile /var/run/clamav/freshclam.pid

DatabaseMirror db.us.clamav.net

NotifyClamd /usr/local/clamav/etc/clamd.conf

8. # mkdir /var/run/clamav

9. # chown clamav.clamav /var/run/clamav/

10. # chmod 700 /var/run/clamav

11. Create an empty log file for clamav updates:

# touch /var/log/clam-update.log

# chown clamav:clamav /var/log/clam-update.log

12. Start the base services to make sure they work. You may want to “tail -f /var/log/maillog” while you’re doing this:

# /usr/local/clamav/sbin/clamd

# /usr/local/clamav/bin/freshclam -d

13. Configure the milter. Add the following to /etc/mail/sendmail.mc right before the MAILER(smtp)dnl line. It’s two lines, the second beginning with “define”:

INPUT_MAIL_FILTER(`clamav’, `S=local:/var/run/clamav/clmilter.sock, F=, T=S:4m;R:4m;C:30s;E:10m’)dnl

define(`confINPUT_MAIL_FILTERS’, `clamav’)

14. Make the new sendmail.cf by issuing a “make -C /etc/mail” command.

15. Start the milter process to test it:

/usr/local/clamav/sbin/clamav-milter -lo /var/run/clamav/clmilter.sock

16. Restart sendmail to make it pick up the configuration changes (service sendmail restart).

17. Then send a test mail.

18. Please add clamd service in your init.d directory to run this server at boot time of your machine.

Enjoy Linux…!!!! :)

Posted in Linux tutorials.

Tagged with , , , , , .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.