Clamav 杀毒软件安装

news/2024/12/21 21:59:41/

Clamav

官网:https://www.clamav.net/downloads

PS:最好使用当前稳定版本,最新版本有很多坑!

1.安装Clamav

1.1 下载依赖

[rootadmin@VM-16-10-centos ~]# yum -y install gcc gcc++ gcc-c++ gcc-gfortran openssl-devel zlib zlib-devel pcre2 pcre2-devel bzip2 bzip2-devel libxml2 libxml2-devel libcurl libcurl-devel

1.2 下载编译clamav

[rootadmin@VM-16-10-centos ~]# wget https://www.clamav.net/downloads/production/clamav-0.103.8.tar.gz
[rootadmin@VM-16-10-centos ~]# tar -zxf clamav-0.103.8.tar.gz 
[rootadmin@VM-16-10-centos ~]# cd clamav-0.103.8/
[rootadmin@VM-16-10-centos clamav-0.103.8]# ./configure  --prefix=/usr/local/clamav
[rootadmin@VM-16-10-centos clamav-0.103.8]# make && make install 
[rootadmin@VM-16-10-centos clamav-0.103.8]# ln -s /usr/local/clamav/bin/clamscan  /usr/bin/
[rootadmin@VM-16-10-centos clamav-0.103.8]# clamscan -V
ClamAV 0.103.8

2.配置Clamav

2.1 创建用户

[rootadmin@VM-16-10-centos ~]# groupadd clamav
[rootadmin@VM-16-10-centos ~]# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav

2.2 创建日志、病毒文件

[rootadmin@VM-16-10-centos ~]# mkdir -p /usr/local/clamav/logs
[rootadmin@VM-16-10-centos ~]# touch  /usr/local/clamav/logs/clamd.log
[rootadmin@VM-16-10-centos ~]# touch  /usr/local/clamav/logs/freshclam.log
[rootadmin@VM-16-10-centos ~]# mkdir -p /usr/local/clamav/updata
[rootadmin@VM-16-10-centos ~]# touch /usr/local/clamav/updata/clamd.pid
[rootadmin@VM-16-10-centos ~]# touch  /usr/local/clamav/updata/freshclam.pid
[rootadmin@VM-16-10-centos ~]# chown -R clamav:clamav /usr/local/clamav

2.3 修改配置文件

[rootadmin@VM-16-10-centos clamav-0.103.8]# cd /usr/local/clamav/etc/
[rootadmin@VM-16-10-centos etc]# mv clamd.conf.sample clamd.conf
[rootadmin@VM-16-10-centos etc]# mv freshclam.conf.sample freshclam.conf
[rootadmin@VM-16-10-centos etc]# sed -i 's/Example/#Example/g' /usr/local/clamav//etc/freshclam.conf
[rootadmin@VM-16-10-centos etc]# cat >>clamd.conf<<  clamav1
LogFile /usr/local/clamav/logs/clamd.log
PidFile /usr/local/clamav/updata/clamd.pid
DatabaseDirectory  /usr/local/clamav/updata
clamav1
[rootadmin@VM-16-10-centos etc]# cat >>freshclam.conf<<  clamav2
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid
clamav2

3.启动Clamav

3.1 更新病毒库

[rootadmin@VM-16-10-centos ~]# freshclam 
Creating missing database directory: /usr/local/clamav/share/clamav
Assigned ownership of database directory to user "clamav".
ClamAV update process started at Mon Mar  6 17:50:38 2023
daily database available for download (remote version: 26833)
Time:    3.0s, ETA:   12.1s [====>                    ]   11.44MiB/58.02MiB
......

3.2 扫描目录

[rootadmin@VM-16-10-centos ~]# clamscan -r /home/

3.3 帮助

[rootadmin@VM-16-10-centos ~]# clamscan --help
#更多参数参考帮助

4.一键安装脚本

