Skip to content

Debian 12 Bookworm + Plex Media Server (Asus RT-AX86S with Asuswrt-Merlin)

License

Notifications You must be signed in to change notification settings

bbeny123/Plex_Asuswrt-Merlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites:

  • installed Entware
  • SWAP enabled (2GB or more recommended)

* steps are optional.

1 - ssh to router

* - increase swappiness if it is 0

this can significantly improved the performance of the Plex Media Server

# check current value of swappiness
cat /proc/sys/vm/swappiness
# change swappiness on runtime and persists it after reboot
echo 10 > /proc/sys/vm/swappiness
echo 'echo 10 > /proc/sys/vm/swappiness' >> /jffs/scripts/post-mount

2 - install required packages

opkg install coreutils-sha256sum debootstrap binutils perlbase-autodie

3 - remount Entware partition

mount -i -o remount,exec,dev /opt/..

4 - install chrooted Debian

debootstrap --variant=minbase --arch=arm64 bookworm /opt/debian/ http://ftp.debian.org/debian/

5 - prepare Debian's init.d script

rm /opt/etc/init.d/S99debian
wget -O /opt/etc/init.d/S99debian https://raw.githubusercontent.com/bbeny123/Plex_Asuswrt-Merlin/main/init-debian.sh
chmod 755 /opt/etc/init.d/S99debian

by default, all subdirs of /tmp/mnt/ (except the Entware partition) will be bind-mounted on chrooted Debian's /mnt/ (making them visible to Plex Media Server)

* - prepare Debian's remount hotplugged USB script

skipping this step, newly attached USB drives will be accessible from Debian (and thus Plex Media Server) only after rebooting the router or manually executing debian restart / debian enter via SSH

prerequisite: JFFS custom scripts and configs enabled (router WebUI -> Administration -> System)

wget -O /jffs/scripts/mount-debian.sh https://raw.githubusercontent.com/bbeny123/Plex_Asuswrt-Merlin/main/mount-debian.sh
chmod 755 /jffs/scripts/mount-debian.sh
echo './jffs/scripts/mount-debian.sh' >> /jffs/scripts/post-mount

6 - prepare chrooted services list and create symlink to Debian

touch /opt/etc/chroot-services.list
chmod 755 /opt/etc/chroot-services.list
ln -s /opt/etc/init.d/S99debian /opt/bin/debian

* - copy hosts file to Debian

cp /etc/hosts /opt/debian/etc/

7 - enter debian

debian enter

8 - upgrade packages and install those required by Plex Media Server

apt update && apt upgrade -y
apt install -y apt-transport-https curl gnupg procps

9 - configure timezone

dpkg-reconfigure tzdata

10 - ensure that /usr/sbin/init is not a symlink pointing to systemd

[ -f /usr/sbin/init ] && ls -l /usr/sbin/init | grep -q systemd && mv -f /usr/sbin/init /usr/sbin/init.bak

11 - instal Plex Media Server

curl -sS https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/plexmediaserver.gpg
echo 'deb https://downloads.plex.tv/repo/deb public main' | tee /etc/apt/sources.list.d/plexmediaserver.list
apt update
apt install plexmediaserver

After installation, the server will start automatically.
During initialization (which will take about 5-15min) CPU/RAM usage will be close to 100%.
The server will be almost unusable during this time so I recommend just waiting it out.​

12 - exit Debian

exit

13 - add Plex Media Server to chrooted services list

echo 'plexmediaserver' >> /opt/etc/chroot-services.list

14 - restart Debian

debian restart

After about 30 seconds, the server should be reachable at: <router-ip-address>:32400/web like:

When configuring libraries, CPU/RAM consumption will also be close to 100%.
Web-panel and Debian will be unresponsive during this time.
After configuring the libraries and downloading the metadata, the Plex Media Server should start working well.

Based on:

Update procedure

1 - ssh to router

* - update amtm and entware packages using amtm

This step may overwrite /opt/etc/init.d/S99debian file.
In such a case, step 5) of the installation procedure will need to be performed again.

2 - enter debian

debian enter

3 - ensure that /usr/sbin/init is not a symlink pointing to systemd

[ -f /usr/sbin/init ] && ls -l /usr/sbin/init | grep -q systemd && mv -f /usr/sbin/init /usr/sbin/init.bak

4 - upgrade debian packages

apt update && apt upgrade -y

* - restart Debian

exit
debian restart

About

Debian 12 Bookworm + Plex Media Server (Asus RT-AX86S with Asuswrt-Merlin)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages