Saturday, 28 July 2018

How to compile and install the latest Clam AV antivirus on Linux



Clam AV is an open source antivirus engine for detecting Trojans, viruses, malware & other malicious threats. It provides a number of utilities including a multi-threaded scanner daemon,
command line scanner and automatic signature updates.

Install prerequisites: 

[root@linuxcnf ~]# yum install gcc openssl zlib libxml2 libxml2-dev libbz2-dev libzip2 libzip-dev


Download the latest clam AV source release:

[root@linuxcnf ~]# mkdir –p /usr/src/clamav
[root@linuxcnf ~]# cd /usr/src/clamav
[root@linuxcnf ~]# wget https://www.clamav.net/downloads/production/clamav-0.100.1.tar.gz

Clam AV Installation:

[root@linuxcnf ~]# tar xf clamav-0.100.1.tar.gz
[root@linuxcnf ~]# cd clamav-0.100.1
[root@linuxcnf ~]# ./configure
[root@linuxcnf ~]# make && make install

Copy configuration files:

[root@linuxcnf ~]# cp ./etc/clamd.conf.sample /usr/local/etc/clamd.conf
[root@linuxcnf ~]# cp ./etc/freshclam.conf.sample /usr/local/etc/freshclam.conf


Comment out the line “Example” from both /usr/local/etc/clamd.conf and /usr/local/etc/freshclam.conf

Create user and group for clamav:

[root@linuxcnf ~]# groupadd clamav
[root@linuxcnf ~]# useradd -g clamav -s /bin/nologin clamav

Create require directories and log file with appropriate permissions:

[root@linuxcnf ~]# mkdir –p /var/lib/clamav
[root@linuxcnf ~]# mkdir –p /var/log/clamav
[root@linuxcnf ~]#
[root@linuxcnf ~]# touch /var/log/clamav/freshclam.log
[root@linuxcnf ~]# touch /var/run/freshclam.pid
[root@linuxcnf ~]#
[root@linuxcnf ~]# chown clamav:clamav /var/log/clamav/freshclam.log
[root@linuxcnf ~]# chown clamav:clamav /var/lib/clamav
[root@linuxcnf ~]# chown clamav:clamav /var/run/freshclam.pid

Now update the database by running freshclam:

[root@linuxcnf ~]# freshclam –v

Installation is done!!!

No comments:

Post a comment