Install ClamAV in Ubuntu

ClamAV is a free and open-source Antivirus toolkit available for Linux. It can scan for server-side email viruses. In addition to scanning mail attachments, it supports standard mail file formats. Its a command-line scanning tool but if you want a GUI then use ClamTk. ClamAV utilizes Milter interface for Sendmail and has built-in support for various file formats. In this article, we cover how to install ClamAV Antivirus in Ubuntu.

The package clamav is available through main repository of Ubuntu. As already mentioned, those who are not comfortable with command line interface can opt to install clamtk package. ClamTk acts as Graphical User Interface front-end for ClamAV.

Install ClamAV in Ubuntu

Note: Following operations require superuser privileges. In case you don’t the required rights, contact your System Administrator for assistance.

The package being available through Main repository of Ubuntu. Therefore, we need to update that first. Hence, open a terminal and issue the following –

sudo apt update

Next, to install ClamAV –

sudo apt install clamav clamav-daemon

Scan for viruses with ClamAV

Use clamscan command-line tool to scan for viruses. For instance, if we want to scan /home directory then –

clamscan -r -i --bell /home

where,

-r, to recursively scan directories,

-i, to display infected files,

–bell, a bell sound if it detects a virus,

/home/ – directory we scan.

Use -v option (verbose) to display files being scanned.

What if we want to move the infected file to a specific directory. Through the command mentioned above, we can only get information about infected files. To move them to a directory use –move option.

clamscan -i -r --move="/home/$USER/Downloads/Infected" /home

The above command will scan the directory /home/ and if infected files are detected then, it will move those files to the directory /home/$USER/Downloads/Infected.

Enter clamscan -h in the terminal for more options.

Install clamtk in Ubuntu

Not everyone is comfortable using command-line tools. So, if you wish ClamAV to have a graphical front-end. Then install the package – clamtk

sudo apt update
sudo apt install clamtk

Launch the package – ClamTk from your systems’ main menu. Through ClamTk, we can easily scan a file/directory or update database etc.

In conclusion, we have covered here how to install ClamAV Antivirus in Ubuntu.

Similar Posts