How to Install ClamAV

in antivirus •  6 months ago 

Install ClamAV

This guide provides step-by-step instructions on how to install ClamAV, an open-source antivirus software, on a Linux system. We'll cover the installation on Ubuntu/Debian and CentOS/RHEL systems.

Prerequisites

  • A system running Linux (Ubuntu/Debian or CentOS/RHEL)
  • Root or sudo privileges
  • Access to a terminal/command line

Installation on Ubuntu/Debian Systems

1. Update the Package List

Before installing new software, it's a good idea to update your package list. Open your terminal and run:

sudo apt update

2. Install ClamAV

Install ClamAV and its utilities using apt:

sudo apt install clamav clamav-daemon

The clamav-daemon package allows ClamAV to run as a background service.

3. Start and Enable the ClamAV Service

After installation, you need to start the ClamAV service and enable it to run at boot:

sudo systemctl start clamav-daemon
sudo systemctl enable clamav-daemon

4. Update Virus Database

The effectiveness of ClamAV depends on keeping its virus database up-to-date:

sudo freshclam

This command updates ClamAV’s database. It's also configured to run automatically by default.

5. Scan for Malware

To perform a manual scan, use:

clamscan [options] [file/directory]

For example, to scan the entire system, run:

sudo clamscan --infected --recursive --exclude-dir="^/sys" /

Installation on CentOS/RHEL Systems

1. Enable EPEL Repository

ClamAV is available in the Extra Packages for Enterprise Linux (EPEL) repository. If it's not already enabled, enable EPEL:

sudo yum install epel-release

2. Install ClamAV

Now, install ClamAV:

sudo yum install clamav

3. Start and Enable the ClamAV Service

Similar to Ubuntu/Debian, start and enable the service:

sudo systemctl start clamd@scan
sudo systemctl enable clamd@scan

4. Update Virus Database

Update the virus definitions:

sudo freshclam

5. Scan for Malware

You can start a scan using:

sudo clamscan --infected --recursive --exclude-dir="^/sys" /

Conclusion

After following these steps, ClamAV should be successfully installed and configured on your Linux system. Regularly updating the virus database and performing system scans is crucial to maintaining system security.

Additional Resources

ClamAV official documentation: ClamAV Official Documentation

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!