QQ登录

只需一步,快速开始

登录 | 立即注册 | 找回密码

熊天琪游戏论坛 - 玩出名堂

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13|回复: 0

[文本教程] Centos7安装杀毒软件ClamAV

[复制链接]
发表于 2017-10-2 02:04:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
Clam AntiVirus(ClamAV)是免费而且开放源代码的防毒软件,软件与病毒码的更新皆由社群免费发布。目前ClamAV主要是使用在Linux、FreeBSD等Unix-like系统架设的邮件服务器上,提供电子邮件的病毒扫描服务.

安装EPEL源
()
Clamav可以通过EPEL源来安装,所以要首先安装EPEL,可以采用两种方法来安装:
第一种,通过命令行安装
[root@server_for_product ~]# yum install epel-release
第二种,使用下载好的安装包进行安装
[root@server_for_product ~]# cd /tmp
[root@server_for_product tmp]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
ls *.rpm
[root@server_for_product tmp]# yum install epel-release-7.noarch.rpm

刷新安装源并查看是否已经安装
[root@server_for_product ~]# yum repolist
看到以下字样就代表安装完成
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64
查看EPEL源含有的安装包
[root@server_for_product ~]# yum --disablerepo="*" --enablerepo="epel" list available | less

安装ClamAV
在安装了EPEL源后,运行下面的命令安装ClamAV
[root@server_for_product ~]# yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y

在两个配置文件/etc/freshclam.conf和/etc/clamd.d/scan.conf中移除“Example”字符
[root@server_for_product ~]#sed -i -e “s/^Example/#Example/” /etc/freshclam.conf
[root@server_for_product ~]#sed -i -e “s/^Example/#Example/” /etc/clamd.d/scan.conf

手动更新病毒库
[root@server_for_product ~]# freshclam

顺便一提,freshclam命令通过文件/etc/cron.d/clamav-update来自动运行,该文件的内容
## Adjust this line...
MAILTO=root
## It is ok to execute it as root; freshclam drops privileges and becomes
## user 'clamupdate' as soon as possible
0 */3 * * * root /usr/share/clamav/freshclam-sleep

但默认情况下是禁止了自动更新功能,需要移除文件/etc/sysconfig/freshclam最后一行的配置才能启用
## Adjust this line...
MAILTO=root
## It is ok to execute it as root; freshclam drops privileges and becomes
## user 'clamupdate' as soon as possible
0 */3 * * * root /usr/share/clamav/freshclam-sleep
[root@server_for_product kylin]# ^C
[root@server_for_product kylin]# tail /etc/sysconfig/freshclam
## This option accepts two special values:
## 'disabled-warn' ... disables the automatic freshclam update and
## gives out a warning
## 'disabled' ... disables the automatic freshclam silently
# FRESHCLAM_DELAY=
### !!!!! REMOVE ME !!!!!!
### REMOVE ME: By default, the freshclam update is disabled to avoid
### REMOVE ME: network access without prior activation
FRESHCLAM_DELAY=disabled-warn # REMOVE ME
记得移除上面红色字体。

定义服务器类型(本地或者TCP),在这里定义为使用本地socket,将文件/etc/clam.d/scan.conf中的这一行前面的注释符号去掉:
#LocalSocket /var/run/clamd.scan/clamd.sock

配置开机启动
[root@server_for_product ~]# systemctl enable clamd@scan
[root@server_for_product ~]# ln -s ‘/usr/lib/systemd/system/clamd@scan.service’ ‘/etc/systemd/system/multi-user.target.wants/clamd@scan.service’

启动并检查服务状态
[root@server_for_product ~]# systemctl start clamd@scan
[root@server_for_product ~]# systemctl status clamd@scan
看到active字样就表示安装成功。

备注
如果在手动更新病毒库的时候遇到错误:Update failed. Your network may be down or none of the mirrors listed in freshclam.conf is working.
此时就要删除掉旧的镜像地址文件
[root@server_for_product ~]# rm -f /var/lib/clamav/mirrors.dat
再手动更新一次病毒库
[root@server_for_product ~]# freshclam
[table=98%][/table]
熊天琪的论坛真是太好啦, 我太喜欢熊天琪啦
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Loading...

QQ|小黑屋|Archiver|手机版|熊天琪 ( 鄂ICP备14006674号,鄂公网安备42020502000003号 

安全联盟

GMT+8, 2017-10-18 13:40 , Processed in 0.113451 second(s), 28 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表