The following is an overview of the tools, libraries, and steps needed to build ClamAV.
Required tools:
gcc or clanggmake on UNIX systems)Recommended tools:
check unit testing frameworkRequired libraries (including development sources (i.e. ...-dev or ...-devel)):
Recommended libraries (including development sources (i.e. ...-dev or ...-devel)):
Optional libraries (including development sources (i.e. ...-dev or ...-devel)):
ClamAV may execute Bytecode signatures using:
ClamAV's built-in version of LLVM 2.8
*The performance difference between using LLVM and using the interpeter is negligible. If you prefer to use LLVM / JIT for bytecode signature execution, be advised that we presently only support up to LLVM version 3.6.
The following are thus optional, but required to use LLVM in place of the bytecode interpeter:
The following are optional, but needed for the LLVM JIT unit tests:
To install ClamAV locally on an unprivileged shell account you need not create any additional users or groups. Assuming your home directory is /home/gary you should build it as follows:
./configure --prefix=/home/gary/clamav --disable-clamav
make; make installThe --disable-clamav switch disables the check for existence of the clamav user and group but clamscan would still require an unprivileged account to work in a superuser mode.
If installing to the system, it is recommended to set up at least one special user account to run freshclam and clamd. You may choose to set up two separate accounts, one for each. You only need to create these accounts the first time you install ClamAV.
These are instructions specific to some popular operating systems:
If your operating system isn't specified above, and your OS does not have the groupadd and useradd utilities, consult a system manual. Don’t forget to lock access to the account!
Once you have created the clamav user and group, please extract the archive:
tar xzf clamav-<ver>.tar.gz
cd clamav-<ver>Assuming you want to install the configuration files in /etc, configure and build the software as follows:
./configure --sysconfdir=/etc
make
su -c "make install"In the last step, the software is installed into the /usr/local directory and the config files into /etc. WARNING: Never enable the SUID or SGID bits for Clam AntiVirus binaries.
First, create a database directory. This would be located under the install path share/clamav. For example:
/usr/local/share/clamav~/clamav/share/clamavYou will need to create freshclam.conf and clamd.conf files in the config directory. In the above example, we chose /etc, so run the following.
sudo cp /etc/freshclam.conf.sample /etc/freshclam.conf
sudo cp /etc/clamd.conf.sample /etc/clamd.confAt a minimum, you will need to edit each file and remove or comment-out the Example line. In addition, for clamd.conf you will need to enable either LocalSocket or TCPSocket.
For additional recommendations, please read:
To test your local installation execute:
~/clamav/bin/freshclam
~/clamav/bin/clamscan ~To test your system installation execute:
sudo freshclam
sudo clamscan ~The libmilter package and its development files are required. To enable clamav-milter, configure ClamAV with
./configure --enable-milterTo configure ClamAV to use a system-installed LLVM library:
./configure --with-system-llvm=/myllvm/bin/llvm-config
make
sudo make installThe argument to --with-system-llvm indicates the path name of the LLVM configuration utility (llvm-config). Alternatively, you may use --enable-llvm and ./configure will search for LLVM in /usr/local/ and then /usr.
Recommended versions of LLVM are 3.2 - 3.6. Some installations have reported problems using earlier LLVM versions. Versions of LLVM beyond 3.6 are not currently supported in ClamAV.
ClamAV includes unit tests that allow you to test that the compiled binaries work correctly on your platform.
The first step is to use your OS’s package manager to install the check package. If your OS doesn’t have that package, you can download it from http://check.sourceforge.net/, build it and install it.
To help clamav’s configure script locate check, it is recommended that you install pkg-config, preferably using your OS’s package manager, or from http://pkg-config.freedesktop.org.
The recommended way to run unit-tests is the following, which ensures you will get an error if unit tests cannot be built:
./configure --enable-check
make
make checkWhen make check is finished, you should get a message similar to this:
==================
All 8 tests passed
==================If a unit test fails, you get a message similar to the following. Note that in older versions of make check may report failures due to the absence of optional packages. Please make sure you have the latest versions of the components noted in section /refsec:components. See the next section on how to report a bug when a unit test fails.
========================================
1 of 8 tests failed
Please report to https://bugzilla.clamav.net/
========================================If unit tests are disabled (and you didn’t use -–enable-check), you will get this message:
*** Unit tests disabled in this build
*** Use ./configure --enable-check to enable them
SKIP: check_clamav
PASS: check_clamd.sh
PASS: check_freshclam.sh
PASS: check_sigtool.sh
PASS: check_clamscan.sh
======================
All 4 tests passed
(1 tests were not run)
======================Running ./configure --enable-check should tell you why.
If make check reports failed tests, we encourage you to report a bug on bugzilla.
When writing a bug report regarding failed unit tests, please provide the following:
make checkuname -mrspconfig.logunit_tests/ directory:test.logclamscan.logclamdscan.log
/tmp/clamd-test.log if it existspkg-config check --cflags --libsOptionally if valgrind is available on your platform, the output of the following:
make check
CK_FORK=no ./libtool --mode=execute valgrind unit_tests/check_clamavBefore you can run clamd, clamdscan, or clamscan, you must have ClamAV Virus Database (.cvd) file(s) installed in the appropriate location on your system. The default location for these database files are /usr/local/share/clamav.
Here is a listing of currently available ClamAV Virus Database Files:
These files should be downloaded using the freshclam utility on a periodic basis. While using HTTPS to directly download the CVDs is possible, using freshclam is the preferred method of keeping the ClamAV virus database files up to date. freshclam can download database difference files (.cdiff) to get the latest signature definitions without downloading whole CVD files. This saves a considerable amount of bandwidth.
For more information on how to configure freshclam to do automatic/scheduled updates, see the freshclam configuration section of our Configuration guide.
Please see the freshclam usage section for additional details on freshclam).
As an alternative to building and installing from source, most Linux package managers provide pre-compiled ClamAV packages.
For more information about installing ClamAV via a Package Manager, please visit
the "other versions" section on the ClamAV.net Downloads page.