Atlantic.Net Blog

How to Install and Configure Privoxy Server On CentOS 8

Hitesh Jethva
by Atlantic.Net (414 posts) under Tutorials, VPS Hosting
0 Comments

Privoxy is a free and non-caching web proxy server. A web browser uses this proxy server before connecting to the Internet directly. Privoxy is mainly used for security and to improve efficiency through its advanced caching features. Privoxy has advanced filtering capabilities including ad-blocking, web content filtering, modifying web page data and HTTP access, controlling access and blocking unwanted sites, and more.
It is simple, easy to configure, and highly customizable.

In this post, we will show you how to install and configure the Privoxy server on CentOS 8 VPS.

Prerequisites

  • A fresh CentOS 8 server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing CentOS 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your CentOS 8 server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install Privoxy

By default, the Privoxy package is not included in the CentOS default repo, so you will need to install the EPEL repo to your system. You can install it with the following command:

dnf install epel-release -y

Once EPEL is installed, you can install the Privoxy server with the following command:

dnf install privoxy -y

Privoxy server stores all their configuration files at /etc/privoxy/. You can check them with the following command:

ls -l /etc/privoxy/

You should see the following output:

-rw-r--r-- 1 root root  84868 Mar  1 12:22 config
-rw-r--r-- 1 root root 109864 Mar  1 12:22 default.action
-rw-r--r-- 1 root root  43970 Feb 25 12:54 default.filter
-rw-r--r-- 1 root root    600 Feb 25 12:54 match-all.action
-rw-r--r-- 1 root root  42259 Feb 25 12:54 regression-tests.action
drwxr-xr-x 2 root root   4096 May 26 02:29 templates
-rw-r--r-- 1 root root   3565 Feb 25 12:54 trust
-rw-r--r-- 1 root root   9012 Feb 25 12:54 user.action
-rw-r--r-- 1 root root      0 Mar  1 12:22 user.filter

Step 3 – Configure Privoxy

By default, the Privoxy server listens to the localhost, so you will need to configure it to listen to the IP address. You can do it by editing the Privoxy default config file:

nano /etc/privoxy/config

Find the following line:

listen-address  127.0.0.1:8118

Change it with the following line:

listen-address  your-server-ip:8118

Next, uncomment the following lines:

logdir /var/log/privoxy
logfile logfile

       debug     1 # Log the destination for each request. See also debug 1024.
        debug     2 # show each connection status
        debug     4 # show tagging-related messages
        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

Save and close the file, then start the Privoxy service using the following command:

systemctl start privoxy

You can check the status of the Privoxy with the following command:

systemctl status privoxy

You should get the following output:

● privoxy.service - Privoxy Web Proxy With Advanced Filtering Capabilities
   Loaded: loaded (/usr/lib/systemd/system/privoxy.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-05-26 02:34:04 EDT; 5s ago
  Process: 41499 ExecStart=/usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy /etc/privoxy/config (code=exited, status=0/SUCCESS)
 Main PID: 41500 (privoxy)
    Tasks: 1 (limit: 12524)
   Memory: 1.4M
   CGroup: /system.slice/privoxy.service
           └─41500 /usr/sbin/privoxy --pidfile /run/privoxy.pid --user privoxy /etc/privoxy/config

May 26 02:34:03 centos8 systemd[1]: Starting Privoxy Web Proxy With Advanced Filtering Capabilities...
May 26 02:34:04 centos8 systemd[1]: Started Privoxy Web Proxy With Advanced Filtering Capabilities.

At this point, the Privoxy server is started and listening on port 8118. You can check it with the following command:

ss -antpl | grep 8118

You should see the following output:

LISTEN    0         128          104.245.32.188:8118            0.0.0.0:*        users:(("privoxy",pid=41500,fd=7))                                             

Step 4 – Configure Web Browser to Use Privoxy Proxy

Next, you will need to configure your web browser to the Privoxy server as a proxy server.

First, go to the client system, open your Firefox web browser => and click on Edit => Preferences. You should see the following page:

Firefox settings
Now, click on Network Settings => Settings. You should see the following page:

Firefox proxy settings
Now, provide your Privoxy server IP and port and click on the Ok button to save the changes.

At this point, your web browser is configured to use the Privoxy server before connecting to the internet.

Now, open your web browser and access the URL https://www.whatismyip.com to check your public IP address. If everything is fine, you should see your Privoxy server IP on the following page:

Check Public IP

By default, the Privoxy server is configured to block any advertising site. To check it, open a new tab in your web browser and access any advertising site http://advertise.com/.
Website blocked
As you can see, your request for http://advertise.com/ was blocked.

Conclusion

Congratulations! You have successfully installed and configured the Privoxy server on your CentOS 8 virtual private server. You can now use some advanced filter in the Privoxy server and block your desired contents.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Top 10 Best Cybersecurity Training Services
How to Install Ansible on Oracle Linux 8
How to Install LEMP Server on Oracle Linux 8
How to Install and Configure Apache Webserver on Oracle Linux 8
How to Install and Configure Nginx Webserver on Oracle Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2008 Lookout Dr,

Dallas, Texas 75044

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources