Installing ClamAV on ubuntu
In this guide, I will talk about how to install ClamAV tools in Ubuntu. Additionally, how to use those tools to scan for local files/folders or using a node environment.
On Ubuntu (v16.04.6
)
Setup
The first step is to install the packages clamav
and clamav-daemon
.
sudo apt-get install clamav clamav-daemon
The clamav
installs other dependencies along with it like clamav-freshclam
, clamav-base
etc.
Next, you will need to start the clamav-freshclam
service by running the following command:
sudo service clamav-freshclam restart
sudo service clamav-freshclam status // to verify
This creates a signature file which is required for the next step.
Note: If
clamav-freshclam
is started for the first time, creation of the signature file takes about 1–3 mins.
Once the signature file is created, you can then start the clamav-daemon
service by running the command:
sudo service clamav-daemon start
sudo service clamav-daemon status // to verify
This step creates the clamd socket file (default location is /var/run/clamav/clamd.ctl
). Make sure you verify the status of the clamav-daemon
. It should not be showing ‘condition failed’ or ‘inactive’ or ‘failed’.
If needed, you can edit the
clamd.ctl
file to change configuration properties like log location, socket IP etc based on your requirements.
Test file
Once the setup is successfully done, you can use clamscan
or clamdscan
to run anti-virus checks on your machine.
Using clamscan
:
Using clamdscan
:
As you can see, clamdscan
takes considerably less time compared to as clamscan
and is recommended to use.
ClamAV + Node.js
Since, this is quite a big topic, I have written a separate blog for it which can be found here.