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.
- Linux & OSX
- Windows
- Open a command prompt or terminal
- Enter the command:
ssh username@hostname.ltd -L 8888:localhost:plexport
- Open your browser window and navigate to
http://localhost:8888/web
- The browser will connect to your Plex server and let you know that there is an unclaimed server on your network.
Please be aware that cmd.exe now ships support for SSH out of the box, so you can very likely use the instructions in the previous tab. If you don't have ssh
in cmd
, then use PuTTY.
- Open up your PuTTY client again.
- Under gateway, enter the hostname of your server, e.g.:
yourhostname.ltd
- Configure the tunnel:
- On the left hand side, navigate to
Connection > SSH > Tunnels
- Under source port, enter
8888
- Under destination, enter
localhost:plexport
- Click
Add
- On the left hand side, navigate to
- Connect to the server by clicking
Open
- PuTTY will prompt you for your username and password like a regular SSH session.
- Once connected, open your browser and navitage to
http://localhost:8888/web
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
)
- Status
- Start
- Stop
- Restart
- Enable
- Disable
sudo systemctl status plexmediaserver
sudo systemctl start plexmediaserver
sudo systemctl stop plexmediaserver
sudo systemctl restart plexmediaserver
sudo systemctl enable plexmediaserver
sudo systemctl disable plexmediaserver
Adding more users' media to Plex
Plex runs as the user
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>