[rootadmin@VM-16-10-centos ~]# vim clamav_install.sh
#!/bin/bashif [ `whoami` != 'root' ]
thenecho "You must be root to run this script"exit 2
fi#clamav包版本
clamav=clamav-0.103.8
#clamav路径
clamavpath=/usr/local/clamav####################----安装所需依赖包----####################
yum -y install gcc gcc++ gcc-c++ gcc-gfortran openssl-devel zlib zlib-devel pcre2 pcre2-devel bzip2 bzip2-devel libxml2 libxml2-devel libcurl libcurl-devel####################----创建用户----####################groupadd clamav
useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav####################----解压编译安装----####################tar -zxf /root/clamav/$clamav.tar.gz  -C /root/clamav/
cd  /root/clamav/$clamav/
./configure --prefix=$clamavpath  --disable-clamav -with-zlib=/usr/local/zlib
make && make install####################----添加日志文件----####################mkdir -p $clamavpath/logs
touch  $clamavpath/logs/clamd.log
touch  $clamavpath/logs/freshclam.log
mkdir -p $clamavpath/updata
touch $clamavpath/updata/clamd.pid
touch  $clamavpath/updata/freshclam.pid
chown -R clamav:clamav $clamavpath####################----修改配置文件----####################cd $clamavpath/etc/
mv clamd.conf.sample clamd.conf
mv freshclam.conf.sample freshclam.confsed -i 's/Example/#Example/g' $clamavpath/etc/freshclam.confcat >>clamd.conf<<  clamav
LogFile $clamavpath/logs/clamd.log
PidFile $clamavpath/updata/clamd.pid
DatabaseDirectory   $clamavpath/updata
clamavcat >>freshclam.conf<<  clamav
DatabaseDirectory $clamavpath/updata
UpdateLogFile $clamavpath/logs/freshclam.log
PidFile $clamavpath/updata/freshclam.pid
clamav####################----更新病毒库并启动----####################$clamavpath/bin/freshclam
$clamavpath/bin/freshclam -dclamavPID=`ps -ef | grep clamav | grep -v grep |awk '{print $2}'`if [   "$clamavPID"  != ""   ]
thenecho "clamav 服务已启动!  PID:$clamavPID"
elseecho "clamav 服务未启动!"
fi####################----查杀根下所有文件输出日志的到文件----####################
/usr/local/clamav/bin/clamscan -r / -l /usr/local/clamav/logs/clamd.log

http://www.ppmy.cn/news/364894.html

相关文章

CleanMyMac软件好不好用?最新版测评

CleanMyMac&#xff08;下文简称为 CMM&#xff09;或许是 Mac上最知名的系统清理工具&#xff0c;我们之前也介绍过 CMM3的特性。 如果你也对MAC系统的优化和文件管理摸不清头脑&#xff0c;不知道该如何清理垃圾和缓存文件。那你可以试试我最近发现的这款软件——CleanMyMac…

Mac OS需要安裝掃毒軟體嗎?

我們經常聽到有用戶聲稱Mac不會感染病毒&#xff0c;因此安装mac掃毒軟體是多此一舉&#xff0c;也不需要Mac線上掃毒&#xff0c;事實真的是這樣嗎&#xff1f; Mac作業系統上是否會有惡意攻擊的存在&#xff1f; 要知道Mac OS是否需要安裝掃毒軟體&#xff0c;我們首先要了解…

史上最著名的电脑病毒

永恒之蓝不算啥&#xff01;盘点史上最著名的电脑病毒永恒之蓝不算啥&#xff01;盘点史上最著名的电脑病毒 这两年很多人都被比特币勒索病毒“永恒之蓝“给弄傻了&#xff0c;一言不合就加密硬盘&#xff0c;还只收比特币&#xff0c;简直让人没法沟通了。其实这“永恒之蓝”并…

电脑整人小病毒:

大家好啊&#xff0c;我是夙兴夜寐 今天给大家提供几个电脑普遍适用的小病毒&#xff0c;相信大家都知道&#xff0c;主要是根据自身经验&#xff0c;若不好&#xff0c;还请海涵&#xff0c;每个代码都亲身试验过的&#xff0c;自己复制即可使用。 废话不多说&#xff0c;上…

彻底卸载McAfee Agent

为什么卸载McAfee&#xff0c;太占用CPU了。。。。。。 卸载McAfee时提示&#xff1a;McAfee Agent cannot be removed while it is in mannaged mode 1、先在程序卸载里面卸载能卸载的 当卸载McAfee Agent时提示McAfee Agent cannot be removed while it is in mannaged mo…

彻底卸载流氓软件CleanMyMac

还在为卸载后的CleanMyMac莫名弹框的问题困扰? 当我们把CleanMyMac拖到垃圾桶或者commanddelete后,它还是会在我们开机或者清内存的时候莫名弹框,有木有觉得很恶心,其实是我们简单删除CleanMyMac的时候并没有彻底删干净.这时候就要用到我们万能的命令行了. 执行mdfind -nam…

CleanMyMacX4.15好用吗?CleanMyMac X2023安全吗?

CleanMyMac x4.15已经正式发布&#xff0c;作为最新的系统清理和应用管理软件&#xff0c;可以让用户一键智能化清理Mac电脑&#xff0c;自动扫描Mac上的所有文件&#xff0c;包括&#xff1a;Mac系统清理、邮件应用程序清理、大和旧型文件清理、itunes文件清理、废纸篓清理、应…

iPad惊魂

注&#xff1a;为了免去大量搬迁图片的麻烦&#xff0c;本文全部图片采用滤镜技术盗链自QQ相册。非IE内核的浏览器也许无法看到本文图片。如果是支持noreferrer的最新webkit浏览器&#xff0c;可以试试点击图片浏览。 事后彪叔是这么评价的&#xff1a;“那些小偷也倒霉&…