DEV Community

Cover image for How to Install Piped: The Ad-Free and Privacy-Focused YouTube Frontend Alternative
Waradu
Waradu

Posted on • Edited on

How to Install Piped: The Ad-Free and Privacy-Focused YouTube Frontend Alternative

Introduction:

I was frustrated by the annoying pop-ups from YouTube asking me to disable ad blockers, I decided it was time to take matters into my own hands. I made a simple PHP script with yt-dlp to create a custom player. While my makeshift solution worked, it lacked the full functionality of a genuine YouTube frontend. A few days later, I stumbled upon Piped, an open-source project that promised not only ad-free viewing but also a comprehensive set of features. I took a look at their documentation and learned how to install piped on my own server. This guide tells about my journey and the steps I took to reclaim control over my online video streaming experience.

If you just want to use piped with no ads i deployed a public instance for everyone to use!

Public piped Instance

Prerequisites:

Before you start with the installation, ensure you have the following prerequisites in place:

  1. Some kind of Server
  2. Domain:
    • A registered domain to host your Piped instance.
  3. Software:
    • Git
    • Docker
    • Docker Compose plugin
  4. Cloudflare Account:
    • An active Cloudflare account.

What is Piped?

Piped is designed as a self-hosted alternative to YouTube's interface, prioritizing user control by removing advertisements and tracking scripts. For me, it emerged as the perfect solution after my attempt at creating a custom player using a PHP script fell short of the full functionality I desired.

Benefits of Piped:

  • No ads
  • Privacy
  • No Tracking
  • Most features like YouTube

Installation of Piped:

  1. Cloning Piped-Docker Repository:
    • Command: git clone https://github.com/TeamPiped/Piped-Docker.git
  2. Navigating to Piped-Docker Directory:
    • Command: cd Piped-Docker
  3. Running Configuration Script:
    • Command: ./configure-instance.sh
    • Set up the domain names. For example, when asked for pipedproxy.example.com, just replace the example.com with your own domain name. Choose nginx as Reverse proxy when prompted.
  4. Creating DNS Records:
    • Create all 3 DNS records to your Server's public IP
  5. Launching Piped Instance:
    • Command: docker-compose up -d
    • This starts the docker container up
  6. Configuring Nginx with Certbot for TLS:

    • Installed Certbot via Snap: sudo snap install --classic certbot
    • Ran Certbot with Cloudflare DNS verification:

    sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /path/to/cloudflare.ini -d piped.example.com -d pipedapi.example.com -d pipedproxy.example.com

    • Once again, change the example.com to your own Domain.
    • Replaced /path/to/cloudflare.ini with the path to my Cloudflare API credentials file.
    • Example cloudflare.ini file:

Create a file named cloudflare.ini with the following content:

# Cloudflare API credentials
dns_cloudflare_email = your_email@example.com
dns_cloudflare_api_key = your_cloudflare_api_key
Enter fullscreen mode Exit fullscreen mode

Set proper permissions on this file to enhance security:

chmod 600 /path/to/cloudflare.ini
Enter fullscreen mode Exit fullscreen mode

Remember to replace your_email@example.com with your Cloudflare account email and your_cloudflare_api_key with your actual Cloudflare API key.

Finally Nginx Configuration:

  • Configure Nginx Configuration with TLS (HTTPS) for a secure connection.
   server {
      listen 443 ssl http2;
      listen [::]:443 ssl http2;
      server_name piped.example.com pipedproxy.example.com pipedapi.example.com; # For all 3 hostnames
      ssl_certificate /path/to/certificate/fullchain.pem;
      ssl_certificate_key /path/to/certificate/privkey.pem;
      ssl_session_timeout 1d;
      ssl_session_cache shared:MozSSL:10m;
      ssl_session_tickets off;

      ssl_protocols TLSv1.3;
      ssl_prefer_server_ciphers off;
      add_header Strict-Transport-Security "max-age=63072000" always;
      add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';

      ssl_stapling on;
      ssl_stapling_verify on;
      proxy_read_timeout 1d;
      proxy_connect_timeout 300;
      proxy_send_timeout 300;
      location / {
          proxy_pass http://127.0.0.1:8080;
          proxy_set_header Host $host;
      }
   }
Enter fullscreen mode Exit fullscreen mode

Conclusion:

The discovery of Piped not only resolved the issue with the ad blocker but also granted me control over my video streaming experience. The benefits of an ad-free and private platform are really nice. By sharing my journey, I hope others can also explore the realm of self-hosting and tailor their digital space to align with their preferences. In a world inundated with ads and privacy concerns, taking control is empowering.

Top comments (1)

Collapse
 
craqdi_music profile image
Mazedona De La Altadama Craquis Díaz Arts And Cultures Craqdi Books

Much better than the alternatives