How to Install and Configure a Proxy Server

How to Install and Configure a Proxy Server?

In our Previous Article, we have discussed What is Proxy Server? How do Proxy Servers work? And some need proxy servers. Now you may wonder How to Install and Configure a Proxy Server on your own. So, here is a Tutorial for Installing a proxy server on your own and Configure on various Operating systems and platforms. Here, the proxy server installation means software that runs on your VM or physical machine and configured so that users can use it. So, we take one of the popular opensource Proxy Software called Pi-Hole

Supported Operating System and Platform

Pi-Hole can be instantly run as a container with Docker. Also, we can install the Pi-Hole in the following Operating System.

  • Ubuntu 16.X or 18.X or 20.X under ARM or 64 Bit
  • Debian 9 or 10 under ARM or 64 Bit or i386
  • Fedora 31 or 32 under ARM or 64 Bit
  • CentOS 7 or 8 under 64 bit

Installation of Pi-Hole Proxy Server

As we said, Pi-Hole can be easily installed and Run using Docker Container. Lets see how to Run Pi-Hole in Docker container first.

Install and Configure Pi-Hole on Docker Container.

One of the easy way to create a Docker Image and running Pi-Hole is to use the Docker Source Code of the Pi-Hole.

 Clone it by following command.

$ git clone https://github.com/pi-hole/docker-pi-hole.git
cd docker-pi-hole

Then, look for the file called docker-compose.yml.example and take a copy. after that, rename the Copy to docker-compose.yml.

Then, Edit the docker compose file if needed. And the default Docker compose file will look like this

version: "3"

# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    # For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      TZ: 'America/Chicago'
      # WEBPASSWORD: 'set a secure password here or it will be random'
    # Volumes store your data between container upgrades
    volumes:
      - './etc-pihole/:/etc/pihole/'
      - './etc-dnsmasq.d/:/etc/dnsmasq.d/'
      # run `touch ./var-log/pihole.log` first unless you like errors
      # - './var-log/pihole.log:/var/log/pihole.log'
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

Then Simply run following docker command to run the Pi-Hole Proxy Server

$ docker-compose up –detach

That’s all, Your Pi-Hole Proxy server is up and running. There another simplest way to do the same. You can simply run the shell script under the same directory to create the Pi-Hole Proxy server docker container.

$ ./docker_run.sh

That’s all with the Pi-Hole Proxy Server docker container.

One Step Installation of  Proxy Server

One Step Installation of Pi-Hole Proxy Server on all Linux Distro mentioned above is, Run the following curl command.

$ curl -sSL https://install.pi-hole.net | bash

And we have two more alternative methods to install the proxy server.

Method 1: Clone the repository and run the basic-install.sh script

$ git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole
cd "Pi-hole/automated install/"
sudo bash basic-install.sh

Method 2: Manually download the installer and run the same shell script

$ wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh

Configuring and Managing Pi-Hole Proxy Server

Pi-Hole is coming with an excellent Web Interface that will allow you to monitor, Configure and Manage the Pi-Hole Proxy Server. This Web interface will help you configuring and Managing the following features

  • Manage White And Blacklists the Domain names.
  • Built-in DHCP Server
  • Audit Log with Long Term query
  • Privacy Setting like DNS Resolver Privacy Levels settings.

Once you have installed the Pi-Hole Proxy on your machine, the final prompt from the command line will give you the password for the first-time user. You just need to copy the password and login into the Dashboard.

root@dockervagrant:/home/vagrant# git clone https://github.com/pi-hole/docker-pi-hole.git
Cloning into 'docker-pi-hole'...
remote: Enumerating objects: 49, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 3729 (delta 18), reused 20 (delta 4), pack-reused 3680
Receiving objects: 100% (3729/3729), 1020.18 KiB | 418.00 KiB/s, done.
Resolving deltas: 100% (2229/2229), done.
Checking connectivity... done.
root@dockervagrant:/home/vagrant# ls
docker-pi-hole
root@dockervagrant:/home/vagrant# cd docker-pi-hole/
root@dockervagrant:/home/vagrant/docker-pi-hole# ./docker_run.sh
WARNING: Localhost DNS setting (--dns=127.0.0.1) may fail in containers.
Unable to find image 'pihole/pihole:latest' locally
latest: Pulling from pihole/pihole
45b42c59be33: Pull complete
2ca7a5291c9d: Pull complete
b41c6299b20e: Pull complete
80860ce958e9: Pull complete
4dbc97c8f3ee: Pull complete
895160d4b8d8: Pull complete
a2a31a2941ba: Pull complete
12c651e5b1a3: Pull complete
47d66783daaa: Pull complete
bc2a1c51f34f: Pull complete
d5765c5d17cd: Pull complete
fea6f10554ce: Pull complete
651d68f3083f: Pull complete
Digest: sha256:3a39992f3e0879a4705d87d0b059513af0749e6ea2579744653fe54ceae360a0
Status: Downloaded newer image for pihole/pihole:latest
f7f178c62798b441ade7e2a31b7d48641bba792dba9b7a7fe00a43aea643f84b
Starting up pihole container .......... OK
Assigning random password: eNDM35sd
Setting password: eNDM35sd for your pi-hole: https:///admin/

To get the dashboard, go to your browser and enter the IP address of the machine you installed Pi-Hole Proxy Server. So, the entire UI looks like the below screenshot.

Pi-Hole Proxy Server
Pi-Hole Proxy Server

Conclusion

In this article, we have discussed How to Install and Configure a Proxy Server. Along with it, we have discussed the Features and Functionalities of the Proxy Server. In our upcoming article, we will discuss How to set up your own VPN server and make the combination of VPN and Proxy to make your enterprise more secure. Stay tuned and subscribe DigitalVarys for more articles and study materials on DevOpsAgileDevSecOps, and App Development.

2 thoughts on “How to Install and Configure a Proxy Server?”

Leave a Reply