Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install ClamAV on a VPS or dedicated server

This guide shows you how to add ClamAV, a free virus scanner, to your server. It needs root access.

cPanel2 min read6 steps10 screenshots

Root access needed. Root is the all-powerful admin user on a server. VPS and dedicated server customers have it. Be careful: root can change or delete anything.

What is ClamAV?

A VPS is a private slice of a big computer. A dedicated server is a whole computer just for you. ClamAV is a free antivirus program for these servers. It scans files for viruses and malware. Malware is software made to cause harm.

It is often used to check uploaded files and emails. It does not fix a hacked site by itself. It finds bad files so you can deal with them.

Before you start

  • Take a backup of your server or important data.
  • Have your root login ready. It is in your welcome email, or you can ask Hostvento support.
  • Find out if your server runs cPanel & WHM. WHM is the admin panel for the server owner.

Method 1: With WHM (cPanel servers)

  1. Log in to WHM as root. The address and login are in your welcome email.
    Screenshot: Log in to WHM as root. The address and login are in your welcome email.
  2. In the search box on the left, type Manage Plugins.
  3. Click Manage Plugins.
    Screenshot: Click Manage Plugins .
  4. Find cPanel ClamAV Connector in the list.
    Screenshot: Find cPanel ClamAV Connector in the list.
    Screenshot: Find cPanel ClamAV Connector in the list.
    Screenshot: Find cPanel ClamAV Connector in the list.
    Screenshot: Find cPanel ClamAV Connector in the list.
  5. Tick Install next to it. Also tick Install and Keep Updated if offered.
  6. Click Save and wait for it to finish.

After that, cPanel users can scan their files from cPanel. Look for Virus Scanner under the Advanced section.

Method 2: With the command line (no panel)

The command line is a screen where you type commands. Connect with SSH, a safe way to reach your server from afar. Then run the commands for your system.

On AlmaLinux, Rocky Linux or CentOS:

dnf install epel-release -y
dnf install clamav clamd clamav-update -y

These add an extra software source, then install ClamAV. On older CentOS, use yum in place of dnf.

On Ubuntu or Debian:

Screenshot: On Ubuntu or Debian:
apt update
apt install clamav clamav-daemon -y

These refresh the software list and install ClamAV.

Update the virus list

ClamAV needs a list of known viruses. Update it with:

Screenshot: ClamAV needs a list of known viruses. Update it with:
freshclam

This downloads the newest virus list. If it says another process is running, wait a minute and try again.

Run a scan

clamscan -r -i /home

This scans the /home folder and everything inside it. It prints only infected files.

Tip: Scans use a lot of memory and CPU. Run them when your site is quiet. Do not delete flagged files without checking them.

Quick recap

  • ClamAV is a free virus scanner for servers.
    Screenshot: ClamAV is a free virus scanner for servers.
    Screenshot: ClamAV is a free virus scanner for servers.
  • You need root access.
  • On cPanel, install it from WHM under Manage Plugins.
  • Without a panel, install it with dnf or apt.
  • Run freshclam to update, then clamscan to scan.