1.安装依赖环境ubuntu
yum install -y zlib openssl-devel yum groupinstall -y "Development Tools"
apt install -y zlib1g zlib1g.dev openssl vim build-essential libssl-dev #ubuntu/debian安装
2.安装clamav软件包vim
wget http://www.clamav.net/downloads/production/clamav-0.101.0.tar.gz tar zxvf clamav-0.101.0.tar.gz cd clamav-0.101.0 ./configure --prefix=/usr/local/clamav make && make install
3.修改配置文件服务器
cp /usr/local/clamav/etc/clamd.conf.sample /usr/local/clamav/etc/clamd.conf sed -i '8s/Example/#Example/g' /usr/local/clamav/etc/clamd.conf echo 'LogFile /usr/local/clamav/logs/clamd.log' >> /usr/local/clamav/etc/clamd.conf echo 'PidFile /usr/local/clamav/updata/clamd.pid' >> /usr/local/clamav/etc/clamd.conf echo 'DatabaseDirectory /usr/local/clamav/updata/clamav' >> /usr/local/clamav/etc/clamd.conf
cp /usr/local/clamav/etc/freshclam.conf.sample /usr/local/clamav/etc/freshclam.conf sed -i '8s/Example/#Example/g' /usr/local/clamav/etc/freshclam.conf echo 'DatabaseDirectory /usr/local/clamav/updata' >> /usr/local/clamav/etc/freshclam.conf echo 'UpdateLogFile /usr/local/clamav/logs/freshclam.log' >> /usr/local/clamav/etc/freshclam.conf echo 'PidFile /usr/local/clamav/updata/freshclam.pid' >> /usr/local/clamav/etc/freshclam.conf
4.建立用户ui
groupadd clamav
useradd -g clamav clamav
5.建立目录文件spa
mkdir /usr/local/clamav/logs mkdir /usr/local/clamav/updata
touch /usr/local/clamav/logs/freshclam.log chown clamav:clamav /usr/local/clamav/logs/freshclam.log touch /usr/local/clamav/logs/clamd.log chown clamav:clamav /usr/local/clamav/logs/clamd.log chown clamav:clamav /usr/local/clamav/updata
6.升级病毒库(须要服务器连通外网).net
/usr/local/clamav/bin/freshclam
7.扫描病毒code
/usr/local/clamav/bin/clamscan -r --bell -i /
clamscan经常使用参数blog
-r/--recursive[=yes/no] | 全部文件 |
--log=FILE/-l FILE | 增长扫描报告 |
clamscan -l /var/log/clamscan.log / | |
--move [路径] | 移动病毒文件至 |
--remove [路径] | 删除病毒文件 |
--quiet | 只输出错误消息 |
--infected/-i | 只输出感染文件 |
--suppress-ok-results/-o | 跳过扫描OK的文件 |
--bell | 扫描到病毒文件发出警报声音 |
--unzip(unrar) | 解压压缩文件扫描 |