(图片来源网络,侵删)
#安装依赖yum install gcc openssl openssl-devel -y#创建clamav用户groupadd clamav && useradd -g clamav clamav && id clamav#创建日志存放目录mkdir -p /usr/local/clamav/logstouch /usr/local/clamav/logs/clamd.logtouch /usr/local/clamav/logs/freshclam.logchown clamav.clamav /usr/local/clamav/logs/clamd.logchown clamav.clamav /usr/local/clamav/logs/freshclam.log#创建病毒库存放目录mkdir -p /usr/local/clamav/share/clamavchown -R root.clamav /usr/local/clamav/chown -R clamav.clamav /usr/local/clamav/share/clamav#官网地址: http://www.clamav.net/downloads#Linux中下载地址: wget http://www.clamav.net/downloads/production/clamav-0.103.11.tar.gz#参考文档: https://github.com/vrtadmin/clamav-faq/raw/master/manual/clamdoc.pdftar xf clamav-0.103.11.tar.gzcd clamav-0.103.11./configure CXXFLAGS='-std=c++11' --prefix=/usr/local/clamav/makemake install#检查是否安装成功echo $?#配置clamavcd /usr/local/clamav/etc/cp clamd.conf.sample clamd.confcp freshclam.conf.sample freshclam.confvim clamd.conf#Example #注释这一行LogFile /usr/local/clamav/logs/clamd.log #新增PidFile /usr/local/clamav/update/clamd.pid #新增DatabaseDirectory /usr/local/clamav/share/clamav #新增vim freshclam.conf#Example #注释这一行DatabaseDirectory /usr/local/clamav/share/clamav #新增UpdateLogFile /usr/local/clamav/logs/freshclam.log #新增PidFile /usr/local/clamav/share/clamav/freshclam.pid #新增chown -R clamav.clamav /usr/local/clamav/#启动clamavsystemctl start clamav-freshclam.servicesystemctl enable clamav-freshclam.servicesystemctl status clamav-freshclam.service#更新病毒库#先停止服务systemctl stop clamav-freshclam.service/usr/local/clamav/bin/freshclam#因为网络问题,可能导致下载失败,手动下载cd /usr/local/clamav/share/clamavwget http://database.clamav.net/main.cvdwget http://database.clamav.net/daily.cvdwget http://database.clamav.net/bytecode.cvd#更新成功后启动clamavsystemctl start clamav-freshclam.service#创建软连接ln -s /usr/local/clamav/bin/clamscan /usr/local/clamav/sbin/clamscan#设置定时任务扫描/home目录crontab -l20 3 /usr/local/clamav/bin/clamscan -r /home/ --remove -l /var/log/clamscan.log
0 评论