流程图
下载
ClamAVNet
离线安装脚本
#扫描文件路径
scanfile="/home"
#分钟 小时 日期 月份 星期几, 例:0 0 * * * 表示每天0时0秒
scantime="0 0 * * *"
#添加用户组和组成员
groupadd clamav
useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
#执行安装命令
rpm -ivh clamav*.rpm
#创建日志和病毒库目录
mkdir /usr/local/clamav
mkdir /usr/local/clamav/logs
mkdir /usr/local/clamav/update
#创建日志文件
touch /usr/local/clamav/logs/clamd.log
touch /usr/local/clamav/logs/freshclam.log
#文件授权
chown clamav:clamav /usr/local/clamav/logs/clamd.log
chown clamav:clamav /usr/local/clamav/logs/freshclam.log
chown -R clamav:clamav /usr/local/clamav/update
#修改配置文件clamd.conf
cp -rf /usr/local/etc/clamd.conf.sample /usr/local/etc/clamd.conf
sed -i '8s|Example|#Example|' /usr/local/etc/clamd.conf
cat << EOF >> /usr/local/etc/clamd.conf
DatabaseDirectory /var/lib/clamav
EOF
#修改配置文件freshclam.conf
cp -rf /usr/local/etc/freshclam.conf.sample /usr/local/etc/freshclam.conf
sed -i '8s|Example|#Example|' /usr/local/etc/freshclam.conf
cat << EOF >> /usr/local/etc/freshclam.conf
DatabaseOwner clamav
DatabaseDirectory /var/lib/clamav
ScriptedUpdates yes
Checks 24
#PrivateMirror 127.0.0.1
UpdateLogFile /usr/local/clamav/logs/freshclam.log
EOF
mkdir /var/lib/clamav
chown -R clamav:clamav /var/lib/clamav
#上传病毒库文件到/var/lib/clamav
cp -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.sh
touch /usr/local/bin/timescan.sh
cat << EOF >> /usr/local/bin/timescan.sh
#扫描/home目录,扫描日志存入/usr/local/clamav/logs/clamd.log
clamscan -r -i /home -l /usr/local/clamav/logs/clamd.log
EOF
#按需求修改扫描路径
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
出现下图说明安装并手动扫描成功
‘文章来源:https://www.toymoban.com/news/detail-774718.html
’文章来源地址https://www.toymoban.com/news/detail-774718.html
到了这里,关于linux杀毒软件ClamAV下载、安装(在线安装、离线安装)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!