Installation of Linux ClamAV anti-virus software

Source: Internet
Author: User

I. Overview 

Linux is more stable and more secure than other operating systems. Theoretically, Linux is likely to be compromised by viruses. But in reality, Linux machines are almost impossible to attack with viruses. So my question here is why to prepare antivirus software for Linux, in order to better understand, I prepared for the following reasons, Linux platform installed anti-virus software reasons: 1, from the Linux platform scan Windows driver. 2. Scan Windows workstations through the network. 3. Scan incoming and outgoing messages in the Linux server. 4, scan the important documents sent to other machines.
The following recommended to you the best free Linux platform antivirus: 1, ClamAV Antivirus. 2. Avast Linux Home Edition. 3. Avast Linux Home Edition. 4, AVG free version of Antivirus. 5, F-prot Antivirus.

We mainly introduce ClamAV antivirus: ClamAV Antivirus is the Linux platform's most popular antivirus software, ClamAV belongs to free open source products, support a variety of platforms, such as: Linux/unix, MAC OS X, Windows, OpenVMS. ClamAV is a virus-scanning-based command-line tool, but there are also CLAMTK tools that support graphical interfaces. ClamAV is primarily used for mail server scan messages. It has a variety of interfaces to scan mail from mail servers, supporting file formats like: ZIP, RAR, TAR, GZIP, BZIP2, HTML, DOC, PDF, SIS CHM, RTF, and more. The CLAMAV has an automatic database updater and can also be run from a shared library.

The zlib library should be included when compiling ClamAV for compressing and decompressing functions. (The following is a compilation installation and use of clamav-0.97.6.tar.gz as an example)

Second, the system environment

System Environment: CentOS 6.2

Software:

1, zlib-1.2.7.tar.gz

Download: wget http://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.7/zlib-1.2.7.tar.gz

2, clamav-0.97.6.tar.gz

Download: wget http://nchc.dl.sourceforge.net/project/clamav/clamav/0.97.6/clamav-0.97.6.tar.gz

Third, installation

1, zlib-1.2.7.tar.gz installation

    Tar xvzf zlib-1.2.7. tar.gz    #cd zlib-1.2.7    #./Configure    #make && make install 

2. Add user groups ClamAV and group members ClamAV (note: Users must be added before installing clamav-0.97.6.tar.gz)

# groupadd clamav# useradd-g clamav-s/bin/false-c "Clam AntiVirus" ClamAV

3, clamav-0.97.6.tar.gz

#tar Xvzf clamav-0.97.6.tar.gz
#cd clamav-0.97.6
#./configure--prefix=/opt/clamav  --disable-clamav# make#make Install

Iv. Configuration

1. Create a Directory

mkdir/opt/clamav/logs       (log storage directory) Mkdir/opt/clamav/updata   (clanav Virus Library directory)

2. Create a file

Add two logs files under the/var/log directory: Clamd.log and Freshclam.log, change the owner to the newly added ClamAV user, and set the appropriate file read and write permissions

#touch/opt/clamav/logs/Freshclam.log#touch/opt/clamav/logs/clamd.log

3. Configuring the/etc/clam.conf File

#cd/opt/clamav#vi etc/clam.conf

# Example comment out this line. Line 8th
Logfile/opt/clamav/logs/clamd.log Delete the previous comment directory and change to logs below line 14th
Pidfile/opt/clamav/updata/clamd.pid Delete the previous comment path and change the 57th line.
Databasedirectory/opt/clamav/updata Ibid. 65th

4. Configuring the Freshclam.conf File

#vi etc/freshclam.conf

#Example comment out this line
Databasedirectory/opt/clamav/updata
Updatelogfile/opt/clamav/logs/freshclam.log
Pidfile/opt/clamav/updata/freshclam.pid

5. Document Authorization

#chown clamav:clamav/opt/clamav/logs/freshclam.log#chown clamav:clamav/opt/clamav/logs/clamd.log# Chown clamav:clamav/opt/clamav/updata  

V. Implementation

1. Upgrade

#/opt/clamav/bin/freshclam        (upgrade virus database)   to ensure that your Linux can be the normal Internet oh.

2. Anti-virus

#/opt/clamav/bin/clamscan        -- avira files under the current directory #/opt/clamav/bin/clamscan-r     
#/opt/clamav/bin/clamscan dir
#/opt/clamav/bin/clamscan-r Dir--All files and directories under the directory dir of Avira

3. Help

#/opt/clamav/bin/clamscan--help  

Vi. Automatic Updates

Automatic update of Freshclam
Background run Freshclam:
# freshclam-d
You can also use cron background to run Freshclam automatically: Add the following lines to the crontab:
N * * * */opt/bin/freshclam--quiet
(where n is the data between 3-57, indicating that the update virus database is checked every n hours)

General use of scheduled tasks, so that the server every night regularly with new and timed antivirus. Save the antivirus log, my crontab file is as follows

1 3 * * */usr/local/clamav/bin/freshclam--quiet
3 * * */usr/local/clamav/bin/clamscan-r/home--remove-l/var/log/clamscan.log

5: Upgrade virus database

[Email protected] etc]#/opt/clamav/bin/freshclam

Error:can ' t change dir to/opt/clamav/share/clamav

The above error occurs, create a folder directly and authorize the ClamAV user.

[Email protected] etc]# mkdir-p/opt/clamav/share/clamav
[Email protected] etc]# chown Clamav:clamav/opt/clamav/share/clamav
[Email protected] etc]#
[Email protected] etc]#/opt/clamav/bin/freshclam
ClamAV update process started at Fri 21 22:42:18 2015
Warning:your ClamAV installation is outdated!
Warning:local version:0.97.6 Recommended version:0.98.7
DON ' T panic! Read Http://www.clamav.net/support/faq
Nonblock_connect:connect timing Out (secs)
Can ' t connect to Port Database.clamav.net of host (ip:211.239.150.206)
Trying host database.clamav.net (120.29.176.126) ...
NONBLOCK_RECV:RECV timing Out (secs)
WARNING:getfile:Download Interrupted:operation now in Progress (ip:120.29.176.126)
Warning:can ' t download MAIN.CVD from Database.clamav.net
Trying again in 5 secs ...
ClamAV update process started at Fri 21 23:03:32 2015
Warning:your ClamAV installation is outdated!
Warning:local version:0.97.6 Recommended version:0.98.7
DON ' T panic! Read Http://www.clamav.net/support/faq
Downloading MAIN.CVD [100%]
MAIN.CVD Updated (version:55, sigs:2424225, f-level:60, Builder:neo)
Downloading DAILY.CVD [100%]
DAILY.CVD Updated (version:20817, sigs:1537382, f-level:63, Builder:neo)
Downloading BYTECODE.CVD [100%]
BYTECODE.CVD Updated (version:268, sigs:47, f-level:63, Builder:anvilleg)
Database Updated (3961654 signatures) from Database.clamav.net (ip:219.94.128.99)

Because ClamAV is not the latest version, there is a warning message. You can ignore or upgrade the latest version. The virus database needs to be upgraded regularly, for example, I upgrade the virus database the next day

Installation of Linux ClamAV anti-virus software

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.