1. 程式人生 > >clamav殺毒軟件部署筆記

clamav殺毒軟件部署筆記

clamav殺毒軟件部署筆記

環境:Centos 7.2

軟件:clamav

第一步:Clamav下載

wget http://www.clamav.net/downloads/production/clamav-0.99.2.tar.gz

第二步:創建clamav用戶和組

groupadd  clamav   
useradd -g clamav clamav

第三步:編譯安裝

tar xf clamav-0.99.2.tar.gz
cd clamav-0.99.2
./configure --prefix=/usr/local/clamav && make && make install

第四步:配置

mkdir /usr/local/clamav/logs (日誌存放目錄)
touch /usr/local/clamav/logs/clamd.log
touch /usr/local/clamav/logs/freshclam.log
mkdir /usr/local/clamav/updata (clanav 病毒庫目錄)
chown -R root.clamav /usr/local/clamav/
chown -R clamav.clamav /usr/local/clamav/updata/
chown clamav.clamav /usr/local/clamav/logs/clamd.log
chown clamav.clamav /usr/local/clamav/logs/freshclam.log
cd /usr/local/clamav/etc
cp clamd.conf.sample clamd.conf
cp freshclam.conf.sample freshclam.conf
vi clamd.conf
#Example 註釋掉這一行.
LogFile /usr/local/clamav/logs/clamd.log 
PidFile /usr/local/clamav/updata/clamd.pid 
DatabaseDirectory /usr/local/clamav/updata
vi freshclam.conf
#Example 註釋掉這一行.
DatabaseDirectory /usr/local/clamav/updata
UpdateLogFile /usr/local/clamav/logs/freshclam.log
PidFile /usr/local/clamav/updata/freshclam.pid

第五步:升級病毒庫

/usr/local/clamav/bin/freshclam

這個過程很久,大概半個小時,等吧。可以開啟screen來進行

/usr/local/clamav/bin/clamscan --remove          (查殺當前目錄並刪除感染的文件)

第六步:計劃任務
實際生產環境應用
一般使用計劃任務,讓服務器每天晚上定時跟新和定時殺毒。保存殺毒日誌,我的crontab文件如下

yum install crontabs -y
/sbin/service crond start         //啟動服務
/sbin/service crond stop        //關閉服務
/sbin/service crond restart    //重啟服務
/sbin/service crond reload     //重新載入配置
chkconfig crond on                 //開機啟動 centos6
systemctl enable crond.service    //開機啟動 centos7
crontab -e
1 3 * /usr/local/clamav/bin/freshclam 
30 3 * /usr/local/clamav/bin/clamscan --infected -r / --remove -l /var/log/clamscan.log


本文出自 “boyhack” 博客,請務必保留此出處http://461205160.blog.51cto.com/274918/1944928

clamav殺毒軟件部署筆記