Replace plexmediaserver
with the name of your bucket and nl-ams
with the region of your bucket, if necessary.
Configuring Plex Media Server with Scaleway Object Storage
- Plex-Media-Server
- streaming
- s3fs
- lucidlink
Plex is a client/server media player system comprising two main components:
- The Plex Server application, which is available for Windows, macOS, Linux, and even including some NAS devices.
- Plex clients that can be either a web-based interface, an application on smart TVs, streaming boxes, or other third-party applications.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- An SSH key
- An Instance running Ubuntu Focal Fossa (20.04 LTS)
- An Object Storage bucket
sudo
privileges or access to the root user
Installing the required software
-
Connect to your Instance using SSH.
ssh root@<your-instance-IP> -
Update the APT package manager and the software already installed on the system:
apt update && apt upgrade -y -
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 -
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 updateapt install -y plexmediaserver s3fs
Configuring s3fs
-
Create the folder on which you will mount the bucket.
mkdir -p /mnt/media -
Enter your API keys in the password file and set owner-only permissions.
echo $ACCESS_KEY:$SECRET_KEY > ~/.passwd-s3fschmod 600 ~/.passwd-s3fs -
Uncomment
user_allow_other
in the/etc/fuse.conf
file to allow other users to access the server. You can use a text editor of your choice. In this tutorial we usenano
.nano /etc/fuse.conf[...]user_allow_other -
Mount the bucket in the local file system.
s3fs plexmediaserver /mnt/media -o allow_other -o umask=0002 -o passwd_file=${HOME}/.passwd-s3fs -o url=https://s3.nl-ams.scw.cloudNote -
(Optional) To mount the bucket automatically during boot, create a systemd script, called
/etc/systemd/user/s3fs.service
:[Unit]Description=S3FS mountsWants=network-online.targetAfter=network-online.target[Service]Type=oneshotRemainAfterExit=yesExecStart=/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.cloudExecStop=/bin/fusermount -u /mnt/media[Install]WantedBy=default.target -
Enable the script by running the following commands:
systemctl --user enable s3fs.servicesystemctl --user start s3fs.serviceIf you ever want to disable the automatic mounting, run the following command:
systemctl --user stop s3fs.service
Configuring Plex
-
Check that Plex is running before continuing:
systemctl status plexmediaserver.serviceThe output should look like this example:
● plexmediaserver.service - Plex Media Server for LinuxLoaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendorActive: active (running) since Sun 2018-09-23 14:16:52 UTC; 1min 53s agoProcess: 882 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPMain PID: 889 (sh)[...]If the status is
active (running)
everything is fine. -
Access the Plex interface through an SSH tunnel:
- On Linux or macOS computers, you can create the tunnel with the following command:
ssh root@plex.server.ip -L 8888:localhost:32400- On Windows computers, you can create the tunnel by using PuTTY:
- Open PuTTY, and enter your server IP address in the hostname and SSH port. Or, if you already have your server session set up and saved, just load the existing session.
- Go to Connection > SSH > Tunnels.
- Fill in Source port as 8888 and Destination as localhost:32400.
- Click the Add button.
- Navigate back to the session homepage now and click the Save button, then Open to connect to the server.
Open a web browser on your local computer and navigate to
http://localhost:8888/web
. The Plex login screen displays:NoteIn order to use Plex, you must create an account.
Once you are logged in, you will be automatically redirected to the setup of the server:
-
Access the Plex interface with your server IP address:
- Open a web browser on your local computer and navigate to
http://<plex.server.ip>:32400
- The Plex login screen should display.
NoteThe port
32400
is the default used by Plex for the interface. - Open a web browser on your local computer and navigate to
-
Enter the required parameters and click Next to complete the setup.
NoteMake sure the checkbox
Allow me to access my media outside my home
is ticked, so you can access your media files from any device. -
Click Add a library to create a new media gallery.
-
Select the type of library you wish to create and click Next.
-
Click Browse and select a multimedia folder to do so.
- Plex recommends creating separate folders for each type of media. For example, if your library is about movies, create a folder
Movies
in your bucket, through the/mnt/media
mounted folder or the Scaleway console. - You should see the
Movies
folder inside Plex, in the browse window.
- Plex recommends creating separate folders for each type of media. For example, if your library is about movies, create a folder
-
Select
/mnt/media/<Folder name>
as the media folder.TipYou can upload additional content to your server with any Amazon S3-compatible tool, like Cyberduck.
-
Click Next and then Finish to conclude the set-up.
-
Add media to your bucket and trigger a scan of your media folder in the Plex interface. Your media should display. If so, it is all set up. For more information about Plex, refer to their official documentation.