clamav的安装配置
Clamav杀毒软件的安装与配置
描述:
安装clamav杀毒软件,并在贵州节点上扫描查杀看是否存在病毒。
编译ClamAV时应包括zlib库,用于压缩和解压缩函数
1. 系统环境:centos6.4
软件:zlib-1.2.7.tar.gz clamav-0.97.6.tar.gz
软件下载地址:
http://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.7/zlib-1.2.7.tar.gz
http://nchc.dl.sourceforge.net/project/clamav/clamav/0.97.6/clamav-0.97.6.tar.gz
2.安装
[root@ts181test]#wgethttp://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.7/zlib-1.2.7.tar.gz
[root@ts181test]#wget
http://nchc.dl.sourceforge.net/project/clamav/clamav/0.97.6/clamav-0.97.6.tar.gz
2.1 zlib的安装
[root@ts181 test]# tar xfzlib-1.2.7.tar.gz
[root@ts181 test]# cd zlib-1.2.7
[root@ts181 zlib-1.2.7]# ./configure
[root@ts181 zlib-1.2.7]# make &&make install
[root@ts181 zlib-1.2.7]# cd ..
2.2 添加用户
添加用户组clamav和组成员clamav(注:在安装clamav-0.97.6.tar.gz前必须先添加用户)
[root@ts181 test]# groupadd clamav
[root@ts181 test]# useradd -g clamav -s/bin/false -c "Clam AntiVirus" clamav
2.3 clamav安装
[root@ts181 test]# tar xfclamav-0.97.6.tar.gz
[root@ts181 test]# cd clamav-0.97.6
[root@ts181 clamav-0.97.6]# ./configure--prefix=/opt/clamav --disable-clamav
[root@ts181 clamav-0.97.6]# make&& make install
3. 配置
3.1 创建目录
mkdir /opt/clamav/logs (日志存放目录)
mkdir /opt/clamav/updata (clanav 病毒库目录)
3.2 创建文件:
在/var/log目录下添加两个logs文件:clamd.log和freshclam.log,将所有者改为新加的clamav用户,并设置相应的文件读写权限
touch /opt/clamav/logs/freshclam.log
touch /opt/clamav/logs/clamd.log
3.3 配置/etc/clam.conf文件
[root@ts181 clamav-0.97.6]# cd/opt/clamav
[root@ts181 clamav]# vim etc/clam.conf
# Example 注释掉这一行. 第8 行
LogFile /opt/clamav/logs/clamd.log
PidFile /opt/clamav/updata/clamd.pid
DatabaseDirectory /opt/clamav/updata
3.4 配置freshclam.conf文件
[root@ts181 clamav]# vimetc/freshclam.conf
#Example 注释掉这一行
DatabaseDirectory /opt/clamav/updata
UpdateLogFile/opt/clamav/logs/freshclam.log
PidFile/opt/clamav/updata/freshclam.pid
3.5 文件授权
[root@ts181 clamav]# chown clamav:clamav/opt/clamav -R
4. 运行
4.1 升级
[root@ts181 clamav]#/opt/clamav/bin/freshclam
##升级病毒库
4.2 杀毒
[root@ts181 clamav]#/opt/clamav/bin/clamscan --查杀当前目录下的文件
[root@ts181 clamav]#/opt/clamav/bin/clamscan -r --查杀当前目录的所有文件及目录
[root@ts181 clamav]#/opt/clamav/bin/clamscan /home/leng --查杀dir目录
[root@ts181 clamav]# /opt/clamav/bin/clamscan-r /home/leng --查杀目录dir下的所有文件及目录
4.3 查看帮助
[root@ts181 clamav]#/opt/clamav/bin/clamscan --help
5.自动更新
后台运行/opt/clamav/bin/freshclam-d
计划任务:
[root@ts181 clamav]# crontab -e
1 3 * * * /usr/local/clamav/bin/freshclam--quiet
20 3 * * * /usr/local/clamav/bin/clamscan -r/home --remove -l /var/log/clamscan.log