Skip to main content

Plex

Plex media server allows you to aggregate all your personal media and access it anywhere you go.

Initial Setup

First you must connect to your slot via ssh. If you need help connecting to the server, please read the help article here.

Installing Plex on your slot is easy. Simply issue the following command:

sudo box install plex

Automatic claiming

As of v1.6.0, swizzin now supports claiming your server during the installation. When you install Plex, you'll be greeted by the prompt:

Please visit https://www.plex.tv/claim, login, copy your plex claim token to your clipboard and paste it here. This will automatically claim your server! Otherwise, you can leave this blank and to tunnel to the port instead.

Simply visit the link to grab your claim code and paste it into the terminal. After Plex is installed, the script will use the claim code to grab a valid token for your user and apply it to your server.

Post-install automatic claiming

If for some reason you didn't claim during installation, you can still run the command manually from SSH.

claim="<your plex.tv/claim code>" #Change this value.
. /etc/swizzin/sources/globals.sh
. /etc/swizzin/sources/functions/plex
claimPlex "${claim}"

The function will run and if all goes well, you'll receive a success message stating that your server as been claimed under your account.

Manual claiming

After installation, you'll need to create an SSH Tunnel to your server to appear as if you're using the same network as your Plex instance.

If you've gotten this far, I'll assume you don't need any reminders on how to connect to the server via SSH ;) However, creating an SSH tunnel takes a bit more effort than simply creating an SSH Connection.

note
  1. Open a command prompt or terminal
  2. Enter the command: ssh username@hostname.ltd -L 8888:localhost:plexport
  3. Open your browser window and navigate to http://localhost:8888/web
  4. The browser will connect to your Plex server and let you know that there is an unclaimed server on your network.

Service Management

The systemd service file resides at:

/lib/systemd/system/plexmediaserver.service

It is not recommended to make edits directly to this file. If you must, please use an override (i.e. systemctl edit plexmediaserver)

sudo systemctl start plexmediaserver

Adding more users' media to Plex

Plex runs as the user plex. This means, that this user needs to be able to read (and execute directories leading all the way up to) whatever you would like plex to play.

During the installation, only the master user is present in this group.

In order to access non-master-user files cleanly, please add the plex user to the group of users who can access the desired user's files, and ensure that this group has access to the media you would like to access.

usermod -a -G <aUser> plex
chmod g+rx -R /home/<aUser>

Upgrading

You will notice that Plex releases new server installers quite regularly and often. You can handle these either on your own via apt, or you can run box upgrade plex which will install an automatic update job, and even allow you to use the beta Plex Pass releases if you desire. Feel free to re-run it any time you want it to upgrade again.

Connect to other clients

If you need to link your Plex instance to another application, such as Sonarr or Tautulli, you can use the following details:

Host: 127.0.0.1
Port: <your plex port>