Archive

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

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
#Example


#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
#Example

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

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

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
clamav:1

Installing CloudFlare plugin on cPanel server

This is a free Content Delivery Network (CDN) for your domain. CloudFlare provides a better Internet security services and distributed domain name server services, sitting between the visitor and the Cloudflare user’s hosting provider, acting as a reverse proxy for websites. CloudFlare’s cPanel plugin is also available to manage the CloudFlare account simply through the cPanel itself.

The CloudFlare cPanel plugin installation is very simple and it can be achieved within 5 minutes. This plugin integrates CloudFlare with your cPanel server. Try this and enjoy!!!

Installation Steps

Step 1. SSH to the server in which you need to install CloudFlare plugin.

Step 2. Enter the cPanel basic directory:

cd /usr/local/cpanel

Step 3. Download the tar file to your server.

curl -k -L https://github.com/cloudflare/CloudFlare-CPanel/tarball/master > cloudflare.tar.gz

Step 4. Untar the file

tar -zxvf cloudflare.tar.gz

Step 5. This will extracts a directory which includes a UNIQUE_ID. The sample format of this will be as follows:

cloudflare-CloudFlare-CPanel-w40bbb3

Here w40bbb3 is the UNIQUE_ID.

cd cloudflare-CloudFlare-CPanel-UNIQUE_ID/cloudflare

Step 6. Execute the install script in the following format:

./install_cf API_HOST_KEY mod_cf "Your Company Name"

API_HOST_KEY – You will get this from your CloudFlare panel.
Your Company name – You can give your hostname here.

How to find the API_HOST_KEY?

You can copy the API_HOST_KEY from your CloudFlare account. Please do the following steps to find out the API_HOST_KEY.

Step 1. Log into your CloudFlare account.

Step 2. Go to “My Settings”.

Step 3. Scroll down to “Global API Key”.

Step 4. Click on the “View API Key” button to see your API identifier.

mod_cf is optional. If set, the installer will also try to install mod_cloudflare

That’s it!!! Now, you will be able to see an icon for “CloudFlare” in all your cPanel accounts.

Sample Output for a successful installation:

info [verify_api_spec_files] LoadFile
Done
Register Complete

==> mod_cloudflare: Installed successfully.
==> You may need to customize your EasyApache profile to include Mod CloudFlare

CloudFlare module installed successfully.

In some cases, if you see the output as :

Your HOST_KEY (d892a17e61de5caa062302d54714eb39e4d42) is invalid.

If you see this error, please contact CloudFlare support and ask for valid Host key.

That’s it 🙂