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), covering OS setup, Plex, Calibre, mounting external drives, and automated backups.
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#
- Boot Up: Insert the preloaded micro-SD card and power on your Pi.
- Update the System: Open the terminal and run:
sudo apt update && sudo apt upgrade -y - Enable SSH: If remote access sounds like your jam:Navigate to
sudo raspi-configInterface Options > SSHand 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:
- Add the Plex repository and install:
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add - echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list sudo apt update sudo apt install plexmediaserver - Confirm Plex is running:
sudo systemctl status plexmediaserver
Set up Calibre for ebook hosting#
Calibre serves a self-hosted ebook library over HTTP. To install and start the content server:
- Install Calibre:
sudo apt install calibre - Start the Calibre content server:
calibre-server /path/to/your/ebook/folder - Access your ebooks via
http://<raspberry_pi_ip>:8080. To swap the IP for a hostname likehttp://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:
- Port forwarding: forward the relevant ports on your router (e.g., 32400 for Plex).
- Dynamic DNS (DDNS): services like No-IP map a stable hostname to your changing public IP.
- 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.
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.
- Identify the drives:
lsblk - Create mount points:
sudo mkdir /mnt/media sudo mkdir /mnt/backup - Mount the drives:
sudo mount /dev/sda1 /mnt/media sudo mount /dev/sdb1 /mnt/backup - Automate the process with
/etc/fstabentries:/dev/sda1 /mnt/media ext4 defaults 0 2 /dev/sdb1 /mnt/backup ext4 defaults 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:
- Sync your files:
rsync -av --delete /mnt/media/ /mnt/backup/ - Schedule it:Add this to run daily at 2 AM:
crontab -e0 2 * * * rsync -av --delete /mnt/media/ /mnt/backup/
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. Covered in Networked Retro Gaming.
- 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.
