适用环境
CentOS: 7.x
下载
下载地址 :/downloads,使用目前最新版本为:clamav-0.101.3
使用 wget 下载
wget https://clamav-site./production/release_files/files/000/000/484/original/clamav-0.101.3.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIY6OSGQFGUNJQ7GQ%2F0812%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=0812T053848Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=965dd9d950d9337bf792a5af2b0fb009dd08fc2533f2b262504a778739439b64
安装
解压
tar -zxvf clamav-0.101.3.tar.gz
安装依赖
yum install gcc gcc-c++ openssl openssl-devel -y
编译安装
cd clamav-0.101.3
./configure --prefix=/usr/local/clamav
make && make install
添加用户
groupadd clamav
useradd -g clamav clamav
配置
创建日志目录和病毒库目录
mkdir /usr/local/clamav/logs
mkdir /usr/local/clamav/updata
创建日志文件
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 clamav:clamav /usr/local/clamav/updata
chown -R clamav.clamav /usr/local/clamav/
修改配置文件
cp /usr/local/clamav/etc/clamd.conf.sample /usr/local/clamav/etc/clamd.conf
cp /usr/local/clamav/etc/freshclam.conf.sample /usr/local/clamav/etc/freshclam.conf
vim /usr/local/clamav/etc/clamd.conf
// 注释掉第8行,如下
#Example
#添加以下内容
LogFile /usr/local/clamav/logs/clamd.log
PidFile /usr/local/clamav/updata/clamd.pid
DatabaseDirectory /usr/local/clamav/updata
vim /usr/local/clamav/etc/freshclam.conf
// 注释掉第8行,如下
#Example
#添加以下内容
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid
执行
创建软链接:
ln -s /usr/local/clamav/bin/clamscan /usr/local/sbin/clamscan
更新病毒库
/usr/local/clamav/bin/freshclam
启动
# 启动
systemctl start clamav-freshclam.service
# 开机启动systemctl enable clamav-freshclam.service # 查看状态systemctl status clamav-freshclam.service
扫描杀毒
参数:
-r 递归扫描子目录
-i 只显示发现的病毒文件
–no-summary 不显示统计信息
用法:
# 帮助
/usr/local/clamav/bin/clamscan --help
# 默认扫描当前目录下的文件,并显示扫描结果统计信息 /usr/local/clamav/bin/clamscan#扫描当前目录下的所有目录和文件,并显示结果统计信息/usr/local/clamav/bin/clamscan -r#扫描data目录下的所有目录和文件,并显示结果统计信息 /usr/local/clamav/bin/clamscan -r /data #扫描data目录下的所有目录和文件,只显示有问题的扫描结果 /usr/local/clamav/bin/clamscan -r --bell -i /data #扫描data目录下的所有目录和文件,不显示统计信息 /usr/local/clamav/bin/clamscan --no-summary -ri /data
定时更新和杀毒
crontab定时任务,让服务器每天定时更新和定时杀毒,保存杀毒日志。
echo "
10 2 * * * /usr/local/clamav/bin/freshclam --quiet
20 3 * * * /usr/local/clamav/bin/clamscan -r /home --remove -l /var/log/clamscan.log
">>crontab
安装配置脚本
install-clamav.sh
你得有足够的实力,你的原则和底线才会被人尊重
如果觉得《Linux安装杀毒软件clamav》对你有帮助,请点赞、收藏,并留下你的观点哦!