Avast on Linux  Monday 5th March 2012, 16:35

Just thought I'd do a quick post about something I just got working. Not especially complicated, but I had to get the resources from three or four different locations; my idea being to collate the ideas together for others and me when I forget how to do it again!

The Problem
My sister has kindly given me all of her old computers in a vain attempt to construct at least one that works, however none of them were bootable and therefore she has a lot of data. She does want to have a look through this data to see if there is anything she wants to keep, easy enough by copying it all to one hard drive and sharing it via FTP so she can peruse it at her leisure.

However, knowing the level of expertise of the average computer user I'm not happy that these machines aren't plagued with viruses, and I really don't want to connect them to my Windows install!

The Solution
Unfortunately my preferred anti-virus solution Avast only has an x86 Linux client, whereas I am using an x64 version of Ubuntu on my server (which will be providing the FTP service). The following code snippet will force it to install regardless and apply a patch that will actually make the program run as well!

Code: Installing Avastsudo apt-get install ia32-libs
sudo dpkg --force-architecture -i avast.deb
sudo sysctl -w kernel.shmmax=100000000

Where the avast.deb can be found on Avast's website at Avast Home for Linux.
Note first we need to install the ia32-libs library which contains some bits-and-pieces to allow 32-bit applications to run under a 64-bit environment. The next line uses dpkg to install the application but forcing it to install regardless of the different architecture.

Even though Avast contains a graphical user interface it will still work under a command line if we run the command line in a terminal.

Cron to the rescue!
Now I'm not a fan of having to remember to run virus scans, especially as my 1TB RAID is fairly full and this will take a month of Sundays...

The following are my commands I set using cron through Webmin. First of all run the avast-update command every day to check that the virus definitions are up-to-date. I didn't provide this as a code snippet as it merely runs the aforementioned command at the schedule.
The second (provided) will run the actual Avast virus scan twice a week (at a schedule where the server will actually be on) on my home directory where all my stuff is.

Code: Avast Scan Cron Commandavast -a -c -r=/home/tom/Scans/`date +%Y-%m-%d`.txt /home/tom

This command is obviously more complicated, but it merely provides a thorough and full scan (-a -c) on my /home directory and puts the report in the bespoke 'Scans' folder. Also I've got it naming the files based on the start date in the conventional 'year-month-day' format. I can then look at these files whenever convenient and deal with any infections which will be reported within the report file!

I can now run Avast manually to scan just my sisters' files on the extra hard drive, but with the addition of constant virus scanning of all my data on my server. I didn't get it to scan the entire home directory because of all my MythTV recordings. There shouldn't be any viruses there, and at 500GB I'd prefer to leave it be.

Previous Blog Post Next Blog Post