Enter your email address below and subscribe to our newsletter

How to Install ClamAV on Ubuntu 22.04

Share your love

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.

Why Does Ubuntu Need an Antivirus?

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.

Installing ClamAV in Ubuntu 22.04

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.

Step 1: Updating and Upgrading Repositories

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


1. sudo apt update _ sudo apt upgrade -y

Step 2: Installing ClamAV in Ubuntu 22.04

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


2. sudp apt install clamav

Step 3: Checking the Current Version of ClamAV

To make sure ClamAV has been installed on our system, we can check its current version by given commands:

clamscan --version


3. clamscan --version

If it gives you output similar to the given snapshot, you are can proceed further to the next step

Updating ClamAV Signature Database 

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.

Stopping 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


4. sudo systemctl stop clamav-freshclam

Now, we can proceed to the next step which involves multiple methods of updating signature 

Method 1: Updating Signature Database using Terminal

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


5. 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.

Method 2: Downloading Latest Signatures Manually

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,

6. no such file or directories

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


7. copying

Now, we can resume clamav-freshclam service which we had stopped in the previous section by given command:

sudo systemctl start clamav-freshclam


8. sudo systemctl start clamav-freshclam

Using ClamAV on Ubuntu 22.04

In this phase, we are going to show you how you can use ClamAV for scanning and removing vulnerabilities. 

Scanning Specific Folders for 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/


9. scanning 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.

Scanning the Whole Ubuntu System

If you want to scan your system completely, you can use the following command:

sudo clamscan --infected --recursive --remove /


10. sudo apt purge --autoremove

Note: Scanning your whole system will take a long time.

Uninstalling ClamAV from Ubuntu 22.04

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:


10. sudo apt purge --autoremove

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.

Frequently Asked Questions on ClamAV

How do I know if ClamAV is installed on Linux?

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.

Does ClamAV have a GUI?

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:

Is ClamAV the Best for Ubuntu?

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!

Share your love
Sagar Sharma
Sagar Sharma

Sagar always uses Linux to its core and loves to write the technical side of system administration! While he's not writing for GeniusGeeks, you can find him writing for core linux blogs like IT'SFOSS.com and LinuxHandBook.com

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!