I wrote an init.d script that will setup + install + control + update a Plex Media Server instance running on an ARM-based OpenWrt router that will serve media stored on a usb-attached external hard drive.
THE CODE is hosted on github. Refer to the README on github for more detailed info, but I will briefly summarize a few important points below.
You need a fairly beefy (quad core) ARMv7 or ARMv8 based router that has at least ~120 MB of RAM that it can dedicate solely to the Plex Media Servcer instance and that has at least 1 usb port (preferably usb 3). You will also need the software/kmods to mount the external drive, to unzip
*.zip files, and to both mount and create xz-compressed SquashFS filesystems.
The Dynalink WRX36 is probably the cheapest device ($80 on amazon) that meets this criteria. I have one of these and can confirm it works (quite well) on the WRX36.
UPDATE: Ive re-worked how plex media server initializes things to hopefully make it easier to get things set up and also to make
service plexmediaserver enable work as intended.
To get things started, the only thing you should need to do is create a directory
.plex/Library near the top of the external drive you want the plex media server library stored on. Putting this at the drive's top-level directory is preferable, but 1 or 2 under the top level directory will work as well. Once this directory exists, run
service plexmediaserver start
and the plexmediaserver init script will automatically do the rest of the setup for you.
NOTE: you can override the automatic logic for determining the block device and mount point of the external drive with the plex library on it using the plexmediaserver UCI config entries for
plex_drive_mnt. See the README on github for more info.
Everything is controlled by a init.d service. The main commands you will need are:
service plexmediaserver start: this will start plex media server
service plexmediaserver stop: this will stop plex media server
service plexmediaserver update: this check for new plex media server versions and (if available) update
service plexmediaserver enable: this will auto-start plex media server on boot.
service plexmediaserver disable: this will prevent auto-starting plex media server on boot.
You can access the plex media server from a plex media player app or from a web browser by going to
HOW IT WORKS
The init.d script downloads an ARM NAS Plex Media Server package, unpacks it, and makes an xz-compressed squashfs image of it that gets saved on the external drive. When you start plex, it copies this sqashfs image to the device and mounts it and then runs plex from the mounted squashfs image.
NOTE: you dont need to manually do these, they are automated.
- downloading the firmware and generating the squashfs image is done by
service plexmediaserver update.
- transferring and mounting the squashfs image is handled by the
service plexmediaserver startcommand
This keeps Plex Media Server responsive (much more so than running it directly off of the external drive) but keeps memory usage to a manageable only used ~80 MB of RAM (not counting the memory plex media server uses to run...in total itll be more like 100-120 mb runtime memory + 75-80 mb for the squashfs image--> up to ~200 mb total)