As I previously mentioned in my Pi-Hole and Home Assistant project, I have an Intel NUC running Ubuntu server in my network closet, I’d like to see what else I can do with it as even a several-year old NUC is too powerful for DNS sinkhole and IoT automation only.
While streaming is pervasive now (and I use the word “pervasive” as I hate paying for many subscriptions just to access a few, and sometimes single content), I still have some media files lying around, mostly in lossless format. It is both annoying to install players that can correctly play them across multiple devices and sync media across them, so I decide to install a Plex Media Server, an awesome and largely free media streaming server.
I like to install software in Docker containers and use Docker Compose to manage them, and Plex offers official docker image. I opted for the host
mode as I can just use my host network to expose Plex server to my LAN. It is pretty easy to set up:
- Create a folder for your Plex server, a
config
folder for your configuration, atemp
folder for transcoding, and a symlink to the location of your media, in my case a mounted NAS volume:cd mkdir plex && cd plex mkdir config mkdir temp ln -s /media/Media/ media
- Create the
docker-compose.yml
file. The official GitHub repo provides a good template to start with:
version: '2'
services:
plex:
container_name: plex
image: plexinc/pms-docker
restart: unless-stopped
environment:
- TZ=<your_time_zone>
- PLEX_CLAIM=<your_claim_token>
- PLEX_UID=<uid>
- PLEX_GID=<gid>
network_mode: host
volumes:
- /home/<user_name>/plex/config:/config
- /home/<user_name>/plex/temp:/transcode
- /home/<user_name>/plex/media:/data
You need to fill in the following:
- Your timezone, like
Europe/London
; - Your claim token so that your server is automatically logged in to your account. You can obtain a claim token to login your server to your plex account by visiting https://www.plex.tv/claim.
- Your user ID and group ID that owns the
plex
folder. The server is run with theplex
user within the container but this user is not present outside. Without setting the UID and GID of the user, it may not be able to access mountedmedia
folder and thus your content. - Volumes for your container mapped to folders created in the previous step.
Start your server with docker-compose up
. The Plex webpage should be accessible at <your_server_ip>:32400
. Then, if you add content to your NAS share, it should automatically be indexed by Plex periodically and you will be able to play them anywhere in your home!
Further Reads
This is the post series. Other posts can be found under HomeNetwork tag.