How to install ClamAV on Linux

How to install.

#1. Download the file using wget.

$ sudo wget http://pkgs.repoforge.org/clamav/clamav … x86_64.rpm
$ sudo wget http://pkgs.repoforge.org/clamav/clamav … x86_64.rpm

The following commands should install it.
$ sudo rpm -ivh clamav-0.97.2-1.el5.rf.x86_64.rpm
$ sudo rpm -ivh clamav-db-0.97.2-1.el5.rf.x86_64.rpm

Now that it is installed there are a few things we need to know about ClamAV and perform. First thing to do would be to update the definitions.
To do this run the command freshclam.
Freshclam will require an internet connection to download & update all the new virus definitions.
All that should need to be done is type the command freshclam and the rest should be automatic.

#2. To run ClamAV and show the infected files type the following command.
clamscan -ri /home

#3. To remove the infected files and emails etc… Type the following command.
clamscan -ri –remove /home

#4. To run as a daily Cron Job.
To run ClamAV as a Cron Job (daily automatically scan)Type the following command from your command line.
crontab -e f
Then you should add the following command line and then save the file.
This should add it to my root crontab for the below example.
05 2 * * * root clamscan -R /var/www
This should run the Cron Job daily at 2.05 AM scanning the public_html files.
You should be able to change the folder to whichever folder you prefer.
00 10 * * * * root freshclam
This command will update ClamAV database at 10 am every day.

Leave a comment