Newsletter Subscribe
Enter your email address below and subscribe to our newsletter
Clam AntiVirus (ClamAV) is free and open-source Antivirus that was started by Dave Mauroni in February 2004 and remains under development. It is a Terminal based program that is considered one of the best Antivirus software for Ubuntu and other Linux distributions.
It avails you quick scanning and can over a million trojans and viruses. The main reason for its popularity is that it avails you the ability to scan your emails and gateways, which is the most vulnerable part of Linux because it directly affects networks.
We are going to show you how you can install ClamAV on Ubuntu, but this will apply to all the Ubuntu and Debian-based distros.
Table of Contents
If you are using Ubuntu or any other Linux distribution, you might have heard that Linux doesn’t need Antivirus software because it’s robust from its core.
Ubuntu is mainly used on servers and mainframe computers, so if you somehow managed to get into the system, you can have access to sensitive data. So this is the reason why Linux has become more vulnerable, and you need Antivirus mainly to protect from Network attacks.
To install ClamAV in Ubuntu, we are going to utilize the efficiency that Terminal has to offer. Open your Terminal and follow the given steps.
To install the latest and stable version of ClamAV, we are required to update our Repositories, and if there are any changes required, you have to download updates. Use the following commands:
sudo apt update && sudo apt upgrade -y
After updating the Repositories, we are ready to Install ClamAV in our Ubuntu system. Utilize the following commands to proceed on the installation part:
sudo apt install clamav clamav-daemon
To make sure ClamAV has been installed on our system, we can check its current version by given commands:
clamscan --version
If it gives you output similar to the given snapshot, you are can proceed further to the next step
After installation, we must update the signature database to know the latest trojans and malicious codes.
We have two methods by which you can update your signature database. But before that, we have to stop the freshclam service.
This is the essential step when we have to update the signature database. Use the following commands to stop the freshclam service:
sudo systemctl stop clamav-freshclam
Now, we can proceed to the next step which involves multiple methods of updating signature
This is the easiest method to update the signature database. You just have to use the single command given below to update the signature database.
sudo freshclam
As you can see, the database has been updated. If this method does not work, you can utilize the 2nd method shown below.
In this method, we are going to download the latest signatures from their official site and will move the downloaded files to its directory.
Step 1: Downloading Signatures
You just have to visit their official site for downloading the latest signatures.
It will download the file named “daily.cvd” in your Downloads folder.
Step 2: Moving Downloaded files to the appropriate repository
After downloading daily.cvd, we have to move that file to /var/lib/clamav. If it throws an error saying there is no such directory similar to a given image,
You can use the following command to make a directory:
sudo mkdir /var/lib/clamav
Now, use the following command to move file to a /var/lib/clamav.
sudo cp Downloads/daily.cvd /var/lib/clamav/daily.cvd
Now, we can resume clamav-freshclam service which we had stopped in the previous section by given command:
sudo systemctl start clamav-freshclam
In this phase, we are going to show you how you can use ClamAV for scanning and removing vulnerabilities.
If you want to scan specific folders, you can use the following syntax by replacing Documents/with your desired folder.
sudo clamscan --infected --remove --recursive Documents/
Brief understanding of used command:
--remove
: It will remove infected files
--infected
: It will print infected files which ClamAV found during the scan
--recursive
: It will scan subdirectories too. For example, if you want to scan the Downloads folder, this will help you to scan folders that are inside your Downloads folder.
If you want to scan your system completely, you can use the following command:
sudo clamscan --infected --recursive --remove /
Note: Scanning your whole system will take a long time.
Keeping ClamAV installed won’t harm your system, but if you don’t need it anymore or running out of space, you can easily remove it from your system by given command:
This will remove dependencies, configuration files, and data related to ClamAV. This is the best way to remove ClamAV and will be helpful if you are planning to reinstall it in the upcoming future.
You can easily verify whether ClamAV is installed or not by checking the installed version. Use this command: clamscan --version
. If it shows a version number, then it’s perfectly installed, and if it throws an error, it is not installed on your system.
Yes, it does have GUI known as ClamTk, which is free software built for those who are not comfortable using Terminal and want to get their system secured.
Related Posts:
ClamAV is considered one of the best Antivirus tools available for Linux considered its security features. If you wish to get it on your system, you can easily install ClamAV on Ubuntu and safeguard your system straight away!