Install ClamAV on CentOS 8 - Step by step guide ?

While Linux is known to be one of the more secure operating systems, that doesn't mean it is impenetrable to virus attacks. 

ClamAV is an open-source (GPL) antivirus engine for detecting trojans, viruses, malware, adware, rootkits, and other malicious threats on Linux. It's easy to use and best for Linux-based Web and Mail servers.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related ClamAV Installation queries.

In this context, we shall look into how to install ClamAV on CentOS 8.


Steps to Install  and Configure ClamAV on CentOS 8

1. Perform System Update

First, let's start by ensuring your system is up-to-date:

$ sudo dnf install epel-release
$ sudo dnf update


2. Install ClamAV on the system

Run the following commands to install ClamAV:

$ sudo dnf install clamav clamav-update clamd


3.  Configure ClamAV with SELinux

Once Clamav has been installed SELinux must be adjusted, otherwise, the freshclam utility for updates will not work and scans will not be performed because they'll be blocked:

$ setsebool -P antivirus_can_scan_system 1


4. Update the ClamAV Signature Database

Update virus database with freshclam:

$ sudo freshclam

It'll take a few minutes to complete. When it's done, restart the service:

$ sudo systemctl restart freshclam.service

We can now make use of the Clamav antivirus and make some scans at will. This is a very short guide from its developers. But here are some simple examples:

$ clamscan --infected --remove --recursive /home

Print help information using -h or –help option:

$ clamscan -h


How to start Clamd service ?

To start Clamd service and run it on boot, simply execute the below commands:

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


[Need assistance in fixing Linux system issues ? We can help you. ]

This article covers the process of installing ClamAV antivirus on CentOS 8 system. In fact, ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux.

Related Posts