1.下载安装包
wget https://clamav-site.s3.amazonaws.com/production/release_files/files/000/000/392/original/clamav-0.100.0.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIY6OSGQFGUNJQ7GQ%2F20180607%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180607T032127Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=0348774f89ab0905305738a1238c1e9e26ffeb3d7d7f634beda2bef1c3b6740e
2.创建用户
groupadd clamav
useradd -g clamav clamav
3.解压并安装
tar xf clamav-0.100.0.tar.gz
cd clamav-0.100.0/
yum install gcc openssl openssl-devel -y
./configure --prefix=/usr/local/clamav
make && make install
4.创建目录
mkdir /usr/local/clamav/logs (日志存放目录)
touch /usr/local/clamav/logs/clamd.log
touch /usr/local/clamav/logs/freshclam.log
mkdir /usr/local/clamav/updata (clanav 病毒库目录)
chown -R root.clamav /usr/local/clamav/
chown -R clamav.clamav /usr/local/clamav/updata/
chown clamav.clamav /usr/local/clamav/logs/clamd.log
chown clamav.clamav /usr/local/clamav/logs/freshclam.log
5.配置
cd /usr/local/clamav/etc
cp clamd.conf.sample clamd.conf
cp freshclam.conf.sample freshclam.conf
vi clamd.conf
#Example 注释掉这一行.
LogFile /usr/local/clamav/logs/clamd.log
PidFile /usr/local/clamav/updata/clamd.pid
DatabaseDirectory /usr/local/clamav/updata
vi freshclam.conf
#Example 注释掉这一行.
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid
6.升级病毒库
/usr/local/clamav/bin/freshclam
7.
/usr/local/clamav/bin/clamscan --remove 查杀当前目录并删除感染的文件
8.计划任务
实际生产环境应用
使用计划任务,让服务器每天晚上定时跟新和定时杀毒。保存杀毒日志,我的crontab文件如下
1 3 * ** /usr/local/clamav/bin/freshclam
30 3 * * * /usr/local/clamav/bin/clamscan --infected -r / --remove -l /var/log/clamscan.log