How To Install/Compile ClamAV In CentOS 6

by admin on September 8, 2014

Clam AntiVirus (ClamAV) is a free and open-source, cross-platform antivirus software tool-kit able to detect many types of malicious software, including viruses. It’s easy to use and best for Linux based Web & Mail server. In this article, I will show you through the step by step installation of ClamAV on CentOS 6.x from source.

The first, You need to download ClamAV latest version at Login as root and type the following command

# wget -O clamav-0.98.4.tar.gz

The second, extracting clamav-0.98.4.tar.gz package

# tar zxvf clamav-0.98.4.tar.gz
# cd clamav-0.98.4

Installing ClamAV

Type the following command to Compile ClamAV from source

# ./configure --prefix=/usr/local --sysconfdir=/etc --with-xml=/usr/local --with-zlib=/usr
# make
# make install

Configuring ClamAV

Creating user for clamav, enter

useradd -s /sbin/nologin -d /dev/null clamav

Creating database folder of clamav, enter

# mkdir /usr/local/share/clamav
# chown clamav /usr/local/share/clamav
# chmod 700 /usr/local/share/clamav

Type these following commands to create ClamAV configuration files

mv /etc/freshclam.conf.sample /etc/freshclam.conf
mv /etc/clamd.conf.sample /etc/clamd.conf

Open and remove contains

# Comment or remove the line below.

Updating ClamAV

# freshclam

Configuring daily scan

In this example, I will configure a cronjob to scan the /home/ directory every day. Creating a file called name scanav at /opt/, enter

# vi /opt/scanav

Add the following to the file above



# Update CLAMAV

# Scan AV
clamscan -i -r $SCAN_DIR >> $SCAN_LOG

Give our cron script executable permissions, enter

# chmod +x /opt/scanav

Configuring daily scan with crontab, type the following command

# crontab -e

Add the following

01 01 * * * /opt/scanav

Leave a Comment

Previous post:

Next post: