clamav remote antivirus service installation

tags: Safety  centos  clamav

background knowledge:

As an open source anti-virus program, clamav can directly perform regular anti-virus scans on local files, or start anti-virus services. The remote program calls the service to transfer the files and returns whether they are viruses after scanning. It can be used after files are uploaded in the business system. Call up remote scanning to achieve the purpose of embedding in the business system.

clamav installation:

1. Download the program

The version used here is 0.102.3

download link:

#Create program directory
mkdir /usr/local/clamav
cd /usr/local/clamav
 #Upload the downloaded program file to /usr/local/clamav

2、Installation dependencies

yum install gcc openssl openssl-devel  -y
yum install gcc gcc++ 
yum install gcc gcc-c++ gcc-g77 
yum install curl-devel

3. Upgrade libcurl

I encountered the following error during the installation process: Your libcurl (e.g. libcurl-devel) is too old. Installing ClamAV with clamonacc requires libcurl 7.45 or higher. Need to upgrade libcurl.

#Install repo
rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/rhel7/x86_64/city-fan.org-release-2-1.rhel7.noarch.rpm
 #View the curl version contained in the repo
yum --showduplicates list curl --disablerepo="*" --enablerepo="city*"
 #Modify the enable of the repo to 1
vi /etc/yum.repos.d/city-fan.org.repo
 #enabled=0 Change to enabled=1
 #Install the latest curl
yum install curl
yum install epel-release -y
yum --enablerepo=epel install libnghttp2 -y && yum install libcurl -y

4. Compile and install

#clamavUsers and user groups
groupadd clamav && useradd -g clamav clamav && id clamav

 #Log storage directory
mkdir -p /usr/local/clamav/logs     
touch /usr/local/clamav/logs/clamd.log
touch /usr/local/clamav/logs/freshclam.log
chown clamav.clamav /usr/local/clamav/logs/clamd.log
chown clamav.clamav /usr/local/clamav/logs/freshclam.log

 #Virus inventory list
mkdir -p /usr/local/clamav/updata
chown -R root.clamav /usr/local/clamav/
chown -R clamav.clamav /usr/local/clamav/updata/

 #Unzip the installation package
tar xf clamav-0.102.3.tar.gz

 #Compile and install
cd clamav-0.102.3
./configure --prefix=/usr/local/clamav  --with-pcre
make && make install

5. Configure clamav

cd /usr/local/clamav/etc
cp clamd.conf.sample clamd.conf
cp freshclam.conf.sample freshclam.conf

vi freshclam.conf
 #Example Comment out this line. 
 # Add the following configuration
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid

vi clamd.conf
 #Example Comment out this line. 
 # Add the following configuration
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid
TCPSocket 3310
TCPAddr 192.168.31.193
 #TCPAddr is the address of the listening service

6. Download (update) virus database file

#Direct update
/usr/local/clamav/bin/freshcla

 #Manual download
cd /usr/local/clamav/updata/
wget http://database.clamav.net/main.cvd
wget http://database.clamav.net/daily.cvd
wget http://database.clamav.net/bytecode.cvd

7. Start the clamav-daemon service

#Permission
chown -R clamav.clamav /usr/local/clamav/

 #Start clamav-freshclam service
systemctl start clamav-freshclam.service
systemctl enable clamav-freshclam.service 
systemctl status clamav-freshclam.service
systemctl stop clamav-freshclam.service 


 #Need to place the virus database file in the /usr/local/clamav/share/clamav directory
 #Start remote service
systemctl start clamav-daemon.service
systemctl enable clamav-daemon.service

 #View status
systemctl status clamav-daemon.service

 #stop 
systemctl stop clamav-daemon.service 


 #Check if port 3310 is listening
netstat -tunlp | grep 3310

 #Scan individual files command
/usr/local/clamav/bin/clamscan file.zip
8. Start the clamav-rest service

download link:

Modify the program entry configuration

Test after starting the service:

Virus file:

Non-virus files:

Intelligent Recommendation

Linux install clamav antivirus

1. Installation centOS ubuntu View version Update virus signature database Scan for viruses --remove remove -l log directory...

clamav antivirus software deployment

Recently, I have to go through the level of protection, and the linux server has to build anti-virus software. . . Website: http://www.clamav.net step 0 install zlib    step 1: Clamav downlo...

Linux CLAMAV antivirus

Articles directory Foreword 1. CLAMAV installation Second, anti -virus Summarize Foreword Rarely contact Linux anti -virus, there are many Linux antivirus software, this article uses CLAMAV antivirus....

clamav antivirus tool under linux

ClamAV antivirus platform for Linux is the most popular anti-virus software, free and open source ClamAV belong products support a variety of platforms such as: Linux / Unix, MAC OS X, Windows, OpenVM...

linux clamav antivirus scan virus

Install clamav Download virus database https://www.clamav.net/downloads 3 files uploaded to /var/lib/clamav Recursive scan Root directory -ri /, the result is written to -l /clamav.log, directly delet...

More Recommendation

Centos7 install clamAV antivirus software

Summary:The record is mainly derived from a record of a colleague. The original blogger has deleted it, so please re-record it yourself. Still link to the clamAV official website address, although I c...

Install ClamAV antivirus software on Linux

CentOS 8 Reference article:https://linux-audit.com/install-clamav-on-centos-7-using-freshclam/ Install clamav using yum Modify the scan configuration file Mainly modify the following lines: After spec...

Linux Installing Antivirus Software Clamav

Install:https://www.clamav.net/documents/installing-clamav Use documentation:https://www.clamav.net/documents/scanning#clamscan...

CentOS6 host security hardening strategy Clamav antivirus software (1) source code installation configuration

Brief description: Source installation: Deploy and install the two cloned experimental hosts Support packages required are: zlib zlib-devel openssl openssl-devel (that is, libssl-devel) gcc gcc-c++ ma...

CentOS6 host security hardening strategy Clamav antivirus software (2) YUM installation configuration

Brief description: Server host deployment: 1° Install using YUM source: 2° Check which components are installed in the three installation packages: 3° configuration start: Client host conf...

Copyright  DMCA © 2018-2023 - All Rights Reserved - www.programmersought.com  User Notice

Top