The cart is empty

ClamAV is an open-source antivirus software widely used on Linux servers and workstations for detecting trojans, viruses, malware, and other malicious threats. In this article, we will walk you through the step-by-step process of installing ClamAV on CentOS 7. The procedure includes installing ClamAV, configuring it, and basic usage for system scanning.

Prerequisites

Before beginning the installation, ensure that you have:

  • Access to the root user or a user with sudo privileges.
  • An updated CentOS 7 system.

Installing ClamAV

  1. Preparing the System First, update your system to ensure all existing packages are up to date. Open a terminal and run the following command:

    sudo yum update -y
    
  2. Adding the EPEL Repository ClamAV is available in the Extra Packages for Enterprise Linux (EPEL) repository, which you need to add to your system first. Run the following command to add the EPEL repository:
    sudo yum install epel-release -y
    ​
  3. Installing ClamAV After adding the EPEL repository, proceed to install ClamAV by running the following commands:
    sudo yum clean all
    sudo yum install clamav clamd -y
    ​

Configuring ClamAV

After successful installation, some basic configuration steps are required for ClamAV.

  1. Starting and Enabling the clamd Service To activate the antivirus service in the background and ensure it starts automatically at system boot, use the following commands:

    sudo systemctl start clamd@scan
    sudo systemctl enable clamd@scan
    
  2. Updating Virus Database ClamAV requires its virus database to be regularly updated. Run the following command to update the database:
    sudo freshclam
    ​

Using ClamAV

With ClamAV installed and configured, you can now perform system scans.

  • For running a full system scan, use:

    sudo clamscan -r / 
    

    This command will scan all files on the root partition.

  • For scanning a specific directory, replace / with the path to the directory:

    sudo clamscan -r /home
    

    This command will scan all files in the home directory.

 

You now have ClamAV installed and configured on your CentOS 7 system. It's essential to keep the virus database up to date and regularly scan your system to protect against new threats. ClamAV is a powerful tool for securing your system while being user-friendly.