Free & Best Antivirus for Linux servers is ClamAV. Email scanning, Web scanning and End point security are the few features which help secure your VPS, VDS or Dedicated Linux server. CentOS provides security such that threats are minimal but user actions can expose your server to tojans or virus. ClamAVs engine is capable of detecting 1 million viruses, worms, malware and other threads as claimed by ClamAV itself.
What are the Capabilities of ClamAV?
- ClamAVs database keep updating with latest discovered threads & viruses, with its advanced database updater you are always update to date with latest threats.
- ClamAV scans fast and give you an option to remove infected files on the go.
- Built in archive extraction capabilities scan compressed archives and protect against archive bombs
- Major archive compressions ClamAV supports are : zip, rar, 7zip, gzip, tar, dmg, img, pkg … etc
- for Linux, ClamAV provides real time protection, including ability to block file access until its scanned
- Built in support for all Mail formats
- Built in support for popular document formats including HTML, flash, pdf, MS Office, Mac Office
Video instruction to install ClamAV on centOS
How to install ClamAV on Linux server or centOS
Step by step tutorial to install ClamAV on centOS
Step 01 : ClamAV is not available on centOS default repo, you need to install special package ‘epel’ stands for Extra Packages for Enterprise Linux
yum install -y -q epel-release
Step 02 : Download and install clamAV from epel package
yum --enablerepo=epel -y -q install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd
Step 03 : update config file to replace examples
sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf
sed -i -e "s/^Example/#Example/" /etc/freshclam.conf
sed -i 's/^#LocalSocket \/run\/clamd.scan\/clamd.soc/LocalSocket \/run\/clamd.scan\/clamd.soc/' /etc/clamd.d/scan.conf
Step 04 : Update ClamAV database
freshclam
Step 05: start and enable the services
systemctl start clamav-freshclam.service
systemctl enable clamav-freshclam.service
systemctl enable [email protected]
systemctl start [email protected]
How to scan Linux server with ClamAV?
Ensure ClamAV service is running and execute the following command to scan and remove infected files
clamscan --infected --remove --recursive .
———– SCAN SUMMARY ———–
Known viruses: 8946438
Engine version: 0.102.4
Scanned directories: 4
Scanned files: 8
Infected files: 0
Data scanned: 0.02 MB
Data read: 0.01 MB (ratio 2.00:1)
Time: 24.787 sec (0 m 24 s)
[[email protected] ~]#
How to uninstall ClamAV?
As we have downloaded ClamAV from different repo, lets remove repo and ClamAV both
yum remove epel*
Loaded plugins: fastestmirror
Resolving Dependencies
–> Running transaction check
—> Package epel-release.noarch 0:7-11 will be erased
–> Finished Dependency ResolutionDependencies Resolved
=========================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================
Removing:
epel-release noarch 7-11 @extras 24 kTransaction Summary
=========================================================================================================================================================================
Remove 1 PackageInstalled size: 24 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : epel-release-7-11.noarch 1/1
Verifying : epel-release-7-11.noarch 1/1Removed:
epel-release.noarch 0:7-11Complete!
yum remove clamav*
Loaded plugins: fastestmirror
Resolving Dependencies
–> Running transaction check
—> Package clamav.x86_64 0:0.102.4-1.el7 will be erased
—> Package clamav-data.noarch 0:0.102.4-1.el7 will be erased
–> Processing Dependency: data(clamav) for package: clamd-0.102.4-1.el7.x86_64
—> Package clamav-devel.x86_64 0:0.102.4-1.el7 will be erased
—> Package clamav-filesystem.noarch 0:0.102.4-1.el7 will be erased
—> Package clamav-lib.x86_64 0:0.102.4-1.el7 will be erased
—> Package clamav-update.x86_64 0:0.102.4-1.el7 will be erased
–> Running transaction check
—> Package clamd.x86_64 0:0.102.4-1.el7 will be erased
–> Finished Dependency ResolutionDependencies Resolved
=========================================================================================================================================================================
Package Arch Version Repository Size
=========================================================================================================================================================================
Removing:
clamav x86_64 0.102.4-1.el7 @epel 1.9 M
clamav-data noarch 0.102.4-1.el7 @epel 200 M
clamav-devel x86_64 0.102.4-1.el7 @epel 71 k
clamav-filesystem noarch 0.102.4-1.el7 @epel 25 k
clamav-lib x86_64 0.102.4-1.el7 @epel 2.0 M
clamav-update x86_64 0.102.4-1.el7 @epel 347 k
Removing for dependencies:
clamd x86_64 0.102.4-1.el7 @epel 242 kTransaction Summary
=========================================================================================================================================================================
Remove 6 Packages (+1 Dependent package)Installed size: 204 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : clamav-0.102.4-1.el7.x86_64 1/7
Erasing : clamd-0.102.4-1.el7.x86_64 2/7
Erasing : clamav-devel-0.102.4-1.el7.x86_64 3/7
Erasing : clamav-data-0.102.4-1.el7.noarch 4/7
warning: /var/lib/clamav/daily.cvd saved as /var/lib/clamav/daily.cvd.rpmsave
Erasing : clamav-lib-0.102.4-1.el7.x86_64 5/7
Erasing : clamav-update-0.102.4-1.el7.x86_64 6/7
Erasing : clamav-filesystem-0.102.4-1.el7.noarch 7/7
warning: /etc/clamd.d/scan.conf saved as /etc/clamd.d/scan.conf.rpmsave
Verifying : clamav-update-0.102.4-1.el7.x86_64 1/7
Verifying : clamd-0.102.4-1.el7.x86_64 2/7
Verifying : clamav-0.102.4-1.el7.x86_64 3/7
Verifying : clamav-data-0.102.4-1.el7.noarch 4/7
Verifying : clamav-devel-0.102.4-1.el7.x86_64 5/7
Verifying : clamav-filesystem-0.102.4-1.el7.noarch 6/7
Verifying : clamav-lib-0.102.4-1.el7.x86_64 7/7Removed:
clamav.x86_64 0:0.102.4-1.el7 clamav-data.noarch 0:0.102.4-1.el7 clamav-devel.x86_64 0:0.102.4-1.el7 clamav-filesystem.noarch 0:0.102.4-1.el7
clamav-lib.x86_64 0:0.102.4-1.el7 clamav-update.x86_64 0:0.102.4-1.el7Dependency Removed:
clamd.x86_64 0:0.102.4-1.el7Complete!

Technical content writer at 9to5host.com, Linux is Life 😉