流程图
下载
ClamAVNet
离线安装脚本
#扫描文件路径scanfile="/home"#分钟 小时 日期 月份 星期几, 例:0 0 * * * 表示每天0时0秒scantime="0 0 * * *"#添加用户组和组成员groupadd clamavuseradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav#执行安装命令rpm -ivh clamav*.rpm#创建日志和病毒库目录mkdir /usr/local/clamavmkdir /usr/local/clamav/logsmkdir /usr/local/clamav/update#创建日志文件touch /usr/local/clamav/logs/clamd.logtouch /usr/local/clamav/logs/freshclam.log#文件授权chown clamav:clamav /usr/local/clamav/logs/clamd.logchown clamav:clamav /usr/local/clamav/logs/freshclam.logchown -R clamav:clamav /usr/local/clamav/update#修改配置文件clamd.confcp -rf /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.confsed -i '8s|Example|#Example|' /usr/local/etc/clamd.confcat << EOF >> /usr/local/etc/clamd.confDatabaseDirectory /var/lib/clamavEOF#修改配置文件freshclam.confcp -rf /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.confsed -i '8s|Example|#Example|' /usr/local/etc/freshclam.confcat << EOF >> /usr/local/etc/freshclam.confDatabaseOwner clamavDatabaseDirectory /var/lib/clamavScriptedUpdates yesChecks 24#PrivateMirror 127.0.0.1UpdateLogFile /usr/local/clamav/logs/freshclam.logEOFmkdir /var/lib/clamavchown -R clamav:clamav /var/lib/clamav#上传病毒库文件到/var/lib/clamavcp -rf *.cvd /var/lib/clamav#启动服务并开启自启动#systemctl start clamd@scan #systemctl enable clamd@scan#递归扫描home目录,并且记录日志 #clamscan -r -i /home -l /usr/local/clamav/logs/clamd.log#创建定时运行脚本rm -rf /usr/local/bin/timescan.shtouch /usr/local/bin/timescan.shcat << EOF >> /usr/local/bin/timescan.sh#扫描/home目录,扫描日志存入/usr/local/clamav/logs/clamd.logclamscan -r -i /home -l /usr/local/clamav/logs/clamd.logEOF#按需求修改扫描路径sed -i '2s|/home|'$scanfile'|' /usr/local/bin/timescan.sh#删除原有的计划sed -i '/timescan.sh/d' /etc/crontab#添加定时任务sed -i '$a\'"$scantime root sh /usr/local/bin/timescan.sh" /etc/crontab
通过git下载程序和脚本一键安装
git下载地址和文件说明
https://gitcode.net/zengliguang/clamav_offline_install.git
cvd后缀的文件是病毒库
sh后缀文件是脚本
rpm后缀的是杀毒软件离线安装包
下载
git clone https://gitcode.net/zengliguang/clamav_offline_install.git
安装
进入路径
cd clamav_offline_install
执行sh脚本文件,等待完成安装
source clamav_offline_install.sh
安装完成
手动扫描
clamscan
出现下图说明安装并手动扫描成功
‘
’