In this article, we will have explained the necessary steps to installing and configure ClamAV on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
ClamAV is an open-source Antivirus tool available for Linux distributions. It integrates Mail servers to scan attachments received. Other functions also include web scanning. ClamAV includes a multi-threaded scanner daemon, command-line utilities for on-demand file scanning, and automatic signature updates. One of its main uses is on mail servers as a server-side email virus scanner.
Install ClamAV on CentOS 8
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo dnf install epel-release sudo dnf update
Step 2. Install ClamAV on CentOS systems.
Run the following commands below to install the Clamav antivirus:
sudo dnf install clamav clamav-update clamd
Step 3. Setup SELinux.
Now 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:
sudo setsebool -P antivirus_can_scan_system 1
Step 4. Get the antivirus signatures.
Now update pattern files manually using the following command below:
Next, start the
freshclam service with
systemd and enable it to start at system reboot with the following command:
sudo systemct start freshclam.service sudo systemctl enable freshclam.service
Step 5. Use Clamscan to Scan.
The basic syntax of Clamscan is shown below:
clamscan [options] [files-or-directories]
You can print all available option with
clamscan using the following command:
That’s all you need to do to install ClamAV on CentOS 8. I hope you find this quick tip helpful. For further reading on ClamAV open-source Antivirus, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.