---
title: "How to Install ClamAV on Ubuntu Linux"
description: "Learn the ways to protect your Linux system and install ClamAV on Ubuntu to find, detect, and clean viruses off your OS!"
canonical: "https://adamtheautomator.com/install-clamav-on-ubuntu/"
---

# How to Install ClamAV on Ubuntu Linux

> Learn the ways to protect your Linux system and install ClamAV on Ubuntu to find, detect, and clean viruses off your OS!

Source: https://adamtheautomator.com/install-clamav-on-ubuntu/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![How to Install ClamAV on Ubuntu Linux](https://adamtheautomator.com/wp-content/uploads/2022/09/How-to-Install-ClamAV-on-Ubuntu-Linux.jpg)

# How to Install ClamAV on Ubuntu Linux

[![](https://secure.gravatar.com/avatar/1bc5e1d52466fc3739f550c8d78be310684747bf1466a98d698320627ea243e2?s=192&d=mm&r=g)Michael Nguyen Tu](https://adamtheautomator.com/author/michael-nguyen-tu/)12 October 20225 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Linux](/tag/linux/)[Ubuntu Linux](/tag/ubuntu-linux/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Learning How to Install ClamAV on Ubuntu](#learning-how-to-install-clamav-on-ubuntu)
*   [Updating Virus Definitions/Databases](#updating-virus-definitionsdatabases)
*   [Scanning for Viruses Using the CLI](#scanning-for-viruses-using-the-cli)
*   [Running a Directory Scan](#running-a-directory-scan)
*   [Running a File Scan](#running-a-file-scan)
*   [Scanning for Viruses Using GUI](#scanning-for-viruses-using-gui)
*   [Installing ClamTk](#installing-clamtk)
*   [Updating Virus Database](#updating-virus-database)
*   [Running a Virus Scan](#running-a-virus-scan)
*   [Scheduling Regular Scans with ClamTk](#scheduling-regular-scans-with-clamtk)
*   [Conclusion](#conclusion)

You want to protect your computer from viruses. You’ve heard about [ClamAV](https://www.clamav.net/), but you’re unsure how to install and use it on Ubuntu. This tutorial will show you the ropes.

ClamAV is a free and open-source antivirus solution that several high-profile organizations use ClamAV, including Cisco, Google, IBM, McAfee, Microsoft, Sophos & Symantec.

In this tutorial, you will learn how to install ClamAV on Ubuntu and how to use it to scan your system for viruses. You will also learn how to update the database and install the GUI to make scanning easier.

## Prerequisites

This tutorial will be a hands-on demonstration. If you’d like to follow along, be sure you have an Ubuntu system ready to go. This tutorial uses Ubuntu [20.04](https://adamtheautomator.com/install-ubuntu/), but any recent version should work fine.

Related:[How to Install Ubuntu 20.04 \[Step-by-Step\]](https://adamtheautomator.com/install-ubuntu/)

## Learning How to Install ClamAV on Ubuntu

The apt package manager is the most convenient way to install ClamAV on Ubuntu. Follow these instructions below.

Related:[Learning Ubuntu Apt Get Through Examples](https://adamtheautomator.com/ubuntu-apt-get/)

1\. Open a terminal and run the following command to update the package repository index before you install ClamAV on Ubuntu.

```bash
apt update -y
```

2\. Run the below command to install ClamAV on Ubuntu. This command installs two packages: clamav and clamav-daemon. The former is the ClamAV scanner, while the latter is a background service that enables on-access scanning.

```bash
apt install clamav clamav-daemon -y
```

![Install ClamAV on Ubuntu](https://adamtheautomator.com/wp-content/uploads/2022/09/image-720.png)

Install ClamAV on Ubuntu

3\. After the installation, confirm the ClamAV version by running the below command.

```bash
clamscan --version
```

You will see an output similar to the one below. As of this writing, the current LTS version of ClamAV in the APT repository is 0.103.6.

![Check the ClamAV version](https://adamtheautomator.com/wp-content/uploads/2022/09/image-721.png)

Check the ClamAV version

## Updating Virus Definitions/Databases

ClamAV uses virus signature databases to identify malware. These databases receive regular updates with the latest signatures. To stay protected, you must also download these updates and apply them to your ClamAV installation.

By default, the freshclam service will automatically download the database updates once a day when you install ClamAV on Ubuntu. But, you can also manually update the databases. Why update manually? There are two main reasons:

*   You want to scan for viruses immediately and don’t want to wait for the automatic update.
*   The automatic updater is not working correctly.

Updating the virus definitions is not complicated at all. A built-in command called `freshclam`, which is included when you install ClamAV on Ubuntu, can do all the work for you, including downloading the databases and reloading ClamAV.

Below are the steps to update the virus definitions.

1\. To update the databases manually, stop the clamav-freshclam service first. This service is responsible for automatic updates. Run the below systemctl command to disable the clamav-freshclam service.

Related:[Correct Way of Using Ubuntu systemctl to Control Systemd](https://adamtheautomator.com/ubuntu-systemctl/)

```bash
systemctl stop clamav-freshclam
```

2\. Next, run freshclam to download the updates.

```powershell
freshclam
```

3\. After the updates, start the clamav-freshclam service so that it will automatically update the databases in the future.

```bash
systemctl start clamav-freshclam
```

![Updating the ClamAV virus definitions database](https://adamtheautomator.com/wp-content/uploads/2022/09/image-722.png)

Updating the ClamAV virus definitions database

## Scanning for Viruses Using the CLI

Now that ClamAV is installed and the databases updated, it’s time to scan your system for viruses. There are two ways to do this: the command line or the graphical user interface.

You can skip to the next section if you want to learn about using the GUI. This section will focus on using the CLI.

The `clamscan` command is the command-line tool for running the virus scan. You can list the options available with the `clamscan` command like so.

```bash
man clamscan
```

### Running a Directory Scan

While there are many `clamscan` options, the ones you’ll use in this section are:

*   \-i, –infected – Display only the infected files on the screen and will not show clean files. Use this option to suppress
*   \-r, –recursive – Performs a recursive scan of the folder and subfolders. Do not use this option to limit the scan to the top folder.
*   `--remove - Automatically remove infected files. Be careful when using this option because ClamAV will also remove those files if a false-positive detection happens.`

The scan could run from several minutes to hours, depending on how many files you have on your system. You may want to consider running it overnight or while you’re away from the computer.

For example, run the command below to scan your Downloads folder recursively.

```bash
clamscan --infected --remove --recursive ~/Downloads
```

After the scan, you’ll get a summary result. As you can see below, the scan found one infected file. And because the –remove option is present, clamscan automatically deleted the file.

![Scanning a directory](https://adamtheautomator.com/wp-content/uploads/2022/09/image-723.png)

Scanning a directory

### Running a File Scan

When you receive or download a file, you can run an on-demand scan to determine if the file is safe. The command is still `clamscan`, followed by the file path you want to scan. The `--remove` option automatically removes the file if infected.

```powershell
clamscan --remove ~/Downloads/eicar_com.zip
```

![clamscan --remove](https://adamtheautomator.com/wp-content/uploads/2022/09/image-724.png)

clamscan –remove

## Scanning for Viruses Using GUI

If you prefer a graphical user interface, you can install the ClamTk application, a lightweight front-end GUI for ClamAV.

### Installing ClamTk

Install ClamTk by running the below command.

```bash
apt install clamtk -y
```

After the installation, launch the ClamTk application.

```powershell
clamtk
```

The **Virus Scanner** window opens, showing you the main interface.

![ClamTk GUI](https://adamtheautomator.com/wp-content/uploads/2022/09/image-725.png)

ClamTk GUI

### Updating Virus Database

1\. To update the databases, click on the **Update** icon.

![Click Update](https://adamtheautomator.com/wp-content/uploads/2022/09/image-726.png)

Click Update

2\. Click **Yes** to confirm that you want to check and update the databases.

![Click Yes](https://adamtheautomator.com/wp-content/uploads/2022/09/image-727.png)

Click Yes

3\. When the process is complete, you will see a window similar to the one below. Click **Back** to return to the main window.

![Click Back to return to the main window](https://adamtheautomator.com/wp-content/uploads/2022/09/image-728.png)

Click Back to return to the main window

### Running a Virus Scan

1\. To scan your system for viruses, click on the Scan a file button to scan a specific file. Click on Scan a directory to scan an entire directory. In this example, click Scan a file.

![Selecting a virus scan type](https://adamtheautomator.com/wp-content/uploads/2022/09/image-729.png)

Selecting a virus scan type

2\. Locate the file to scan, select it, and click OK.

![Selecting the file to scan](https://adamtheautomator.com/wp-content/uploads/2022/09/image-730.png)

Selecting the file to scan

3\. ClamTk will scan the file and display the results. If the scan finds the file is infected, you can either quarantine or delete the file. In this example, click Quarantine to quarantine the file.

![Quarantine the infected file](https://adamtheautomator.com/wp-content/uploads/2022/09/image-731.png)

Quarantine the infected file

4\. The Action Taken changes to Quarantined. Click Close to exit the results.

![Exit the results window](https://adamtheautomator.com/wp-content/uploads/2022/09/image-732.png)

Exit the results window

5\. Click Close again to return to the main window.

![Exit the scan](https://adamtheautomator.com/wp-content/uploads/2022/09/image-733.png)

Exit the scan

### Scheduling Regular Scans with ClamTk

Setting up a scheduled scan is ideal to ensure a clean system. With ClamTk, scheduling a regular scan is only a few clicks away.

1\. Click on Schedule from the main window.

![Opening the Scheduler](https://adamtheautomator.com/wp-content/uploads/2022/09/image-734.png)

Opening the Scheduler

2\. A new Scheduler window will open where you can configure the daily update and scan schedule. The time is in a 24-hour format.

Enter the time you want the update to run in the Antivirus signature field. In this example, the update will run at 22:00 every day.

> _Note: The update schedule must be before the scan schedule so that the databases will be up to date before the scan starts._

3\. Enter the time you want the scan to run in the Scan field. In this example, the scan will run at 23:00 every day.

> _Note: You should schedule an update and scan when you know that you won’t be using the computer._

4\. In the Status field, you will see that the daily scan and definition update show as scheduled. Click the Close button to exit the scheduler.

![Schedule a daily scan and virus definitions update](https://adamtheautomator.com/wp-content/uploads/2022/09/image-735.png)

Schedule a daily scan and virus definitions update

## Conclusion

In this tutorial, you’ve learned how to install ClamAV on Ubuntu. You ran the `clamscan` command to scan your files and folders for infection. You’ve also learned how to install and use the ClamTk graphical user interface.

Scanning your computer for viruses is an essential maintenance task to keep your system safe from malware. ClamAV is a powerful tool that can help with ensuring a virus-free computer. Best of all, ClamAV is free! Don’t waste time and install ClamAV on Ubuntu now.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Finstall-clamav-on-ubuntu%2F&text=How%20to%20Install%20ClamAV%20on%20Ubuntu%20Linux)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Finstall-clamav-on-ubuntu%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Finstall-clamav-on-ubuntu%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2024/03/openldap-4.jpg)

### [How to Install and Configure an OpenLDAP Ubuntu Server](/openldap/)

Unlock the power of OpenLDAP on Ubuntu for centralized user authentication, seamless access control management, and enhanced directory services!

![](https://adamtheautomator.com/wp-content/uploads/2023/08/install-go-on-ubuntu-1.jpg)

### [How to Install GO on Ubuntu Linux](/install-go-on-ubuntu/)

Learn the ins-and-outs of how to install GO Ubuntu Linux and see how you can take advantage of this popular programming language!

![](https://adamtheautomator.com/wp-content/uploads/2023/07/update-the-kernel-in-ubuntu.jpg)

### [Learn how to Update the Kernel In Ubuntu Linux Safely](/update-the-kernel-in-ubuntu/)

In this ATA Learning tutorial learn the ins-and-outs to update the kernel in Ubuntu Linux safely through several different methods!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
