Linux clamav 安装篇

Linux clamav 安装篇

clamav是一个在命令行下查毒软件,也是Linux中最为常见的一款杀毒软件,它有着丰富的模块,通过这些模块可以为邮件服务器、web服务器、文件服务器、代理服务器提供一个安全的保障。以下是两种安装clamav的方法。
 
 
一、yum 安装法[最简单的安装方法]
1) 安装epel源
# yum -y install epel-release
………………………略过若干行………………………………
Install       1 Package(s)
 
Total download size: 14 k
Installed size: 22 k
Downloading Packages:
epel-release-6-8.noarch.rpm                                                                                                   |  14 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : epel-release-6-8.noarch                                                                                                           1/1 
warning: /etc/yum.repos.d/epel.repo created as /etc/yum.repos.d/epel.repo.rpmnew
  Verifying  : epel-release-6-8.noarch                                                                                                           1/1 
 
Installed:
  epel-release.noarch 0:6-8 
 
Complete!
 
2) 安装clamd 
# yum -y install clamd
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package clamd.x86_64 0:0.98.7-1.el6 will be installed
–> Processing Dependency: clamav = 0.98.7-1.el6 for package: clamd-0.98.7-1.el6.x86_64
–> Processing Dependency: libclamav.so.6(CLAMAV_PUBLIC)(64bit) for package: clamd-0.98.7-1.el6.x86_64
–> Processing Dependency: libclamav.so.6(CLAMAV_PRIVATE)(64bit) for package: clamd-0.98.7-1.el6.x86_64
–> Processing Dependency: libclamav.so.6()(64bit) for package: clamd-0.98.7-1.el6.x86_64
–> Running transaction check
—> Package clamav.x86_64 0:0.98.7-1.el6 will be installed
–> Processing Dependency: clamav-db = 0.98.7-1.el6 for package: clamav-0.98.7-1.el6.x86_64
–> Running transaction check
—> Package clamav-db.x86_64 0:0.98.7-1.el6 will be installed
–> Finished Dependency Resolution
………………………………略过若干行…………………………
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : clamav-db-0.98.7-1.el6.x86_64                                                                                                     1/3 
  Installing : clamav-0.98.7-1.el6.x86_64                                                                                                        2/3 
  Installing : clamd-0.98.7-1.el6.x86_64                                                                                                         3/3 
  Verifying  : clamav-db-0.98.7-1.el6.x86_64                                                                                                     1/3 
  Verifying  : clamav-0.98.7-1.el6.x86_64                                                                                                        2/3 
  Verifying  : clamd-0.98.7-1.el6.x86_64                                                                                                         3/3 
 
Installed:
  clamd.x86_64 0:0.98.7-1.el6                                                                                                                        
 
Dependency Installed:
  clamav.x86_64 0:0.98.7-1.el6                                            clamav-db.x86_64 0:0.98.7-1.el6                                           
 
Complete!
 
3) 更新病毒库
# freshclam 
ClamAV update process started at Sun Jun 28 20:33:45 2015
main.cvd is up to date (version: 55, sigs: 2424225, f-level: 60, builder: neo)
Downloading daily.cvd [100%]
daily.cvd updated (version: 20616, sigs: 1443371, f-level: 63, builder: shurley)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 260, sigs: 47, f-level: 63, builder: shurley)
Database updated (3867643 signatures) from db.cn.clamav.net (IP: 202.118.1.66)
 
//定时更新病毒库(每6个时辰,哈哈)
# crontab -e 
* */12 * * * /usr/bin/freshclam –quiet –daemon
 
 
 

二、tarball 安装,适用于任何Linux

1) 安装系统依赖包
# yum -y install gcc gcc-c++ openssl-devel
 
2) 去官方网站[http://www.clamav.net/index.html]下载最新的源码包
# wget -c \
-O clamav-0.98.7.tar.gz \
 http://sourceforge.net/projects/clamav/files/clamav/0.98.7/clamav-0.98.7.tar.gz/download
 
3) 安装
# ./configure –prefix=/usr/local/clamav
# make;make install
 
4) 添加系统环境变量[可选]
# echo ‘export PATH=$PATH:/usr/local/clamav/sbin:/usr/local/clamav/bin’ > /etc/profile.d/clamav.sh
# source /etc/profile.d/clamav.sh
 
5) 编辑配置文件
# cd /usr/local/clamav/etc
# cp clamd.conf.sample clamd.conf
# mkdir /usr/local/clamav/{logs,update,var/run} -pv
# chown nobody.nobody /usr/local/clamav/ -R
 
