Fonte: https://www.centosblog.com/how-to-install-clamav-and-configure-daily-scanning-on-centos/
1. Install EPEL repo
Before we can do proceed, you must ensure that you have the EPEL yum repository enabled. To do this, click here.
2. Install required ClamAV packages
yum install clamav
yum install clamd
3. Start the clamd service and set it to auto-start
/etc/init.d/clamd on chkconfig clamd on /etc/init.d/clamd start
4. Update ClamAV’s signatures
/usr/bin/freshclam
Note: ClamAV will update automatically, as part of /etc/cron.daily/freshclam.
Configure Daily Scan
In this example, we will configure a cronjob to scan the /home/ directory every day:
1. Create cron file:
1 |
vim /etc/cron.daily/manual_clamscan |
Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan:
1 |
#!/bin/bash |
2 |
SCAN_DIR="/home" |
3 |
LOG_FILE="/var/log/clamav/manual_clamscan.log" |
4 |
/usr/bin/clamscan -i -r $SCAN_DIR >> $LOG_FILE |
Give our cron script executable permissions:
1 |
chmod +x /etc/cron.daily/manual_clamscan |
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.