Filtering Web banner ads from Linux

In conjunction with this month's Web and You feature on blocking Web ads, we look at some methods of bypassing these annoyances in a Linux world. Web advertisements can be removed using software that acts as a filter. This software is known as a proxy server. Once set up, any Web browser that supports proxies can use the filter seamlessly to access the Web, advertisement free.

Internet Junkbuster, included on this month's cover CD, is the easiest-to-install advertisement filter for Linux currently available. It is quite good at filtering common types of advertisements and, additionally, it can also filter cookies and other information that is sometimes used to track you as you browse the Internet.

Installation

The proxy server should be installed on the computer you use to "access the Internet. For most people, this will be your Linux computer, but if you are running an Internet gateway/firewall, you should install Internet Junkbuster on this machine instead.

To install Internet Junkbuster, first decompress it by typing in a shell:

$ tar -xvfZ ijb20.tar.Z

Change to the directory created. There is no need to con-"figure Internet Junkbuster for Linux, so to compile it simply type:

$ make

Now that Internet Junkbuster has been compiled, it can be installed by typing as root:

$ cp junkbuster /usr/local/bin

The next step in installing Internet Junkbuster is configuring the filtering rules. A sample configuration file (junkbstr.ini) has been included in the Junkbuster directory. If you are interested in maximising Internet Junkbuster's complete functionality, read this file and use it as a blueprint for your own configuration file. Alternatively, create a file as root in /etc using your text editor with the following contents:

blockfile /etc/blockfile.ini

The blockfile is a listing of Web addresses that the Internet Junkbuster proxy will filter from your Web browser. Next you need to create the file /etc/blockfile.ini. We have included a sample blockfile.ini in the junkbuster directory on this month's cover CD. It is intended as a sample for you to build your own blockfile from, but it works quite effectively at blocking advertisements from most Web sites. Copy the sample blockfile.ini from the cover CD to /etc as root.

You can now test Internet Junkbuster by typing:

$ junkbuster /etc/junkbstr.ini &

To use the filter with your Web browser, edit your browser's configuration options and set the http proxy server to "127.0.0.1" (or the IP of the server on which you installed Internet Junkbuster) with a port of "8000". Most browsers keep this configuration under 'Advanced' (FIGURE 1).

After following these steps, you should now be able to view the Internet advertisement free. The space where ads once ran will now display an empty image, ensuring that your favourite Web site's layout isn't broken.

The final step for installing Junkbuster is to include it as an application that starts when you boot your computer. Depending on your Linux distribution, this file will either need to be created in /etc/init.d or /etc/rc.d/init.d. You may need to modify this file for your system. My Junkbuster initialisation file is as follows:

#!/bin/sh

case "$1" in

  start)

   echo -n "Starting Internet Junkbuster"
   /usr/local/bin/junkbuster /etc/junkbstr.ini &
   ; Br> ; stop)
   echo -n "Stopping Internet Junkbuster"
   killall junkbuster
;;
  restart|force-reload)
   sh $0 stop
   sh $0 start
   ;;
  *)
   echo "Usage: /etc/init.d/internetjunkbuster {start|stop|restart|force-reload}"
   exit 1
   ;;
esac

exit 0

Once this file has been created, save it to the correct path and name the file "internetjunkbuster". The file needs to be made executable by typing:

$ chmod +x /etc/init.d/internetjunkbuster

On reboot, Internet Junkbuster should start automatically. You can stop it by typing /etc/init.d/internetjunkbuster stop.

Join the PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Essentials

Lexar® JumpDrive® S57 USB 3.0 flash drive

Learn more >

Microsoft L5V-00027 Sculpt Ergonomic Keyboard Desktop

Learn more >

Mobile

Lexar® JumpDrive® S45 USB 3.0 flash drive 

Learn more >

Exec

Lexar® Professional 1800x microSDHC™/microSDXC™ UHS-II cards 

Learn more >

Audio-Technica ATH-ANC70 Noise Cancelling Headphones

Learn more >

HD Pan/Tilt Wi-Fi Camera with Night Vision NC450

Learn more >

Lexar® JumpDrive® C20c USB Type-C flash drive 

Learn more >

Budget

Back To Business Guide

Click for more ›

Most Popular Reviews

Latest News Articles

Resources

PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?