//编辑病毒库更新文件
# grep -v “^#” freshclam.conf|tr -s “\n”
DatabaseDirectory /usr/local/clamav/update
UpdateLogFile /usr/local/clamav/logs/freshclam.log
LogFileMaxSize 2M
LogTime yes
LogRotate yes
PidFile /usr/local/clamav/var/run/freshclam.pid
DatabaseOwner nobody
DatabaseMirror db.cn.clamav.net
DatabaseMirror database.clamav.net
//编辑主配置文件
# grep -v “^#” clamd.conf|tr -s “\n”
 
LogFile /usr/local/clamav/logs/clamd.log
LogFileMaxSize 2M
LogTime yes
LogClean yes
LogRotate yes
PidFile /usr/local/clamav/var/run/clamd.pid
TemporaryDirectory /usr/local/clamav/var/tmp
DatabaseDirectory /usr/local/clamav/update
LocalSocket /tmp/clamd.socket
LocalSocketGroup nobody
TCPSocket 3310
TCPAddr 127.0.0.1
User nobody
6) 更新病毒库
# /usr/local/clamav/bin/freshclam 
ClamAV update process started at Sun Jun 28 21:25:25 2015
Downloading main.cvd [100%]
main.cvd updated (version: 55, sigs: 2424225, f-level: 60, builder: neo)
Downloading daily.cvd [100%]
daily.cvd updated (version: 20616, sigs: 1443371, f-level: 63, builder: shurley)
Downloading bytecode.cvd [100%]
bytecode.cvd updated (version: 260, sigs: 47, f-level: 63, builder: shurley)
Database updated (3867643 signatures) from db.cn.clamav.net (IP: 202.118.1.66)
 
# crontab -e 
* */12 * * * /usr/bin/freshclam –quiet –daemon
 
7) 测试
# /usr/local/clamav/bin/clamscan –remove /etc/sysconfig/network-scripts/
/etc/sysconfig/network-scripts/ifup-tunnel: OK
/etc/sysconfig/network-scripts/ifup-aliases: OK
/etc/sysconfig/network-scripts/ifdown-post: OK
/etc/sysconfig/network-scripts/net.hotplug: OK
/etc/sysconfig/network-scripts/ifup-sit: OK
/etc/sysconfig/network-scripts/ifdown-sit: OK
/etc/sysconfig/network-scripts/ifdown-eth: OK
/etc/sysconfig/network-scripts/ifup-post: OK
/etc/sysconfig/network-scripts/init.ipv6-global: OK
/etc/sysconfig/network-scripts/ifup-ipv6: OK
/etc/sysconfig/network-scripts/ifup-plusb: OK
/etc/sysconfig/network-scripts/ifup-eth: OK
/etc/sysconfig/network-scripts/ifdown-routes: OK
/etc/sysconfig/network-scripts/ifup-ippp: OK
/etc/sysconfig/network-scripts/ifup-bnep: OK
/etc/sysconfig/network-scripts/network-functions-ipv6: OK
/etc/sysconfig/network-scripts/ifdown-ppp: OK
/etc/sysconfig/network-scripts/ifdown: Symbolic link
/etc/sysconfig/network-scripts/route-eth0: OK
/etc/sysconfig/network-scripts/ifcfg-eth0: OK
/etc/sysconfig/network-scripts/ifup-plip: OK
/etc/sysconfig/network-scripts/ifdown-tunnel: OK
/etc/sysconfig/network-scripts/route-eth1: OK
/etc/sysconfig/network-scripts/ifdown-isdn: Symbolic link
/etc/sysconfig/network-scripts/ifdown-ippp: OK
/etc/sysconfig/network-scripts/ifup-routes: OK
/etc/sysconfig/network-scripts/ifcfg-lo: OK
/etc/sysconfig/network-scripts/network-functions: OK
/etc/sysconfig/network-scripts/ifup: Symbolic link
/etc/sysconfig/network-scripts/ifcfg-eth1: OK
/etc/sysconfig/network-scripts/ifdown-ipv6: OK
/etc/sysconfig/network-scripts/ifup-isdn: Symbolic link
/etc/sysconfig/network-scripts/ifdown-bnep: OK
/etc/sysconfig/network-scripts/ifup-wireless: OK
/etc/sysconfig/network-scripts/ifup-ppp: OK
———– SCAN SUMMARY ———–
Known viruses: 3862048
Engine version: 0.98.7
Scanned directories: 1
Scanned files: 31
Infected files: 0
Data scanned: 0.16 MB
Data read: 0.09 MB (ratio 1.78:1)
Time: 12.999 sec (0 m 12 s)

Leave a Reply

Your email address will not be published. Required fields are marked *