clamav杀毒软件部署
程序员文章站
2022-05-27 13:32:12
...
最近要过等级保护,linux 服务器也要搞个杀毒软件 醉了。。。
网址:http://www.clamav.net
step 0安装zlib
wget http://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.7/zlib-1.2.7.tar.gz
tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make
make install
step 1:Clamav下载
wget http://www.clamav.net/downloads/production/clamav-0.99.2.tar.gz
step 2:创建clamav用户和组
groupadd clamav
useradd -g clamav clamav
step 3:编译&安装
tar xf clamav-0.99.2.tar.gz
cd clamav-0.99.2
./configure --prefix=/usr/local/clamav
&&make&&makeinstall
step4 :配置
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 clamav 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
cd /usr/local/clamav/etc
cp clamd.conf.sample clamd.conf
cp freshclam.conf samplefreshclam.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
step 5 升级病毒库 更新时间较久
/usr/local/clamav/bin/freshclam
手工更新 下载病毒库至
/usr/local/clamav/updata
/usr/local/clamav/bin/clamscan--remove(查杀当前目录并删除感染的文件)
step 6:计划任务
一般使用计划任务,让服务器每天晚上定时跟新和定时杀毒。
yum install crontabs -y
/sbin/service crond start #启动服务
/sbin/service crond stop #关闭服务
/sbin/service crond restart #重启服务
/sbin/service crond reload #重新载入配置
chkconfig crond on #开机启动centos6
systemctl enable crond.service//开机启动centos7
crontab-e
1 3 * * * /usr/local/clamav/bin/freshclam 更新杀毒软件
3 03 * * * /usr/local/clamav/bin/clamscan --infected -r / --remove-l/var/log/clamscan.log 查找及删除保存到日志