How To Install ClamAV On CentOS Stream 10
To install ClamAV on CentOS Stream 10, follow these steps :
1. Update Your System.
Ensure your system is up to date :
sudo dnf update -y
2. Install EPEL Repository.
ClamAV is available through the Extra Packages for Enterprise Linux (EPEL) repository :
sudo dnf install epel-release -y
3. Install ClamAV Packages.
Install the necessary ClamAV packages :
sudo dnf install clamav clamav-server clamav-data clamav-update clamav-filesystem clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y
4. Configure SELinux (If Enabled).
If SELinux is enabled, adjust its settings to allow ClamAV to function properly :
sudo setsebool -P antivirus_can_scan_system 1
sudo setsebool -P clamd_use_jit 1
5. Configure ClamAV.
Modify ClamAV configuration files :
sudo sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf
sudo sed -i -e "s/#LocalSocket \/var\/run\/clamd.scan\/clamd.sock/LocalSocket \/var\/run\/clamd.scan\/clamd.sock/" /etc/clamd.d/scan.conf
sudo sed -i -e "s/^Example/#Example/" /etc/freshclam.conf
6. Update Virus Definitions.
Download the latest virus definitions :
sudo freshclam
7. Enable and Start Services.
Enable and start the ClamAV services :
sudo systemctl enable clamd@scan
sudo systemctl start clamd@scan
sudo systemctl enable freshclam
sudo systemctl start freshclam
8. Perform a Manual Scan.
To scan a specific file or directory :
clamscan /path/to/file_or_directory
For recursive scanning :
clamscan -r /path/to/directory
9. Automate Scans with Cron.
Schedule daily scans by creating a cron job :
echo "0 0 * * * /usr/bin/clamscan -i -r /home >> /var/log/clamav/clamscan.log" | sudo tee /etc/cron.daily/manual_clamscan
Make the script executable :
sudo chmod +x /etc/cron.daily/manual_clamscan
Tags :