Block Advertisements and Watch Movies with Raspberry Pi

I got a Raspberry Pi 3 the other day and turned it into a dual-purpose server in my household. The first purpose disables ads on all websites from any device on our network. The second purpose is it acts as a media server where I can watch various movies and TV shows I have stored on my computer.

You can buy Raspberry Pi 3 at various retailers including for $35. You’ll also need a MicroSD card that acts as the internal hard drive. The cost depends on how much space you want, but at least 16 GB is required. I used a 64 GB card (see MicroSD link). If your computer doesn’t have a multi-media drive, you’ll need a USB adapter since MicroSD cards do not have Linux pre-installed. Though, you can buy those too. A Raspberry Pi, for those uninitiated, is a tiny little computer that runs Linux – an operating system. It’s a motherboard smaller than your hand that contains:

  • 1.2GHz 64-bit quad-core processor
  • 1 GB RAM
  • Wireless and LAN networking
  • Bluetooth connectivity
  • HDMI connection (for using monitors)
  • 4 USB ports
  • A 3.5mm audio jack

Unless you buy a Pi starter kit or another kit that includes a case, your Pi will be unprotected. I bought a clear case with two heatsinks and a cooling fan to prevent it from overheating for $17. After all of these costs, you’re looking at an awesome mini-machine for less than $75 that has hundreds of uses.  Here are 25. When I first bought mine, I turned it into a retro gaming machine, but the games weren’t the same with modern controllers (I used Xbox controllers). If I want to go that route, I’d rather purchase NES controllers for NES games, GameCube controllers for GameCube games, etc. Thus, I went to my ad-blocking media server instead. If you’d rather go the retro gaming route, I highly recommend RetroPie, an all-in-one gaming system with Linux. Moving on.

The first thing you’ll want to do is connect your MicroSD card to your computer then install Raspbian. Raspbian is a lite Linux build made specifically for the Raspberry Pi. However, many Linux distributions work such as the popular Ubuntu. The advantage to Raspbian is, as previously mentioned, it’s lite and thus it doesn’t take a lot of disk space. While it’s downloading and/or installing, you’ll want to find a monitor or television with an HDMI connection, a keyboard, and a mouse is very helpful. Then connect them all to the Pi.  Additionally, you’ll want to connect your Pi directly to the router via networking cable.

Turn on your Pi and it will install and boot.

Advertisement Blocking:

The next thing I did was open Terminal and install Pi-Hole, the ad-blocking software. I’ll explain how this works later. Type the following in Terminal:

curl -sSL | bash

That’s it! As it installs, it will ask you various questions. I chose Comodo as my default DNS because I love their security measures. Read the instructions and  follow them; It’s not too complicated. As soon as it’s done installing it will tell you what the assigned IP address is. I went to my router’s settings (typically, but consult your manual) and in the DHCP Server Settings, I set the Primary Static DNS as the Pi’s IP  address. Leave the other DNS servers completely blank. Again, consult your manual if you have no idea how to do this because it varies on each router. While you’re in the router settings, be sure to assign that specific IP to your Pi’s MAC address. If you ever have to reboot your router, or Pi, or lose electricity, the Pi could possibly get assigned a new IP address and it would bring this whole operation down. Assigning a static IP address to the Pi’s MAC address will prevent this from happening.

Once you login to the Pi-Hole web service in the webbrowser, you can make additional changes to it. One thing I did was add more blocklists. Blocklists are exactly as the name implies: a list of various websites that the Pi-Hole software scans to determine whether or not to block them. Since all advertisements are on specified domains (i.e., it prevents those advertisements from getting to your network. It also secures your network by blocking malware and spyware domains. You can find more lists to block at I blocked ransomware, gambling websites, and some other websites. As long as a device like your phone or computer is connected to your network, you will never or rarely see any of these.

Media Server:

I use and love Plex. Plex acts as a media server where you can easily add movies and TV shows by connecting it to folders where they’re stored. Additionally, it can automatically find subtitles, descriptions, and other information. While a Plex server is running, you can watch anything on it from a device that has Plex installed. It’s available for just about any major device like Android, iPhone, Playstation, Xbox, Roku, etc. The problem with Plex that I have now is that my computer acts a media server. When I want to watch something on Plex, I have to run upstairs and turn on my computer. I decided to stop torturing myself by turning my Pi into a Plex server too.

I could write a guide on how to setup Plex on your Pi, but someone did it better: Click here for the instructions. Unfortunately, Plex doesn’t natively support Raspbian. Though, if you installed a different Linux distribution like Ubuntu or CentOS, then you can skip this guide.

I ran into a slight problem: The MicroSD couldn’t fit all of the movies and TV shows I had, so I put them on an external hard drive. When I connected the hard drive to the Pi and ran the Plex server web interface, it couldn’t find the folders where I stored the media on the hard drive. I tried this guide first, but it didn’t work for me like it has with others. After a couple of hours of troubleshooting, I found a guide that would allow me mount the hard drive by UUID (a unique identifier for hard drives). I have no idea where the guide I used is, but this guide is very similar to the steps I took.

Once I connected the hard drive, I added the folders as “libraries” in Plex. Then I disconnected the keyboard and mouse and that’s it! I keep it running all day/night.

One additional thing I did was enable SSH on my Pi so I can remote into it via WinSCP to add/remove media. Though, I could add media with the external hard drive by removing it from the Pi and plugging it into my PC,  I’d rather remote into it.

One reply on “Block Advertisements and Watch Movies with Raspberry Pi”

Comments are closed.