Are there viruses in Linux? The answer is yes, the point is that Linux is a very secure system that minimizes risks. However, when you use a Linux server on a network where there are many clients using Windows, it is useful to install ClamAV to remove those viruses.
ClamAV is an open source antivirus engine for detecting Trojans, viruses, malware and other malicious threats. Of course, it is available for the most common Linux distributions including Debian, Ubuntu, and CentOS.
In case you didn’t know, ClamAV is the standard for mail gateway scanning software. Of course, we are talking about the open source area. This tells you how powerful and reliable it is. All this, with a high performance, which assures you that you will not have an unnecessary expense of computer resource.
Let’s install ClamAV on Debian 10 / Debian 9.
1. Install ClamAV
Installing ClamAV is really simple because it is available in the main repositories of most Linux distributions.
In case you are using Fedora:
:~$ sudo dnf install clamav
For CentOS 7:
:~$ sudo yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd
To install ClamAV in OpenSuse, just run:
:~$ sudo zypper install clamav
And for Debian and Ubuntu:
:~$ su :~# apt update && sudo apt upgrade :~# apt-get install clamav clamav-daemon
The installation is done.
2. Using ClamAV
Like any antivirus, its effectiveness depends on how often you update your virus definition. So the first step is to update ClamAV.
:~# freshclam
Next, scan a directory.
:~# clamscan -r /home/angelo
The -r
option is for recursively search.
In this case, ClamAV doesn’t detect any viruses because I literally don’t have any. It is practically a clean Debian installation.
I got an infected file, let’s see how ClamAV treats it.
As you can see, ClamAV found the infected file. Now, remove it.
:~# clamscan --infected --remove --recursive /home/angelo
The above process is very easy but it is not a good idea if it has to be done frequently. So, initialize the ClamAV daemon to constantly look for threats.
:~# systemctl start clamav-daemon :~# systemctl start clamav-freshclam
Finally, you can consult the rest of ClamAV usage using its help. It is important to know other options of use and configuration.
:~# clamav --help
And that’s it for now.
Conclusion
It is important to know how to use ClamAV on Linux because security is an issue that should not be taken lightly. Its installation and use are quite simple but because it is open source it guarantees a correct and frequently updated database.
Please share this post with your friends.
That’s what I got after installation:
ERROR: /var/log/clamav/freshclam.log is locked by another process
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
ERROR: initialize: libfreshclam init failed.
ERROR: Initialization error!
and after trying to scan:
/home/angelo: No such file or directory
WARNING: /home/angelo: Can’t access file
My question now is how do I uninstall it. I don’t need to clutter my memory with broken stuff that doesn’t do its job.
@KJ
1. stop the freshclamservice by sudo systemctl stop clamav-freshclam the continue everything from point 2 onwards and it should work
How to update or upgrade Clamav to the newest version?