• Uncategorized
  • 0

How 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

Step1: 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

Step 2: Adding user and group for clamav

# useradd clamav
# groupadd clamav

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

clamav-trademark

Step 3: Create and chown clamav directory

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

Step 4: Download the latest ClamAV from http://www.clamav.net/

# wget http://www.clamav.net/downloads/production/clamav-0.99.tar.gz
# 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

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

root@server [/]# cat /usr/local/etc/freshclam.conf | grep -i example
## Example config file for freshclam
#Example
#mv -fv /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf

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

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

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

root@server [/]# grep LocalSocket /usr/local/etc/clamd.conf
LocalSocket /tmp/clamd.socket

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

# ldconfig

Step 9: Run freshclam to download the latest definitions

# freshclam

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

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

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

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

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

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

Step 13: Creating log files for ClamAV updates

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

Step 14: Add ClamAV to chkservd

root@server [/]# cat  /etc/chkserv.d/chkservd.conf | grep clamav
clamav:1

That’s it 🙂

Heba Habeeb

Working as a Linux Server Admin, Infopark, Cochin, Kerala.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *