Install Linux Malware Detect and ClamAV on CentOS: A Malware Scanner for Linux Operating System

 

 

 

A VPS server can be easily scanned for malware and viruses with Linux Malware Detect and ClamAV. In this tutorial, we’ll install both programs on CentOS and test them out.

 

 

 

 

 

So let’s get started,

 

 

 

 

 

Step 1: Install Linux Malware Detect

 

 



 

Run the following command to install Linux Malware Detect

 

 

 

wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
tar -xvf maldetect-current.tar.gz
cd maldetect-1.6.2
./install.sh

 

 

A cronjob task will be automatically created by Linux Malware Detect after the installation is complete.

 

 

 

 

 

 

Step 2: Configure Linux Malware Detect

 

 



 

All configuration settings of Linux Malware Detect are stored in the file /usr/local/maldetect/conf.maldet

 


# Enable Email Alerting
email_alert=1
# Email Address in which you want to receive scan reports
[email protected]
# Email subject of the notification.
email_subj="Malware alerts for $HOSTNAME - $(date +%Y-%m-%d)"
# Move the malware to quarantine.
quar_hits=1
# Delete any malware detected.
quar_clean=1
# Use ClamAV's malware library to scan.
clamav_scan=1

 

 

 

 

 

Step 3: Install ClamAV

 

 

 

 

 

The EPEL repository must first be installed:

 

 

yum install epel-release

 

 

 

Next, we install ClamAV using the following command:

 

 

yum update && yum install clamav

 

 

 

 

Here’s how to use Linux Malware Detect

 

 

 

Using Linux Malware Detect, you can scan your system for malware after the installation process is complete,

 

 

 

 

The following command will scan a folder:

 

 

maldet --scan-all /home/domain.com/public_html

 

 

 

If you only want to scan some specified file types (.php for example), you can use the following command:

 

maldet --scan-all /home/domain.com/public_html/*.php



To view a scanning report, use the following command. Replace 17625-1711.5619 with the scan ID.

 

 

maldet --report 17625-1711.5619

 

 

To update Linux Malware Detect, run the following commands:



maldet -u

 

 

 

For a complete deletion of all quarantined files:



rm -rf /usr/local/maldetect/quarantine/*

 

 

 

 

 

Try VPSie for free today!

 

 

 

 

 

 

Get the most out of learning with VPSie.com