Installing and Configuring Clamscan


ClamAV is an open source (GPL) antivirus engine designed for detecting trojans, viruses, malware and other malicious threats.

To Install ClamAV for Non-cPanel ServersTop

  1. Install EPEL Repo using the command:

    rpm -Uvh

    This will create an EPEL Repo file /etc/yum.repos.d/epel.repo.

  2. Install required ClamAV packages.

    yum install clamav clamd
  3. Start the clamd service and set it to auto-start.

    /etc/init.d/clamd on

    chkconfig clamd on

    /etc/init.d/clamd start
  4. Update ClamAV signatures using the command:


Now, you can configure daily scan as given below:

  1. Create a cron file using the command

    vim /etc/cron.daily/manual_clamscan
  2. Add the following lines in the file /etc/cron.daily/manual_clamscan:

    /usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE

    You need to change SCAN_DIR to the directory that you want to scan.

  3. Set executable permission for the cron script using the command:

    chmod +x /etc/cron.daily/manual_clamscan

To Install ClamAV for cPanel ServersTop

  1. Login to your WHM panel as the root user.

  2. Click the cPanel icon.

  3. Select Manage Plugins. This will bring up a list of additional cPanel modules.

  4. Select the checkbox next to ClamAV Install and Keep Updated.

  5. Submit the settings by clicking Save.

Listed below are some important options for Clamscan:

  • -h, –help: Print help information and exit

  • -v, –verbose: Be verbose

  • -l FILE, –log=FILE: Save scan report to FILE

  • -f FILE, –file-list=FILE: Scan files listed line by line in FILE

  • -r, –recursive: Scan directories recursively. All the subdirectories in the given directory will be scanned. These options can be used multiple times.

  • -i: Print infected files

  • –remove[=yes/no(*)]: Remove infected files

  • –move=DIRECTORY: Move infected files into DIRECTORY. Directory must be writeable for the user or unprivileged user running clamscan.

  • –copy=DIRECTORY: Copy infected files into DIRECTORY. Directory must be writeable for the user or unprivileged user running clamscan.

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Mail limiting via WHM

Contents [Hide] 1. To configure Exim mail server in WebHost Manager 2. Controlling...

Optimizing Apache

The efficiency with which Apache runs with can be greatly improved with a few small tweaks in the...

Installing Cloudlinux and Configuring LVEManager and Cagefs

The process below explains how to install CloudLinux on your server Download the cldeploy...

Installing and configuring Maldet

Contents [Hide] 1. To install Maldet 2. To configure LMD 3. To Scan using Maldet...

CSF Firewall installation and configuration

Contents [Hide] 1. To Install CSF on a Server 2. To Manage CSF 3. Ports and Settings to...