Thursday , November 21 2024

How to Install ClamAV and Configure Daily Scanning on CentOS

ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. This article will guide you through the installation of ClamAV on CentOS. Once installed, we will also configure a daily scan on our CentOS server.

A. Install ClamAV

1. Install EPEL repo

Before we can do proceed, you must ensure that you have the EPEL yum repository enabled.

The EPEL repo is enabled by simply installing an RPM. Please use the command below to install the EPEL repository on your CentOS server.

CentOS 6 – 32-bit
CentOS 6 – 64-bit
 CentOS 5 – 32-bit
 CentOS 5 – 64-bit
After running the above commands for your relevant CentOS version, the following file is created:
The above file can be edited directly to enable or disable the EPEL repo.

2. Install required packages

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

4. Update ClamAV’s signatures

or

Note: ClamAV will update automatically, as part of /etc/cron.daily/freshclam.

B. Configure Daily Scan

In this example, we will configure a cronjob to scan the /home/ directory every day:

1. Create cron file:

Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan:

Or following if you want to send mail:

Note: clamscan exists in /usr/bin/clamscan or /usr/local/bin/clamscan

1. Give our cron script executable permissions:

You can even run the above script to ensure that it works correctly.

And you’re done! That should be the minimum required to 1. install ClamAV and 2. Perform a daily scan of a specific directory.

About Ngo Thang IT

Check Also

login ssh root password vps google cloud

Cách đăng nhập SSH root bằng mật khẩu trên VPS Google Cloud

Xin chào, bạn đã tạo được VPS (VM Instance) trên Google Cloud nhưng muốn đăng …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Đăng Ký Nhận Tin Qua Email

Nhận thông tin bổ ích về WordPress, Hosting, Thủ thuật website, Download miễn phí....và các phần quà hấp dẫn qua email.

* là bắt buộc