This how to install clamav Anti Virus helps you to install a malware protection on your Debian Linux computer. It’s actually very simple, so don’t worry. Further, it will provide you with some additional information that maybe is useful for you.
Index:
Background
I know, there are arguments about having Anti Virus installed on a Debian Linux machine. Some say you do not need it, some say you definitely need it. Look, I rather install it then regretting having it not installed after being hacked or facing any other sort of painful event that could have been avoided by the Anti Virus.
In a nutshell, what does Anti Virus / Malware Protection help for (5 examples):
- You don’t know the future! What is secure today maybe is not tomorrow anymore! Better be on the safe site than regret!
- Only because there are fewer virus existing for Linux, it does not mean there are “no virus”
- Linux (especially servers) could be targets for cyber criminals leveraging on Worms, Viruses, any other sort of malware and for example Distributed Denial of Service Attacks (DDOS)
- Zero-day attacks
- Not installing anti-virus, losing data and then regret is a bad approach! Rather be on the safe site and in a position to say I followed all best practices
How To Install Clamav Anti Virus
It’s actually very easy to install anti virus on Debian Linux. You simply execute the below command and you are done. Before this, I like to inform you, that the below will install Clam Anti Virus, which is an open source malware solution.
Clam Anti Virus is included in the standard Debian distribution. For this reason, the installation is really simple! Just execute:
apt-get install clamav clamav-daemon
- clamav is an anti-virus utility for Unix – command-line interface
- clamav-deamon is an anti-virus utility for Unix – scanner daemon
If all runs fine, the output of this command will look like this:
root@mla1:~# apt-get install clamav clamav-daemon
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
clamdscan
Suggested packages:
libclamunrar clamav-docs daemon
The following NEW packages will be installed:
clamav clamav-daemon clamdscan
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/542 kB of archives.
After this operation, 2,119 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Preconfiguring packages ...
Selecting previously unselected package clamav.
(Reading database ... 85201 files and directories currently installed.)
Preparing to unpack .../clamav_0.103.6+dfsg-0+deb10u1_amd64.deb ...
Unpacking clamav (0.103.6+dfsg-0+deb10u1) ...
Selecting previously unselected package clamav-daemon.
Preparing to unpack .../clamav-daemon_0.103.6+dfsg-0+deb10u1_amd64.deb ...
Unpacking clamav-daemon (0.103.6+dfsg-0+deb10u1) ...
Selecting previously unselected package clamdscan.
Preparing to unpack .../clamdscan_0.103.6+dfsg-0+deb10u1_amd64.deb ...
Unpacking clamdscan (0.103.6+dfsg-0+deb10u1) ...
Setting up clamav (0.103.6+dfsg-0+deb10u1) ...
Setting up clamdscan (0.103.6+dfsg-0+deb10u1) ...
Setting up clamav-daemon (0.103.6+dfsg-0+deb10u1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u8) ...
The next step is to update the anti virus signatures. For this you simply execute:
freshclam
Now, you are done!
Additional Information
Automate anti virus signatures updates
Anti-Virus signatures are needed to detect malware. These signatures get frequent updates. Basically, whenever a new virus is detected. For this reason it makes sense to update these signatures automatically. This shows, how you can automate your anti virus signatures.
Before you install or modify anything, better double check whether the database updater is running. If that’s the case, then you do not need to do anything. To check, execute the below command:
systemctl status clamav-freshclam
If you get as an answer something similar like the below (note: there should not be any errors), then you are fine an the system is updating automatically, otherwise, you maybe like to consider to leverage on crontab and continue in this chapter.
systemctl status clamav-freshclam
● clamav-freshclam.service - ClamAV virus database updater
Loaded: loaded (/lib/systemd/system/clamav-freshclam.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-09-24 18:47:15 CEST; 1 months 17 days ago
Docs: man:freshclam(1)
man:freshclam.conf(5)
https://docs.clamav.net/
Main PID: 516 (freshclam)
Tasks: 1 (limit: 2359)
Memory: 3.1M
CGroup: /system.slice/clamav-freshclam.service
└─516 /usr/bin/freshclam -d --foreground=true
We basically leverage on crontab. Why? Well, it’s a simple task for which a crontab fits perfect. Of course, in the world of Linux you have probably dozens of other options and all of these have advantages and disadvantages.&nbs
crontab -e
In the crontab, add the following line which will run every day at 03:59 the freshclam that is responsible for updating your anti virus signatures
59 03 * * * freshclam
After you finished editing, you should get a message like “crontab: installing new crontab”. This means, your new crontab will be made effective.
Remove or uninstall your calm anti-virus
Have a look at this how to that helps you to uninstall clam anti virus.
Additional Sources and Information
If you like this how to, than please feel free to link to this website, forward it to friends and reference to it.
In case you have comments, suggestions or improvements, please contact me via the contact form.