Free OpenSource Antivirus for Ubuntu: ClamAV

Right now, it's true that in comparison with MS Windows, GNU/Linux operating system is somewhat better equipped to fight against computer viruses and hacker attacks (heck, it was even invented by the "white" hackers) thanks to the open nature of the programming code + the amazingly powerful community.

But perhaps that could also be because GNU/Linux or Ubuntu in this case, is not that popular as MS Windows is, thus "bad hackers" are just too lazy to give it a go :) (only time will tell).

In that sense, I think although not everyone may not need one right now (I think we could run few more years safely :D), but at least knowing how to setup an antivirus software in Ubuntu won't hurt since you never know when you're gonna need one.

Although there are plenty of anti-virus scanners for Ubuntu these days but most of them are proprietary ones + don't have a GUI at all (except for the Avira's Linux edition), so I thought of writing about ClamAV antivirus scanner (which most of the geeks already know) which is an opensource (GNU/GPL licensed actually) utility that even supports MS Windows (why? :P).

ClamAV (with the separate GTK+/GUI installed)...
But to be honest, ClamAV is not the best nor its as good as some of the above mentioned proprietary ones, but since GNU/Linux ain't having any computer virus crisis at the moment, I piked it. On the other hand, it's a pretty decent virus scanner and as the time goes on, I'm pretty sure it'll evolve and become a powerful source against viruses in the GNU/Linux world.  

Main features...

*. By default, ClamAV is actually a command-line utility thus doesn't have a GUI. But luckily there's a separate, Python written, GTK2+ front-end called "ClamTK" which we can use nonetheless.

*. Scan a file, folder, location, your "Home" folder or a device manually.

Scanning my "Home" folder...
*. View/delete quarantined items.

*. Schedule virus scanning.

*. "Quick" and "Recursive" scan modes.

*. Automatic or manual update of both antivirus scanner and the virus definitions.

*. Submit a file for the developers to analyze (which also helps to improve this opensource antivirus scanner). 

*. Add folders/locations that you don't want ClamAV to scan.

*. And few other additional scanning related settings via the preferences window.

How to install ClamAV in Ubuntu Linux?

Since it's in the official repositories of Ubuntu, you can easily install ClamAV in Ubuntu 11.04 Natty Narwhal, 10.10 and 10.04 by using the below commands in your terminal window.

I personally like to use its dedicated PPA for this since the official repositories does not include the latest builds of the "ClamAV-engine".
sudo apt-add-repository ppa:ubuntu-clamav/ppa

sudo apt-get update

sudo apt-get install clamav
This will install the core-engine (the original command-line version). But since we do need a GUI, we can install ClamTK by using the below command.
sudo apt-get install clamtk
Now, by default, ClamAV does not run in your Ubuntu OS background as a service. Thus, other than when you manually open the GUI and scanning for viruses... other times it won't be able to detect any virus activities.

So, if you want maximum protection, meaning that ClaimAV has to always run in your OS as a service (just like with other anti-virus scanners do), always looking for those bad suckers :P, then you can do so by installing its "daemon" by using the below command.
sudo apt-get install clamav-daemon
Now the final step, we gotta make sure that ClamAV is up-to-date. To do that, although we can use the command-line as well but the since the GUI makes things much more easy, let's launch it first.

For that, press "Alt" + "F2" keys and enter the below command and press the enter key (as hard as you can, kidding!).
From its menu go to: "Help" -> "Check for updates" and from the next window that you get simply click on the button "Check for Updates" and the rest should be taken care of!.

Now to let ClamAV fully integrated into the Ubuntu Linux OS, you'll have to re-boot your PC/Laptop. You can access the GUI window by using the above command ("clamtk") OR from the main desktop menu go to:
"Applications -> Accessories -> Virus Scanner"
But if you want it to look and clean all the places in GNU/Linux, then you gotta run it with the "sudo" or with administrative privileges. For that again, press "Alt" + "F2" keys and use the below command and when asked, enter your root password.
gksudo clamtk
Now you have successfully installed and configured the ClamAV virus scanner in Ubuntu. Enjoy!.


Anonymous said...

Thank you! Finally a helpful tut.!

Anonymous said...

Very useful, Easy to understand

Gayan said...

@ Anonymous 1 & 2,

You are both welcome :D.

Post a Comment