Centos7 installs clamAV antivirus software

Abstract: the record mainly comes from a record of colleagues. At present, the original blogger has been deleted and re recorded by himself.

It's better to link to clamAV's official website address. Although I can't understand it, I can't find the corresponding installation document https://www.clamav.net/

Auto install clamAv

1. Install clamAV client

yum install clamav

This step may result in an error

[root@localhost admin]# yum install clamav
//Loaded plug-ins: faststmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                                     | 3.6 kB  00:00:00     
extras                                                                                                                                                                                                   | 2.9 kB  00:00:00     
gitlab_gitlab-ee/x86_64/signature                                                                                                                                                                        |  862 B  00:00:00     
gitlab_gitlab-ee/x86_64/signature                                                                                                                                                                        | 1.0 kB  00:00:00 !!! 
gitlab_gitlab-ee-source/signature                                                                                                                                                                        |  862 B  00:00:00     
gitlab_gitlab-ee-source/signature                                                                                                                                                                        |  951 B  00:00:00 !!! 
updates                                                                                                                                                                                                  | 2.9 kB  00:00:00     
//There is no package clamav available.
//Error: no processing required

This problem needs to be solved by executing another command.

yum install -y epel-release
yum install clamav

During installation, you will be asked if you agree. Enter y and press enter

Dependency resolution

================================================================================================================================================================================================================================
 Package schema version source size
================================================================================================================================================================================================================================
Installing:
 clamav                                                       x86_64                                            0.102.3-1.el7                                             epel                                            444 k
 Install for dependency:
 clamav-filesystem                                            noarch                                            0.102.3-1.el7                                             epel                                             39 k
 clamav-lib                                                   x86_64                                            0.102.3-1.el7                                             epel                                            796 k
 clamav-update                                                x86_64                                            0.102.3-1.el7                                             epel                                            124 k
 libprelude                                                   x86_64                                            5.1.1-1.el7                                               epel                                            308 k

Transaction summary
================================================================================================================================================================================================================================
Install 1 package (+ 4 dependent packages)

Total downloads: 1.7m
 Installation size: 6.3 M
Is this ok [y/d/N]: 


2. With customers, you can perform scanning and other operations. If you need to run it as a service in the background, you need to install the server;
yum install clamav-server-systemd

There will also be a query process. Enter y and enter


3. Edit / etc/clamd.d/scan.conf Configuration file, comment out Example, and set tcp
The port is released, and "เท" in the configuration file indicates a comment

vi /etc/clamd.d/scan.conf

Comment out Example

# Comment or remove the line below.
#Example

Uncomment TCPSocket

# TCP port address.
# Default: no
TCPSocket 3310

After modification, save to exit


4. Update the virus library. This operation requires connecting to the external network. Please ensure that the network connection is normal first;

freshclam

5. Start the scan service. This operation is only valid this time. After the system is restarted, the service will not start. Start it

systemctl start clamd@scan.service

If there is no error, it means success


6. Check the service running status,
The figure below shows that it is running;

systemctl status clamd@scan.service

The operation results are as follows

[root@localhost admin]#  systemctl status clamd@scan.service
โ— clamd@scan.service - clamd scanner (scan) daemon
   Loaded: loaded (/usr/lib/systemd/system/clamd@.service; disabled; vendor preset: disabled)
   Active: active (running) since Day 2020-06-28 08:49:25 CST; 9s ago
     Docs: man:clamd(8)
           man:clamd.conf(5)
           https://www.clamav.net/documents/
  Process: 31288 ExecStart=/usr/sbin/clamd -c /etc/clamd.d/%i.conf (code=exited, status=0/SUCCESS)
 Main PID: 31308 (clamd)
   CGroup: /system.slice/system-clamd.slice/clamd@scan.service
           โ””โ”€31308 /usr/sbin/clamd -c /etc/clamd.d/scan.conf

6 August 28:49:22 localhost.localdomain clamd[31308]: ELF support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: Mail files support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: OLE2 support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: PDF support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: SWF support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: HTML support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: XMLDOCS support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: HWP3 support enabled.
6 August 28:49:22 localhost.localdomain clamd[31308]: Self checking every 600 seconds.
6 August 28:49:25 localhost.localdomain systemd[1]: Started clamd scanner (scan) daemon.

7. Set scan service to power on

systemctl enable clamd@scan.service

Tags: EPEL yum network

Posted on Sat, 27 Jun 2020 21:15:53 -0400 by sleightofhand