First, download and install
1. Download clamav official website: http://www.clamav.net/downloads , the latest stable version is 0.100.2.1. Click here to download or wget directly download the package.
wget https://clamav-site.s3.amazonaws.com/production/release_files/files/000/000/548/original/clamav-0.102.2.tar.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIY6OSGQFGUNJQ7GQ%2F20200325%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200325T030056Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=f1cf2bb8dc349fc6bf3d31df29edc0671993a9acaac36f27bce17ff482de60ba
2. Extract
tar -zxf clamav-0.100.2.tar.gz
3. Compile install
cd clamav-0.99.2 ./configure --prefix=/usr/local/clamav make make install
4. Add the user groups and group members
groupadd clamav useradd -g clamav clamav
Second, placement
1. Create a log directory and library directory virus
mkdir /usr/local/clamav/logs mkdir /usr/local/clamav/updata
2. Create a log file
touch /usr/local/clamav/logs/clamd.log touch /usr/local/clamav/logs/freshclam.log
3. Documentation License
chown clamav:clamav /usr/local/clamav/logs/clamd.log chown clamav:clamav /usr/local/clamav/logs/freshclam.log chown clamav:clamav /usr/local/clamav/updata
4. Modify the configuration file
cp /usr/local/clamav/etc/clamd.conf.sample /usr/local/clamav/etc/clamd.conf cp /usr/local/clamav/etc/freshclam.conf.sample / usr / local / clamav / etc /freshclam.conf
Edit the contents of two configuration files
/usr/local/clamav/etc/clamd.conf vim #Example // comment out this line # add the following LogFile /usr/local/clamav/logs/clamd.log the PidFile / usr / local / ClamAV / UPDATA / clamd. pid the DatabaseDirectory / usr / local / ClamAV / UPDATA vim /usr/local/clamav/etc/freshclam.conf #Example // comment out this line # add the following to the DatabaseDirectory / usr / local / ClamAV / UPDATA UpdateLogFile / usr / local / ClamAV / logs / freshclam.log the PidFile /usr/local/clamav/updata/freshclam.pid
IMPLEMENTATION
1. Update the virus definitions
/usr/local/clamav/bin/freshclam
2. anti-virus scanning
Parameters: -r recursive scan subdirectories -i Show only discovered the virus file -no-summary statistics do not show usage: - Help / usr / local / ClamAV / bin / clamscan --help - default scanning the current directory file, and display the results of the scan statistics / usr / local / ClamAV / bin / clamscan - scan all directories and files in the current directory and display the results of the statistical information / usr / local / ClamAV / bin / clamscan -r - scan all directories and files under directory data, and displays the results of the statistical information / usr / local / ClamAV / bin / clamscan -r / data - all directories and files in the directory scanning data show only a problem of the scan results / usr / local / ClamAV / bin / clamscan -r --bell -i / data - all directories and files in the scan data directory, does not display statistics / usr / local / clamav / bin / clamscan --no-summary -ri / data
3. Automatic and regularly updated antivirus
General use scheduled tasks, so that the server regularly updated anti-virus and timing every day, save the anti-virus log. Set crontab regular tasks. * * *. 3. 1 / usr / local / ClamAV / bin / freshclam --quiet 20 is. 3 * * * / usr / local / ClamAV / bin / -R & lt clamscan / Home --remove -l /var/log/clamscan.log