How To Install ClamAV on CentOS 7

r00t August 26, 2015

ClamAV-logo

This how to will help you with your install and configuration of ClamAV on your CentOS 7 server. For those of you who didn’t know, ClamAV is an open source (GPL) antivirus engine designed for detecting viruses, malware and other malicious threats on Linux.  It’s easy to use and best for Linux based Web & Mail server.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation ClamAV on CentOS 7 server.

Install ClamAV on CentOS 7

Step 1. First add EPEL repository your system.

Step 2. Install ClamAV.

Install required ClamAV packages:

Step 3. Configuration of Clam daemon.

Copy a the clamd.conf template, in case you don’t have a configuration file yet:

Step 4. Configure SELinux for ClamAV.

You had to write this command to get it working with SELinux:

Step 4. Enable Freshclam.

For those of you who didn’t know, Freshclam helps with keeping the database of ClamAV up-to-date. First delete the related “Example” line from /etc/freshclam.conf:

We creating a quick file here. The process should be forking itself and start freshclam in daemon mode. In this case we configure it to check 4 times a day for new files:

Add following piece:

Now enable and start the service:

Next, rename the /usr/lib/systemd/system/clamd@.service file:

Now we have to change the clamd@scan service as well, as it refers to a non-existing file now. Change this line in /usr/lib/systemd/system/clamd@scan.service and remove the @ sign:

Next step is changing the clamd service file /usr/lib/systemd/system/clamd.service:

Move into the directory:

Finally, start all services:

Congratulation’s! You have successfully installed ClamAV. Thanks for using this tutorial for installing ClamAV on CentOS 7 system. For additional help or useful information, we recommend you to check the official ClamAV web site.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!
Share on Google+0Share on Facebook0Tweet about this on TwitterShare on Tumblr0Share on StumbleUpon5Share on Reddit1Pin on Pinterest4
The Tags:

Leave a Comment