Linux下杀毒软件clamav0.104.2离线安装及测试(CentOS7)
目录
本文主要是讲解如何在 Linux 环境下离线安装以及测试杀毒软件 clamav 0.104.2(以CentOS7为例),包括下载安装、配置参数和运行。
版权声明:本文为博主原创文章,遵循 CC BY-NC-SA 4.0 版权协议,禁止商用,转载请附上原文出处链接和本声明。
1.下载安装
clamav 官网下载 clamav-0.104.2.linux.x86_64.rpm
将该文件上传至服务器,安装命令如下:
|
|
2. 配置
-
添加用户组和组成员
1 2
groupadd clamav useradd -g clamav clamav
-
创建日志目录和病毒库目录
1 2
mkdir -p /usr/local/clamav/logs mkdir -p /usr/local/clamav/update
-
创建日志文件
1 2
touch /usr/local/clamav/logs/clamd.log touch /usr/local/clamav/logs/freshclam.log
-
文件授权
1 2 3
chown clamav:clamav /usr/local/clamav/logs/clamd.log chown clamav:clamav /usr/local/clamav/logs/freshclam.log chown clamav:clamav /usr/local/clamav/update
-
修改配置文件
1 2
cp /usr/local/clamav/etc/clamd.conf.sample /usr/local/clamav/etc/clamd.conf cp /usr/local/clamav/etc/freshclam.conf.sample /usr/local/clamav/etc/freshclam.conf
文件1:clamd.conf
1
vim /usr/local/clamav/etc/clamd.conf
1 2 3 4 5
#Example //注释掉这一行 #添加以下内容 LogFile /usr/local/clamav/logs/clamd.log PidFile /usr/local/clamav/update/clamd.pid DatabaseDirectory /usr/local/clamav/update
文件2:freshclam.conf
1
vim /usr/local/clamav/etc/freshclam.conf
1 2 3 4 5
#Example //注释掉这一行 #添加以下内容 DatabaseDirectory /usr/local/clamav/update UpdateLogFile /usr/local/clamav/logs/freshclam.log PidFile /usr/local/clamav/update/freshclam.pid
将这两个文件复制一下:
1
cp /usr/local/clamav/etc/*.conf /usr/local/etc/
3. 运行
-
下载病毒库文件并上传到目录 /usr/local/clamav/update
main.cvd daily.cvd bytecode.cvd
注:也可以在有网络的机器上运行如下命令更新病毒库:
1
/usr/local/clamav/bin/freshclam
-
配置库文件路径
1
vim /etc/ld.so.conf
追加一行:
1
/usr/local/clamav/lib64
更新生效:
1
ldconfig
如果最后运行时仍然报错:
1
clamscan: error while loading shared libraries: libclamav.so.9: cannot open shared object file: No such file or directory
则说明配置没有生效。
-
创建命令软件链接
1
ln -s /usr/local/clamav/bin/clamscan /usr/local/bin/clamscan
-
运行使用
1
clamscan -r
-
卸载程序
1
rpm remove clamav