Skip to main content
  1. Posts/

Build an HTPieC: your ultimate home theater Pie computer

·966 words·5 mins·
Table of Contents

A Raspberry Pi makes a capable, low-power media and ebook server. The Pi 5 handles a Plex library, a Calibre content server, and external storage without breaking a sweat; the Pi Zero 2 W can manage lighter loads if you’re optimizing for cost or power draw. This guide walks through the build I run at home (the HTPieC: a home theater PC on a Raspberry Pi, hence the Pie), covering OS setup, Plex, Calibre, mounting external drives, and automated backups.

The scripts and config behind this build live in the htpiec repo — an install script, a managed Calibre service, fstab samples, and the backup wrapper. They’re samples to adapt, not a turnkey image; the walkthrough below is the by-hand version.

Hardware overview
#

  • Computer: Raspberry Pi 5 with 8GB RAM
  • Storage: 128GB micro-SD card (OS and software)
    • Primary storage: Fast external SSD (e.g., 1TB) for media storage
    • Backup storage: Reliable external HDD (e.g., 2TB) for data redundancy

For a leaner setup, the Pi Zero 2 W works for smaller libraries and less intensive tasks. Same software, less headroom.

Setting up the Raspberry Pi
#

Install and configure Pi OS
#

  1. Boot up: Insert the preloaded micro-SD card and power on your Pi.
  2. Update the system: Open the terminal and run:
    sudo apt update && sudo apt upgrade -y
  3. Enable SSH: If remote access sounds like your jam:
    sudo raspi-config
    Navigate to Interface Options > SSH and enable it.

Configure your network
#

Assign a static IP to your Pi through your router’s settings. DHCP leases can shuffle, and you don’t want your media server’s address moving every time the router reboots.

Installing media server software
#

Install Plex for media management
#

Plex handles transcoding, library organization, and remote streaming. To install:

  1. Add the Plex repository and install. apt-key is deprecated on current Pi OS, so use a signed keyring instead:
    curl -fsSL https://downloads.plex.tv/plex-keys/PlexSign.key | sudo gpg --dearmor -o /usr/share/keyrings/plex-archive-keyring.gpg
    echo "deb [signed-by=/usr/share/keyrings/plex-archive-keyring.gpg] https://downloads.plex.tv/repo/deb public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
    sudo apt update
    sudo apt install plexmediaserver
  2. Confirm Plex is running:
    sudo systemctl status plexmediaserver

Set up Calibre for ebook hosting
#

Calibre serves a self-hosted ebook library over HTTP. (For managing the library itself — metadata, conversion, plugins — see The ultimate guide to Calibre.) To install and start the content server:

  1. Install Calibre:
    sudo apt install calibre
  2. Start the Calibre content server:
    calibre-server /path/to/your/ebook/folder
  3. Access your ebooks via http://<raspberry_pi_ip>:8080. To swap the IP for a hostname like http://my-library.local, run Pi-hole or any local DNS resolver on your network.

Making your server public
#

To expose the HTPieC outside your home network:

  1. Port forwarding: forward the relevant ports on your router (e.g., 32400 for Plex).
  2. Dynamic DNS (DDNS): services like No-IP map a stable hostname to your changing public IP.
  3. TLS: terminate HTTPS with Let’s Encrypt. Don’t skip this; exposing media metadata, library contents, or session credentials over plain HTTP is asking for trouble.
  4. Calibre auth: the content server is world-open by default. Once it’s reachable beyond your LAN, start it with --enable-auth and add accounts with calibre-server --manage-users, or you’re publishing your whole library to anyone who finds the port.

Connecting external storage
#

Mount drives
#

External drives hold the bulk of your media. The Pi’s microSD is for the OS and software; you’ll want disk-grade storage for everything else.

  1. Identify the drives:
    lsblk
  2. Create mount points:
    sudo mkdir /mnt/media
    sudo mkdir /mnt/backup
  3. Mount the drives:
    sudo mount /dev/sda1 /mnt/media
    sudo mount /dev/sdb1 /mnt/backup
  4. Automate the process with /etc/fstab entries. Mount by UUID, not /dev/sdX — device nodes can reorder across reboots, so your media and backup drives swap places; UUIDs are stable. Grab them with sudo blkid /dev/sda1. Add nofail so the Pi still boots if a drive is unplugged:
    UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt/media  ext4 defaults,nofail 0 2
    UUID=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy /mnt/backup ext4 defaults,nofail 0 2

Keep your backup drive happy and healthy with tools like smartmontools.

Automating backups
#

rsync handles incremental backups well and is in the Pi OS base install:

  1. Sync your files:
    rsync -av --delete /mnt/media/ /mnt/backup/
  2. Schedule it:
    crontab -e
    Add this to run daily at 2 AM:
    0 2 * * * rsync -av --delete /mnt/media/ /mnt/backup/

One caveat: --delete mirrors the source exactly, so anything removed from /mnt/media is gone from the backup on the next run. That’s correct for a true mirror, but if a drive glitch corrupts the source, the damage propagates. If you’d rather keep deleted files, add --backup-dir, or put the library on a snapshotting filesystem.

Accessing your media
#

  • Plex: Stream your movies at http://<raspberry_pi_ip>:32400/web.
  • Calibre: Enjoy your ebooks at http://<raspberry_pi_ip>:8080.

Bonus features
#

Once the core HTPieC is running, two natural extensions:

  • RetroPie turns the Pi into a network-accessible retro gaming host.
  • Kodi layers a polished living-room UI on top of the same media files Plex serves.

Additional tips
#

  • Power supply: use a reliable adapter rated for the Pi 5’s 5V/5A draw. Underpowered supplies show up as random crashes, not error messages.
  • Ethernet: prefer wired when the Pi is stationary. Wi-Fi is fine for the Zero 2 W but adds latency you don’t want on a 4K stream.
  • Expand storage: chain more drives, or move to a small NAS once the library outgrows what a couple of USB disks can hold.

With the HTPieC running, you have a Plex server, a Calibre ebook server, and an automated backup pipeline on a low-power machine that costs less than a single year of streaming subscriptions.

Additional resources
#

Chandler Thompson
Author
Chandler Thompson
I lead engineering teams and coach the people who run them. This is where I write down what actually worked.

Related