How to Install and Use Privoxy on Ubuntu 16.04

This guide on how to Install and configure privoxy on Ubuntu 16.04 / Debian 9 is intended to help you install, configure and use Privoxy on your Desktop or as a server in your LAN where all other users can use it. Before we dive to installation and configurations part, let's define Privoxy and see its features.

Read also  CTparental - Featured Parental Control Tool for Linux

What's Privoxy?

Privoxy is a piece of software which acts as a non-caching web proxy. A web proxy is a service that web browsers can use instead of connecting to web servers directly. The web browser then asks the proxy to request objects like web pages and images on their behalf and forwards the data back. Privoxy has advanced filtering capabilities which aim at:

  • Enhancing user's web privacy
  • Modifying web page data and  HTTP headers before forwarding to browsers.
  • Filtering outbound personal information that your browser may leak
  • Removing ads on web pages and other Inbound junk

The main reason for using proxy servers like Privoxy is for privacy, security and to improve efficiency through it advanced caching features. Privoxy is highly customizable through its easy to edit configuration files.  The default installation should give you a good starting point, and block most ads and unwanted content, but many of the more advanced features are off by default and require you to activate them.

Installing Privoxy

Privoxy package is available on upstream repositories for Ubuntu and it can be installed using apt-get package manager.

$ sudo apt-get install privoxy

All its configuration files will be located under /etc/privoxy directory.

# ls -l /etc/privoxy/ | awk '{ print $9 }'
config
default.action
default.filter
match-all.action
templates
trust
user.action
user.filter

Even though web browsers nowadays have built-in features similar to privoxy, the proxy is a good choice if you use multiple browsers, or have a LAN with multiple computers since Privoxy can run as a server application. This way all the configuration is in one place, and you don't have to maintain a similar configuration for possibly many browsers or users.

Configure Browser to use Privoxy

Before you start using privoxy service,  you need to configure your browser(s) to use Privoxy as an HTTP and HTTPS (SSL) proxy. The default is 127.0.0.1 (or localhost) for the proxy address, and port 8118. Any browser that can be configured to use a proxy, which should be virtually all browsers, including Firefox, Internet Explorer, Opera, and Safari among others. This setting is usually located under preferences settings section.

If you're setting Privoxy on a server in your LAN, make sure to replace 127.0.0.1 with the IP address of the server machine. On Privoxy main configuration file /etc/privoxy/config, add a line like below with your host IP address.

listen-address 192.168.1.1:8118

This will bind privoxy service to 192.168.1.1 ip address. Save the file, and restart Privoxy. Configure all browsers on the network to use this address and port number. Alternately, you can have Privoxy listen on all available interfaces:

listen-address :8118

To start proxy manually, run the command:

$  sudo systemctl start privoxy

If for any reason it is not enabled to start on boot up, enable it using:

$ sudo systemctl enable privoxy

You can then confirm the service is running using:

$ sudo systemctl status privoxy
● privoxy.service - Privacy enhancing HTTP Proxy
 Loaded: loaded (/lib/systemd/system/privoxy.service; enabled; vendor preset: enabled)
 Active: active (running) since Rob 2018-02-07 10:38:02 EAT; 2min 17s ago
 Process: 3273 ExecStart=/usr/sbin/privoxy --pidfile $PIDFILE --user $OWNER $CONFIGFILE (code=exited, status=0/SUCCESS)
 Main PID: 3274 (privoxy)
 CGroup: /system.slice/privoxy.service
 └─3274 /usr/sbin/privoxy --pidfile /var/run/privoxy.pid --user privoxy /etc/privoxy/config

Gur 07 10:38:01 mypc systemd[1]: Starting Privacy enhancing HTTP Proxy...
Gur 07 10:38:02 mypc systemd[1]: Started Privacy enhancing HTTP Proxy.

You should as well be able to see the service listening on a tcp port 8118 by using ss or netstat commands.

# ss -tunelp | grep 8118
tcp LISTEN 0 128 127.0.0.1:8118 *:* users:(("privoxy",pid=3274,fd=4)) uid:125 ino:30414 sk:e <->

Testing Privoxy

To test whether Privoxy is working fine after changing proxy settings on your browser, try visiting the web URL http://p.p/. This should direct you to Privoxy main page where you can view its status and local server configurations.

For more advanced configurations, visit Provoxy configuration guide page.

Uninstall Privoxy on Ubuntu 16.04 / Debian 9

To uninstall Privoxy, use the apt-get remove commands followed by the package name.  It's recommended to remove it with its dependencies as below:

$ sudo apt-get remove --auto-remove privoxy

Wrapping Up

In this Install and configure privoxy on Ubuntu 16.04 / Debian 9, we have covered all the basics needed to start using Privoxy. If you intend to block annoying ads on the web and browse securely, this tool is right for you. You can do so much more like blacklisting and whitelisting websites for access control functionalities. All this is easy to achieve, you just need to edit its text-based configuration files and boom! you're good to go. You can visit Privoxy main page to learn more about it.

Josphat Mutai 12:05 am

About Josphat Mutai

Red Hat Certified Engineer with more than 2 years experience managing critical Cloud Infrastructures and Services. Passionate about Technology and loves testing and reviewing gadgets and Open-source tools.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.