Home > Dịch vụ VPS > CÀI ĐẶT CLAMAV (CHƯƠNG TRÌNH ANTI VIRUT MIỄN PHÍ CHO LINUX)

CÀI ĐẶT CLAMAV (CHƯƠNG TRÌNH ANTI VIRUT MIỄN PHÍ CHO LINUX)

Link download: http://www.clamav.net/download/sources
Sau khi download về bạn phải giải nén ra: tar -xzvf clamav-x.y.z.tar.gz
Trước khi cài đặt, chúng ta cần tạo group và user giành riêng cho phần mềm:
# groupadd clamav 
# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
Giờ bắt đầu cài đặt, vào thư mục vừa mới giải nén ra chạy:
$./configure

Khi lệnh đã chạy xong, ta thực hiện tiếp lệnh:
$./configure --sysconfdir=/etc (Lệnh này dùng để chỉ định file config của phần mềm là /etc)

Thực hiện tiếp lần lượt các lệnh sau:
$make check

$make

#make install

Hoàn thành quá trình cài đặt. Nhưng cần phải config 1 số thứ để phần mền có thể hoạt động.

Đầu tiên chạy lệnh $whereis clamd để biết các file cấu hình hiện tại của phần mềm, ta sẽ thấy xuất hiện 1 dòng tương tự như sau:
clamd: /usr/src/clamav-0.94.1/clamd /usr/local/sbin/clamd /usr/local/etc/clamd.conf /usr/local/etc/clamd.conf~

Config 2 file /etc/clamd.conf (File tinh chỉnh phần mềm) và /etc/freshclam.conf (File tinh chỉnh cập nhật)
File clamd.conf chỉnh các thông số như sau:

 

LogFile /tmp/clamd.log
LogFileUnlock yes
#Chemin à un fichier de socket local sur lequel le daemon écoutera.
#Par défaut il est désactivé mais doit être spécifié par l'utilisateur dans #certains cas, notamment l'utilisation de plugins de scanner de mail pour des #logiciels de courriels.
LocalSocket /tmp/clamd.socket
TCPSocket 3310
StreamMaxLength 20M
StreamMinPort 30000
StreamMaxPort 32000
VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v"
User clamav
AllowSupplementaryGroups yes
DetectPUA yes
AlgorithmicDetection yes
ScanPE yes
ScanELF yes
DetectBrokenExecutables yes
ScanOLE2 yes
ScanPDF yes
ScanMail yes
MailFollowURLs yes
PhishingSignatures yes
PhishingScanURLs yes
ScanHTML yes
ScanArchive yes
ArchiveMaxFileSize 0
ArchiveMaxRecursion 0
ArchiveMaxFiles 0

File freshclam.conf

 

DatabaseOwner clamav
AllowSupplementaryGroups yes
DatabaseMirror db.fr.clamav.net
DatabaseMirror database.clamav.net

Như vậy chúng ta đã cài đặt và config xong phần mềm, giờ có thể chạy:
clamd

Nếu chạy thấy thông báo lỗi như sau:
clamd: error while loading chared libraries: libclamav.so.5: cannot open shared object file: no such file or directory

Cách giải quyết là sử dụng lệnh: ldconfig để thiết lập lại các file config

Để cập nhật phần mềm ta sử dụng: freshclam

Để quét 1 file hoặc thư mục ta dùng lệnh: 
clamscan -r /thumuc --move=/thu-muc-chua-file-nhiem