This guide will help you to install Plex, a media library which would allow you to access your media from anywhere in the world. The guide assumes you already have an account, so please create an account with Plex if you haven't already done so.
You'll need to execute some commands via SSH to use this software. There is a separate guide on how to connect to your slot via SSH. Commands are kept as simple as possible and in most cases will simply need to be copied and pasted into the terminal window (then executed by pressing the Enter key).
Installing Plex - bash script
You can copy and paste the following to run an installation script for Plex. This should make things easier if you don't wish to open an SSH tunnel:
wget -qO ~/install.plex.sh https://git.io/vKbgP && bash ~/install.plex.sh
Installing Plex - manual
Install Plex by logging in via SSH, then copying and pasting the following:
mkdir -p ~/private/plex mkdir -p ~/.config/feral/ns/forwarding/tcp && echo 32400 > ~/.config/feral/ns/forwarding/tcp/"$(shuf -i 10001-32001 -n 1)"
Every five minutes the system will scan your slot and if an empty ~/private/plex is found it will install Plex for you.
Configuring Plex for use
Plex is hardcoded to use port 32400. So that more than one person can use Plex on any given server, Plex needs to be installed to what is known as the user namespace for each user and then forwarded so that Plex is accessible beyond the server itself. The technical background is beyond the scope of this guide, but it suffices to say that installing Plex in this way allows multiple users to install it but requires an extra step of configuration.
After installing Plex you can run this command to be given information on the next step once Plex has been installed:
while [ ! -f ~/private/plex/README ]; do printf '\rWaiting...'; sleep 2; done && cat ~/private/plex/README
Once the README file can be displayed you'll see something like this (where internal_ip is replaced by an actual IP, such as 10.0.8.120:
Plex successfully installed. URL: http://internal_ip:32400/web IP: internal_ip Port: 32400 To complete the set up you must (1) create a Plex user, (2) connect via an SSH tunnel, and (3) enable remote connections. Once remote connections have been enabled, you do not have to connect via an SSH tunnel.
As per the README file you'll need to do the following:
- Create a Plex user if you haven't already done so.
- Connect via an SSH tunnel
- Enable remote connections
To enable remote connections you'll need to visit the URL you got from the README. The URL will only load correctly if you access it via SSH tunnel (see the linked-to guide above for more information on SSH tunnels).
Start the process by clicking the Settings icon; the icon resembles a pair of crossed tools. Once in the settings, do the following (note the screenshot for further guidance:
- Click in the Server tab
- Click on the General section (if not already selected).
- Enter your plex.tv account email address
- Enter your plex.tv account password
- Click on Sign In
Steps 3 to 5 may already have been completed automatically. Alternatively, you may be given an option to Claim Server. Select this if you are presented with such an option.
Plex may try to automatically provide remote access using a random port. You should manually set the forwarded port to the one you set up during the installation process. To get your port required for this step you can run this command in SSH:
Then, do the following:
- Click on Remote Access
- Make sure Show Advanced is selected
- Tick/check the box to Manually specify port
- Enter the required port you got from the command above
- Click Retry
You might need to click Enable Remote Access a couple of times if the settings don't seem to stick. It can also help to refresh the page.
Starting, stopping and restarting
As Plex is installed to the user namespace (and you don't have access to that), you'll only be able to kill Plex. The system will start it up for you automatically every five minutes.
To kill Plex simply run this command via SSH:
pkill -9 -fu "$(whoami)" 'plexmediaserver' && pkill -9 -fu "$(whoami)" 'EAE Service'
If the EAE Service has been killed properly already, the second half of that command will throw an error. That's find - you can then check if any part of Plex is still running with ps x | grep Plex | grep -v grep.
For help using the software itself you should consult Plex's own support page first of all as it's likely that your question is covered there. This section will cover anything specific to Plex on Feral.
Some plugins (for example Absolute Series Scanner) are expecting the Log files to be located at ~/Library/Application Support/Plex Media Server/Logs which is not created automatically by the install of Plex. To create the directory manually, run the following command:
mkdir -p ~/Library/Application Support/Plex Media Server/Logs
The standard update process
This process will replace your Plex installation with the latest available here at Feral. This might not be the latest available from Plex itself - if that is the case please see process in the section below.
pkill -9 -fu "$(whoami)" 'plexmediaserver' && pkill -9 -fu "$(whoami)" 'EAE Service' rm -rf ~/private/plex mkdir -p ~/private/plex
Updating Plex manually
The standard update process relies on grabbing the plex .deb file which is available on Feral. This might not be the most recent version released. If you've already set up Plex via the standard installation process described above and wish to upgrade, simply execute the commands below via SSH. Please note that plex_url and plex_deb are replaced by an actual URL and .deb file name, respectively.
wget plex_url dpkg -x plex_deb ~/private/plex pkill -9 -fu "$(whoami)" 'plexmediaserver'
Wait for Plex to be restarted by the system when it checks the running processes on your slot every five minutes.
So, as an example:
wget https://downloads.plex.tv/plex-media-server/22.214.171.12449-3497d6779/plexmediaserver_126.96.36.19949-3497d6779_amd64.deb dpkg -x plexmediaserver_188.8.131.5249-3497d6779_amd64.deb ~/private/plex pkill -9 -fu "$(whoami)" 'plexmediaserver' && pkill -9 -fu "$(whoami)" 'EAE Service'
If you have Plex open and check for updates, you might see that it shows the outdated version number but returns an "Up to date" message. In this case, log out and log back in to Plex.
- Plex doesn't start up after 5 minutes
After checking that ~/private/plex exists, you should check whether any old Plex processes are running. These would fool the system into thinking Plex is running and stop it from starting Plex up. One particular common offender is Plex's audio transcoding Plex EAE Service. You can search for these processes with:
ps x | grep Plex | grep -v grep
pkill -9 -fu "$(whoami)" 'plexmediaserver' && pkill -9 -fu "$(whoami)" 'EAE Service' rm -rf ~/private/plex ~/Library grep -l 32400 ~/.config/feral/ns/forwarding/tcp/* | xargs rm