How To Install ClamAV On A CPanel Server

How To Install ClamAV On A CPanel Server

Steps To Install ClamAV On A CPanel Server

Here I’m explaining the steps to install ClamAV on a cPanel server. Before proceeding with this, first you need to make sure WHM plugin clamavconnector is not installed. Check WHM >> Manage plugins

1: If you would like to verify ClamAV’s digital signatures on the virus definition files as they are updated through freshclam, you need to install GMP first.

# /scripts/ensurerpm gmp gmp-devel bzip2-devel

2: Adding user and group for clamav

# useradd clamav
# groupadd clamav

Note: Don’t worry if the user and/or group already exists.

3: Create and chown clamav directory

# mkdir /usr/local/share/clamav
# chown clamav. /usr/local/share/clamav

4: Download the latest ClamAV from

# wget
# tar -xvzf clamav-0.99.tar.gz
# cd clamav-0.99
# ./configure --disable-zlib-vcheck
# make
# make install

#mv -fv /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.conf

5: Comment out “Example” line in /usr/local/etc/freshclam.conf

[email protected] [/]# cat /usr/local/etc/freshclam.conf | grep -i example
## Example config file for freshclam

#mv -fv /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf

6: Comment out “Example” line in /usr/local/etc/clamd.conf

[email protected] [/]# cat /usr/local/etc/clamd.conf | grep -i example
## Example config file for the Clam AV daemon

7: Change the “LocalSocket” to /tmp/clamd in /usr/local/etc/clamd.conf

[email protected] [/]# grep LocalSocket /usr/local/etc/clamd.conf
LocalSocket /tmp/clamd.socket

8: Run ldconfig to create the necessary links and cache to the most recent shared libraries

# ldconfig

9: Run freshclam to download the latest definitions

# freshclam

10: Init script for CentOS/CloudLinux upto/including version 6.x

# curl -o /etc/init.d/clamd
# chown root:root /etc/init.d/clamd
# chmod +x /etc/init.d/clamd
# chkconfig clamd on
# service clamd restart

11: Init script for CentOS/CloudLinux version 7.x

# rm -fv /etc/init.d/clamd
# curl -o /usr/lib/systemd/system/clamd.service
# systemctl daemon-reload
# systemctl enable clamd.service
# systemctl restart clamd.service

12: Add service to /etc/chkserv.d/clamav

[email protected] [/]# cat  /etc/chkserv.d/clamav
service[clamav]=x,x,x,service clamd restart,clamd,root

13: Creating log files for ClamAV updates

# touch /var/log/clam-update.log
# chown clamav:clamav /var/log/clam-update.log

14: Add ClamAV to chkservd

[email protected] [/]# cat  /etc/chkserv.d/chkservd.conf | grep clamav

Without Doubt ClamAV protects your website from malware, trojans, and viruses. So, It is a free solution for websites that are at low risk. In Conclusion, This tutorial will show you how to install Clamav on a linux server using a few simple commands.

in case If you are having difficulty installing ClamAV on a Linux server, you can contact Server Supportz for prompt administration and assistance. Hence Server supportz is a leading company that offers low-cost hosting plans and dependable server support, You can contact the support engineers at any time to resolve server issues.

Tags: ,