How to Install ClamAV on CentOS Linux 

In this tutorial we are going to discuss how to install ClamAV on CentOS Linux Dedicated Server.

  • Installing ClamAV on CentOS

Since ClamAv does not contains CentOS software in its repository, we are going to add the add in by running yum:

 

yum -y install epel-release

yum clean all

 

At present we are going to install ClamAV on CentOS Linux Dedicated Server, one more time run the command given below:

 

yum -y install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd

 

All done, now you have just installed antivirus software on your CentOS Linux Dedicated server.

 

  • Configuring SELinux

SELinux is a security and safety measure focused at safeguarding modifications to few files. Extra setup is required on the off chance that you need to utilize ClamAV with empowered SELinux kernel module, generally Clam won't have the capacity to peruse some bit of your files. Simply execute following commands:

 

setsebool -P antivirus_can_scan_system 1

setsebool -P clamd_use_jit 1

 

Verify the changes using:

getsebool -a | grep antivirus

 

Now should see the following results:

antivirus_can_scan_system --> on

antivirus_use_jit --> off

 

All done, now ClamAV is ready to utilize along with SELinux.

 

 

  • Configuring ClamAV

Before Clam configuration can be empowered, you have to expel Example string from the setup document:

 

sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf

 

Now, you need to define the server type. Open setup file using your favorite text editor tool, here we are going to use nano. It is not previously installed on our Linux Dedicated server. So we will install it utilizing yum:

yum install nano -y

 

Now open the configuration file:

 

nano /etc/clamd.d/scan.conf

 

Look to this line:

 

#LocalSocket /var/run/clamd.scan/clamd.sock

 

And modify it to:

LocalSocket /var/run/clamd.scan/clamd.sock

 

Save the modifications you have done by pressing CTRL+X from your keyboard.

Relatively completed, now expel Example string from ClamAV's freshclam update engine configuration file:

sed -i -e "s/^Example/#Example/" /etc/freshclam.conf

 

Now run virus definition database update:

freshclam

 

Now you should get out similar to:

ClamAV update process started at Tue Dec  19 09:30:20 2016
   main.cvd is Updated- up to date (version: 86, sigs: 4258790, f-level: 60, builder: amishhammer)
   Trying host database.clamav.net (69.163.100.14)...
   Downloading daily.cvd [100%]
   daily.cvd updated (version: 86743, sigs: 1100989, f-level: 63, builder: neo)
   Downloading bytecode-279.cdiff [100%]
   Downloading bytecode-280.cdiff [100%]
   Downloading bytecode-281.cdiff [100%]
   Downloading bytecode-282.cdiff [100%]
   Downloading bytecode-283.cdiff [100%]
   bytecode.cld up to date updated (version: 285, sigs: 57, f-level: 63, builder: bbaker)
   Database updated (5319836 signatures) from database.clamav.net (IP: 000.111.22.33)

 

At last, begin Clamd service and run in on boot:

systemctl start clamd@scan
systemctl enable clamd@scan

 

Now you have successfully installed ClamAV on your CentOS Linux Dedicated Server.