Why would I use Antivirus in a Linux system?
Some of you may be wonder why would we install an Antivirus while Linux is a virus free operating system. Well, let me give you some reasons why it is some important to use an antivirus for Linux OS’s.
- Linux is Virus free, right? But, not as secure as you think in some cases. There are so few virus programs available to infect a Linux system, but they might do only minor issues, and don’t any harmful or serious damage to the Linux system as like in a Windows or other operating system.
- You may have chance to copy some files/folders from a net-cafe system, and want to use them in your home Linux computer. In this case, your home computer installed with Linux OS might be attacked by the viruses which you copied from the net-cafe system along with some files.
- Still, many people use Windows OS for some reasons, like gaming. In such cases, if you have dual boot(Windows & Linux), It is advisable to use an antivirus program in your Linux system. Prevention is better than cure, right?
- If your Linux server acts like a central file server or something else in your home or organization network and connected with many different kind of computers(Linux, WIndows, Mac OS X etc.), then It is also recommended to use antivirus to prevent the unwanted virus issues.
Install AVG Free Antivirus On Linux
Download the latest edition depending upon your distribution from the free AVG download page.
Go to the download location and enter the following commands to install AVG Free edition. Be mindful that all commands should be run with root user privileges. I tested this article on Ubuntu 14.04, and also, I have included the installation steps for other distributions too.
On DEB based systems:
apt-get install gdebi wget http://download.avgfree.com/filedir/inst/avg2013flx-r3118-a6926.i386.deb gdebi avg2013flx-r3118-a6926.i386.deb
Sample output:
Reading package lists... Done Building dependency tree Reading state information... Done Building data structures... Done Building data structures... Done AVG Anti-Virus for Linux/FreeBSD Do you want to install the software package? [y/N]:y Selecting previously unselected package avg2013flx. (Reading database ... 160172 files and directories currently installed.) Preparing to unpack avg2013flx-r3118-a6926.i386.deb ... Unpacking avg2013flx (2013.3118) ... Setting up avg2013flx (2013.3118) ... Installing 'avgd' service initscripts... Registering 'avgd' service to runlevels... Adding system startup for /etc/init.d/avgd ... /etc/rc0.d/K20avgd -> ../init.d/avgd /etc/rc1.d/K20avgd -> ../init.d/avgd /etc/rc6.d/K20avgd -> ../init.d/avgd /etc/rc2.d/S20avgd -> ../init.d/avgd /etc/rc3.d/S20avgd -> ../init.d/avgd /etc/rc4.d/S20avgd -> ../init.d/avgd /etc/rc5.d/S20avgd -> ../init.d/avgd Please do configuration with /opt/avg/av/bin/avgsetup Generating unique user id Processing command line ... Cfg file not specified using /opt/avg/av/cfg/diagcfg.xml. New installation ID succesffully generated. * Starting avgd ... [ ok ] Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
On RPM bases systems:
wget avg2013flx-r3118-a6926.i386.rpm
rpm -i avg2013flx-r3118-a6926.i386.rpm
Install AVG from ‘binary’ file:
Download the tar files and compile it your self as shown below.
wget http://download.avgfree.com/filedir/inst/avg2013flx-r3118-a6926.i386.tar.gz
tar xzvf avg2013flx-r3118-a6926.i386.tar.gz
Change to the location where you extracted the tar file.
Run the following command to install it.
./install.sh
Install AVG from ‘.sh’ file:
Download the .sh file. Set executable permission.
wget http://download.avgfree.com/filedir/inst/avg2013flx-r3118-a6926.i386.sh
chmod +x avg2013flx-r3118-a6926.i386.sh
Then, install it using command:
./avg2013flx-r3118-a6926.i386.sh
On BSD systems:
Download the AVG program for FreeBSD:
wget http://download.avgfree.com/filedir/inst/avg2013ffb-r3115-a6155.i386.tar.gz
tar xzvf avg2013ffb-r3115-a6155.i386.tar.gz
Change to the location where you extracted the tar file, and run the following command to install it.
./install.sh
Configure AVG
As you see in the installation method on Ubuntu, AVG is installed and started, but not configured. You may see the output that reads:
Please do configuration with /opt/avg/av/bin/avgsetup
Run the following command to configure AVG antivirus.
sudo /opt/avg/av/bin/avgsetup
Sample output:
Choose what you want to do. In our case, let us setup On-access for Real-time protection.
AVG command line setup Copyright (c) 2013 AVG Technologies CZ Your location: Start Welcome to the AVG for Linux/FreeBSD Deployment Wizard. The Wizard will help you deploy AVG according to your needs. Please choose what you want to do now: M) Set up the TCPD protection for E-mail Server O) Set up On-Access for Real-time protection E) Exit Type [M|O|E]: O
Select the on-access engine:
AVG command line setup Copyright (c) 2013 AVG Technologies CZ Your location: Start -> On-Access Deployment Deploying On-Acces for Real-time protection Please select the On-Acces engine used for securing: R) RedirFS engine (only Linux kernel up to 2.6.37 version) F) Fanotify engine (only Linux kernel from 2.6.36 version) S) Samba plugin (Linux and FreeBSD) D) Dazuko module (FreeBSD up to 8.x or Linux up to 2.6.22 version) B) Go to back E) Exit Type [R|S|D|F|B|E]: F
Enter the path of the directory you want to secure. In my case, I want to secure my /home directory, so I just pressed the Enter key.
AVG command line setup Copyright (c) 2013 AVG Technologies CZ Your location: Start -> On-Access Deployment -> Fanotify engine Checking the settings for fanotify in the /boot directory... Please enter the full path to the directory you want to secure (e.g. /home/; do not use relative paths or links to the directory; for multiple directory use pipes - e.g. '/home/|/var/samba/' or type 'Enter' for default /home/ directory):
That’s it. We have configured AVG successfully and secured our /home directory.
AVG command line setup Copyright (c) 2013 AVG Technologies CZ Your location: Exit: Success! Congratulations, AVG pro Linux/FreeBSD has been deployed successfully. If you experience problems with AVG, please refer to /opt/avg/av/log/0//deployment.pub.log or contact the technical support. Please choose what you want to do now: N) Continue deploying AVG for another kind of protection. E) Terminate the deployment. Type [N,E]:E
Choose the any one of the above options whether you want to complete(Terminate) the deployment or Continue deploying AVG for another kind of protection. In my case, I don’t want any other deployment, so I entered the letter ‘E’ to Terminate the deployment.
Updating AVG
The very first step is to check whether there are any new updates available to AVG.
To do that, enter:
sudo avgupdate
Sample output:
AVG command line update Copyright (c) 2013 AVG Technologies CZ Running update. Initializing... Downloading file: avg13infolx.ctf Analyzing... 100% [===================================>] You are currently up-to-date Update was successfully completed.
Scanning Files/Folders
Let us scan some directories to check for any viruses.
Syntax:
sudo avgscan <options> <path1> <path2> ...
Example:
Here, I am going to scan my directory, and store the results in /tmp/avscan.log file.
sudo avgscan -aPcijk -r /tmp/avgscan.log /home/sk/Downloads/
Sample output:
AVG command line Anti-Virus scanner Copyright (c) 2013 AVG Technologies CZ Virus database version: 4257/9260 Virus database release date: Mon, 09 Mar 2015 08:36:00 +0530 Files scanned : 10246(180) Infections found : 0(0) PUPs found : 0 Files healed : 0 Warnings reported : 0 Errors reported : 0
Hurray! I don’t have any infected location on the scanned directory. Let’s now check the output logfile.
cat /tmp/avgscan.log
Read the man pages to know more details of the available options.
man avgscan
Conclusion
I wouldn’t say Antivirus program for Linux is important, but it is recommended if you running Linux system in a mixed mode network environments. If you want to secure more efficiently, it is better to go for a firewall solution.
That’s it. Cheers!