Plex is client-server media player system comprising two main components:
Requirements:
- You have an account and are logged into console.scaleway.com
- You have configured your SSH Key
- You have an Object Storage bucket
- You have sudo privileges or access to the root user.
1 . Log in to the Scaleway Console
2 . Click Storage from the left side menu. The Storage page lists all your buckets. The list will be empty if you have not created any bucket yet.
3 . Click Create a Bucket to create a bucket that will store your objects
Note: In this example, the bucket is named
plexmediaserver
. Bucket names are unique and can only exist once.
1 . Update the apt packet manager and the software already installed on the system:
apt update && apt-upgrade -y
2 . Add the Plex repository
Add Plex’s GPG key to the apt sources keychain and create a new file containing an entry to the Plex repository by running the following commands:
curl https://downloads.plex.tv/plex-keys/PlexSign.key | apt-key add -
echo deb https://downloads.plex.tv/repo/deb public main | tee /etc/apt/sources.list.d/plexmediaserver.list
3 . Install Plex and s3fs
Now, as the Plex repository is enabled, update the apt package list and install the latest version of Plex and s3fs, which is needed to mount the object storage bucket.
apt update && apt install -y plexmediaserver s3fs
1 . Create the folder into which the bucket will be mounted:
mkdir -p /mnt/media
2 . Enter your S3 credentials in the password file and set owner-only permissions on it:
echo <ACCESS_KEY>:<SECRET_KEY> > ~/.passwd-s3fs
chmod 600 ~/.passwd-s3fs
3 . Modify /etc/fuse.conf
to allow other users access, by uncommenting user_allow_other
.
4 . Mount the bucket in the local filesystem:
s3fs plexmediaserver /mnt/media -o allow_other -o umask=0002 -o passwd_file=${HOME}/.passwd-s3fs -o url=https://s3.nl-ams.scw.cloud
5 . (Optional) To mount the bucket automatically during boot, create a systemd script, called /etc/systemd/user/s3fs.service
:
[Unit]
Description=S3FS mounts
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/s3fs plexmediaserver /mnt/media -o allow_other -o umask=0002 -o passwd_file=${HOME}/.passwd-s3fs -o url=https://s3.nl-ams.scw.cloud
ExecStop=/bin/fusermount -u /mnt/media
[Install]
WantedBy=default.target
Enable the script by running the following commands:
systemctl --user enable s3fs
systemctl --user start s3fs
If you ever want to disable the automatic mounting, run the following command:
systemctl --user stop s3fs
1 . Check that Plex is running before continuing:
systemctl status plexmediaserver
The output should look like this example:
● plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor
Active: active (running) since Sun 2018-09-23 14:16:52 UTC; 1min 53s ago
Process: 882 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APP
Main PID: 889 (sh)
[...]
If the status is active (running)
everything is fine.
2 . The initial setup of Plex has to be done via an SSH tunnel, as the configuration is only allowed from localhost:
ssh root@plex.server.ip -L 8888:localhost:32400
On Windows computers, you can create the tunnel by using PuttY:
Open a web browser on your local computer and navigate to http://localhost:8888/web
. You will be presented with the following login screen:
Note: In order to use Plex, you must create an account.
3 . Once you are logged in, you will be automatically redirected to the setup of the server:
Enter the required parameters and click Next to complete the setup.
Note: Make sure the Checkbox
Allow me to access my media outside my home
is ticked to access your media files from everywhere.
4 . Create a new Media Gallery by clicking on +
in the menu on the left. When asked for the media folder, select /mnt/media
:
You can upload additional content to your server with any S3 compatible tool, like Cyberduck.