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.
ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. In this article, we will only be configuring ClamAV to run scheduled/on-demand scans; not resident scans.
A. Install ClamAV
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.
CentOS 6 – 32-bit
CentOS 6 – 64-bit
1 | rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm |
2. Install required packages
yum install clamav clamd clamav-devel
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.更新病毒库,并设置为定时任务.freshclam -v #chown search:search /etc/clamav.conf #chown -R searcha:search /var/lock/subsys/clamd6.#chown -R searcha:search /var/run/clamav#chown -R searcha:search /var/clamav
freshclam >> /tmp/clamavfresh.log
5.下载python库 clamd-1.0.1.zip解压,进入目录,执行$ ./setup.py install
6.进入python命令行模式.pythonimport clamdfrom six import BytesIO as bi
cd = clamd.ClamdNetworkSocket('127.0.0.1',3310)cd.instream(bi(clamd.EICAR))
from six import BytesIO as bi#