Knowledgebase

Scan CentOS server for viruses and malware

Introduction

Some unexpected behavior on a Linux server can be caused by a malware infection. Scanning your server for malware, viruses and other unwanted software can help identify problems - or at least give you the peace of mind for having a clean server.

There are multiple options for making sure your cloud server is clean of any malware, in this guide, we will teach you how to scan your server with ClamAV.

Installation

First, make sure your server is up to date:

yum update -y

If your server is up to date, you can install ClamAV:

yum install clamav clamav-update clamav-scanner-systemd clamav-server-systemd -y

If you get the error message "Unable to find a match", you need to install epel-release on the server:

yum install epel-release -y

After installation, please enable and start ClamAV:

systemctl enable --now clamav-freshclam

The following command allows you to update the virus database on your server:

freshclam

To scan your home directory, you can use this command:

clamscan -r /home

To scan the entire server (root partition) you can use this command:

clamscan -r /

If you have any questions, please do not hesitate to contact us.

Was this answer helpful?

 Print this Article

Also Read

Mail servers on Cloud VPS

At SpectraIP, the reputation of our network and IP addresses is very important and we are...

Getting started with One-click LEMP stack (Nginx with PHP and MariaDB)

Introduction SpectraIP's one-click LEMP application is an easy way to deploy web applications on...

Reset lost root password dedicated server (in rescue mode)

Resetting the root password in rescue mode is a useful procedure if you've forgotten the root...