Installing ClamAV Anti-Virus on CentOS And Scanning For Viruses on The Server

 

By installing ClamAV anti-virus on the server, you can scan for viruses on your server. Below we will try to explain how to install and scan.

Since there is no ClamAV in the standard CentOS libraries, let’s start by adding the EPEL repo to CentOS as the best way;

Then, with the command below, ClamAV anti-virus and Clamav Clamd Deamon is installed;

With the following commands, we set Clamd to start automatically with the system and start it;

Let’s update the ClamAV virus database with the following command;

With the command below, we can start scanning and find the infected file and write it to the specified log file. We could also have a direct deletion, but in this case, serious problems can occur with the deletion of various files related to the system. Therefore, it would be more logical to detect infected files and perform the manual operation.

To have a daily automatic scan, you can create a script as follows and define it as crona;

First, let’s open it to create the script file;

Then let’s record the following content into it;

Then let’s make the file executable with the following command;

I hope it has been a useful article.