ClamAV is an mở cửa source antivirus tool.

Bạn đang xem: How to install clamav on centos 7

Its basic usage is for detecting viruses, malware, and malicious software on Linux-based machines. The threat from viruses, Trojans, and other forms of malware is real. They have grown exponentially in both quantity & in sophistication, và antivirus software have had to adopt sophisticated detection methods. While there"s no guarantee that your system will not fall victim lớn these unwanted bits of code, remaining mindful when using the Internet và sharing files, implementing common-sense security policies, và using an up-to-date antivirus program can go a long way in protecting you.

This article will show you how to install and configure ClamAV on CentOS 7 & CentOS 8. I have also added some tips for Ubuntu.


clamd service status

6. Configure periodic scan using clamdscan (Optional)

You can follow this step if you wish khổng lồ configure tự động hóa scan of any directory as by default you will have lớn initiate manual scan.

Xem thêm: Tải Knights Of Valour Classic Arcade Game Cho Máy Tính Pc Windows Phiên Bản Mới Nhất

We will create a new systemd service unit file :

# mèo /etc/systemd/system/clamdscan-home.serviceDescription=ClamAV vi khuẩn scanRequires=clamd.serviceAfter=clamd.serviceExecStart=/usr/bin/clamdscan /

To perform a periodic scan we also need a mapping timer unit file. Here I have added time value of 18:40 to start the scan:

# cat /etc/systemd/system/clamdscan-home.timerDescription=Scan /home directory using

Next enable & start the timer

# systemctl enable clamdscan-home.timer --nowCreated symlink /etc/systemd/system/ → /etc/systemd/system/clamdscan-home.timer.We don"t need lớn start the service unit tệp tin as it will be controlled by the timer file

Now we monitor the journalctl logs at 18:40 PM

Sep 05 18:40:05 systemd<1>: Started ClamAV virus scan.Sep 05 18:40:17 clamdscan<10901>: /home: OKSep 05 18:40:17 clamdscan<10901>: ----------- SCAN SUMMARY -----------Sep 05 18:40:17 clamdscan<10901>: Infected files: 0Sep 05 18:40:17 clamdscan<10901>: Time: 11.725 sec (0 m 11 s)

7. Perform manual scan with clamscan

For a test scan of the current folder, we run the following command:

# clamscan --infected --remove --recursive ./----------- SCAN SUMMARY -----------Known viruses: 6702413Engine version: 0.100.2Scanned directories: 7Scanned files: 9Infected files: 0Data scanned: 0.01 MBData read: 0.00 MB (ratio 2.00:1)Time: 25.439 sec (0 m 25 s)


infected: prints only infected filesremove: removes infected filesrecursive: all the sub-directories in the provided directory will also be scanned


In this tutorial we learned about ClamAV scanner & it"s configuration in Linux. With different version of clamav the stepsof configuration seems to lớn be changing. As I am more comfortable with systemd, I have used the same to lớn demonstrate all the steps in this tutorial but you are free to write custom scripts with crond to perform auto scan and tự động update of the freshclam database.

Lastly I hope the steps from the article khổng lồ configure ClamAV on Ubuntu, CentOS 7 & CentOS 8 Linux was helpful. So, let me know your suggestions and feedback using the comment section.


I have used below external references for this tutorial guideman page for systemd timer