Why Install Antivirus on Your Server?

If you run a VPS or Dedicated Server, having an antivirus is essential. Malware, worms, and trojans can infiltrate your server unnoticed, compromising security and data integrity.

ClamAV is a free, open-source antivirus designed for Linux servers, offering powerful malware detection and email filtering. Below are the steps to install and configure it on your server.

Installing ClamAV on cPanel/WHM

The easiest way to install ClamAV on a cPanel server is via WHM’s plugin installer:

WHM > Cpanel Install Plugin > Enable ClamAV Connector

Once installed, ClamAV will be available for scanning files and emails directly through WHM and cPanel.

Manual Installation of ClamAV on CentOS/AlmaLinux

To install ClamAV manually via SSH, run the following command as root:

yum install clamd

If the above doesn’t work, try:

yum install clamav

Alternative Installation Using RPMForge Repository

If ClamAV is not available in your default repositories, you may need to install the RPMForge repo:

rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm

Once the repository is added, retry installing ClamAV:

yum install clamd
[OR]
yum install clamav

Basic ClamAV Commands

1. Update the Antivirus Database

Before scanning, update the virus definitions to ensure ClamAV can detect the latest threats:

freshclam

2. Scan a Directory for Malware

To manually scan the /home directory for infected files, run:

clamscan -r /home

3. Automate Daily Scanning with a Cron Job

To schedule an automatic daily scan at 1:02 AM, edit the crontab file:

crontab -e

Add the following line and save the file:

02 1 * * * root clamscan -R /home

This will scan the /home directory every day. You can modify the path to scan other directories, such as mail folders.

Why Choose UnderHost for Secure Hosting?

A secure hosting environment is key to preventing malware infections. UnderHost offers Managed Hosting solutions with built-in security features, regular virus scans, and expert support.

For more information, visit UnderHost Customer Panel.