How to install and configure Privoxy on CentOS 6

To install and configure Privoxy on CentOS 6

Privoxy is an open source non-caching web proxy server like Squid proxy, which allows some advanced features like ad blocking, web content filtering, modifying web page data and HTTP access, controlling access and blocking unwanted site’s etc. It is so simple to install Privoxy on CentOS and this tutorial covers the ground on the same process. 

 

To Install and Configure Privoxy

Fist make sure you Install epel repository by making use of the following command.

[root@proxy ~]# yum install epel-release -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Determining fastest mirrors
 * base: mirror.vbctv.in
 * extras: mirror.vbctv.in
 * updates: mirror.vbctv.in
base                                                                                                                                                                                 | 3.7 kB     00:00    
extras                                                                                                                                                                               | 3.4 kB     00:00    
updates                                                                                                                                                                              | 3.4 kB     00:00    
updates/primary_db                                                                                                                                                                   | 6.4 MB     00:00    
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:6-8 will be installed
--> Finished Dependency Resolution
.
.
.
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : epel-release-6-8.noarch                                                                                                                                                                  1/1
  Verifying  : epel-release-6-8.noarch                                                                                                                                                                  1/1

Installed:
  epel-release.noarch 0:6-8                                                                                                                                                                                

Complete!

 

Now make sure you install Privoxy by executing the following command. 

[root@proxy ~]# yum install privoxy -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirror.vbctv.in
 * epel: epel.scopesky.iq
 * extras: mirror.vbctv.in
 * updates: mirror.vbctv.in
Resolving Dependencies
--> Running transaction check
---> Package privoxy.x86_64 0:3.0.24-2.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

.
.
.
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : privoxy-3.0.24-2.el6.x86_64                                                                                                                                                              1/1
  Verifying  : privoxy-3.0.24-2.el6.x86_64                                                                                                                                                              1/1

Installed:
  privoxy.x86_64 0:3.0.24-2.el6                                                                                                                                                                             

Complete!

 

 

After installing we can find Privoxy configuration in /etc/privoxy directory. 

root@proxy ~]# cd /etc/privoxy/
[root@proxy privoxy]# ll
total 260
-rw-r--r-- 1 root root 62305 Jun 21  2016 config
-rw-r--r-- 1 root root 91347 Jun 21  2016 default.action
-rw-r--r-- 1 root root 40438 Oct 17  2014 default.filter
-rw-r--r-- 1 root root   627 Mar 28  2010 match-all.action
-rw-r--r-- 1 root root 39009 Nov 20  2014 regression-tests.action
drwxr-xr-x 2 root root  4096 Feb 12 15:24 templates
-rw-r--r-- 1 root root  3761 Jun 22  2009 trust
-rw-r--r-- 1 root root  8794 Nov  6  2011 user.action
-rw-r--r-- 1 root root     0 Jun 21  2016 user.filter

Here the main configuration file is config, and it has 2 categories of configurations like action files and filter files. Action files have match-all.action, default.action & user.action and then filter files has default.filter & user.filter. 

 

So we need to use the above configurations in-order to configure your own proxy setup. Now let’s configure the basic proxy setup, now open your main configuration file and do the steps as shown below. 

[root@proxy privoxy]# vim config

 

Change the value as mentioned below with your IP address of the proxy server.

listen-address 192.168.7.222:8118      (Line No: 783)

 

Next, you need to configure the log file path, the default path is /var/log/privoxy, it will be mentioned in your config file as shown below. 

logdir /var/log/privoxy                (Line No: 348)

 

You can modify the above-mentioned line if you want, and below the line, you can change the log file name in your configuration file also. 

logfile logfile                        (Line No: 481)

 

Now look for debug levels and there you can find the below levels for debugging. We need to enable this option for logging.  

debug     1 # Log the destination for each request Privoxy let through.                   (line no: 571)
debug     2 # show each connection status
debug     4 # show I/O status
debug     8 # show header parsing
debug    16 # log all data written to the network
debug    32 # debug force feature
debug    64 # debug regular expression filters
debug   128 # debug redirects
debug   256 # debug GIF de-animation
debug   512 # Common Log Format
debug  1024 # Log the destination for requests Privoxy didn't let through, and the reason why.
debug  2048 # CGI user interface
debug  4096 # Startup banner and warnings.
debug  8192 # Non-fatal errors
debug 32768 # log all data read from the network
debug 65536 # Log the applying actions

 

After all the configuration is done in your config file, start the privoxy service. 

[root@proxy privoxy]# service privoxy start

 

 

Now the proxy is setup, go to your browser and change network proxy settings with your IP address. 

proxy

 

Now the proxy is set with default ad-blocking you can check with access any advertising website then you may find the blocked page like shown below. 

blocking

With this, the method to install and configure on CentOS 6. 


Thank you! for using Linux Help.

You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website www.linuxhelp.com
Be the first to comment, we value your suggestions. For further queries please comment below.

Tags: CentOS Privoxy
user image Author :  Sebastian