How to install antivirus in Linux Ubuntu Server and then perform a scan and remove viruses

Installing antivirus in Ubuntu Server then performing a scan then remove the virus.

How to install antivirus in Linux Ubuntu Server and then perform a scan and remove viruses
Image Source -
Learn how to install an antivirus in Linux Ubuntu Server. Learn how to scan and learn how to remove the virus found.

It is not common for a Linux (Ubuntu) to have a virus especially if it is a server because there are not much of a virus in the wild that is made for Linux. I have been working as an I.T. since 2004 and I have not come into an article wherein a problems regarding virus in Linux is discussed. So it is a little bit of a not in urgency to install an antivirus in Linux. But not all situations are the same so I have wrote this article on how you can install an antivirus then eventually perform a scan and then remove the virus.

On this article we are going to install an antivirus into a Linux Ubuntu Server 12.04 version. But I think it will also be applicable in other version of Ubuntu, be it a desktop version or a server version since they are almost identical.

Bear in mind that Ubuntu is based in a debian distribution of Linux so it is easy or safe to say that this article will also be applicable in some version of Debian linux distributions. I am gonna be discussing here on how to install an open source antivirus called ClamAV.

Basically if we are installing an antivirus into an Ubuntu Server we are going to do it in command line or terminal because server editions of Ubuntu or Linuxes mostsly don't have a GUI (Graphical User Interface) that we always found on a Windows type of computer server. So here we go...

Step 1 is to type this in terminal

sudo apt-get install clamav

Step 2, after installation we have to update first the antivirus so that we can make sure that it is updated to the latest available virus definitions, type this again in terminal

sudo freshclam

sudo means "super doer", always append sudo at the beggining of the command you are issuing in the terminal to make sure that the command or syntax will work. It will always ask you for  a password though.

After updating we now proceed to the next step which is scanning the Ubuntu Server.

Step 3, to scan a specific location or folder in your Ubuntu Server type this in terminal

sudo clamscan -r -i --remove /srv/samba/share

-r means scan all the files in /srv/share/samba, -i means show only infected files while scanning, --remove means removing the infected files. Be careful in using the -remove syntax if you are not sure on what you are doing because it might deleted important infected files, /srv/samba/share means the directory wherein my files is shared in a samba server.

--remove works for me because my Ubuntu Server is just functioning only as a Samba File Server. ClamAV did remove all the viruses in the samba share.

After it is done you can now check the directory if there is still virus left in the samba shared folders.

Let us know how you like this article. Like it and Rate it below.
521 0
0 stars - by 0 user(s)

Related Articles

This article gives an introduction to Finite Element Method. Finite element method (FEM) is a numerical approach to solution of engineering problems involved in the field of Structural Mechanics, Thermal, Electrical and Electronics engineering field.

An intro to the newly created Tech Tonics blog, about the scope and purpose of this endeavour, with a little bit on the relevance of technology in our daily lives, and why the meaningful use of technology is absolutely crucial to stay happy, productive and more organized in this ever-changing world. .

This article explains to setting up remote access to your computer and you can use your system from far away..

Post Your Comment

A very helpful article. Actually I have a query like is it possible that I would mount a filesystem via samba or NFS of remote windows machine into the Local Linux machine , so as to scan that filesystem for any vulnerabilities.


Hi Parpande, I actually haven't tried it yet, nor searched it on the internet. But I think it is possible given the advancement of today's computers and software. Maybe it can also be done by sharing the drive or folder of the Windows machine that you want to scan for any vulnerabilities.