Product docs and API reference are now on Akamai TechDocs.
Search product docs.
Search for “” in product docs.
Search API reference.
Search for “” in API reference.
Search Results
 results matching 
 results
No Results
Filters
Installing Plex Media Server on Ubuntu 18.04 Using Salt Masterless
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Plex is a media server that allows you to stream video and audio content that you own to many different types of devices. In this guide you will learn how to use a masterless Salt minion to set up a Plex server, attach and use a Block Storage Volume, and how to connect to your media server to stream content to your devices.
Before You Begin
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
Follow the steps in the Setting Up and Securing a Compute Instance guide.
Update your system:
sudo apt-get update && sudo apt-get upgrade
You will need to create a Block Storage Volume and attach it to your Linode. You will format and mount the drive as part of this guide. This volume will be used to store your media, so you should pick a size that’s appropriate for your media collection, though you can resize the volume later if you need more storage. For more on Block Storage, see our Block Storage Overview guide.
Plex requires an account to use their service. Visit the Plex website to sign up for an account if you do not already have one.
sudo
prefix. For more information on privileges, see our Users and Groups guide.Prepare the Salt Minion
On your Linode, create the
/srv/salt
and/srv/pillar
directories. These are where the Salt state files and Pillar files will be housed.mkdir /srv/salt && mkdir /srv/pillar
Install
salt-minion
via the Salt bootstrap script:curl -L https://bootstrap.saltstack.com -o bootstrap_salt.sh sudo sh bootstrap_salt.sh
The Salt minion will use the official Plex Salt Formula, which is hosted on the SaltStack GitHub repository. In order to use a Salt formula hosted on an external repository, you will need GitPython installed. Install GitPython:
sudo apt-get install python-git
Modify the Salt Minion Configuration
Because the Salt minion is running in masterless mode, you will need to modify the minion configuration file (
/etc/salt/minion
) to instruct Salt to look for state files locally. Open the minion configuration file in a text editor, uncomment the line#file_client: remote
, and set it tolocal
:- File: /etc/salt/minion
1 2 3 4 5 6 7 8 9
... # Set the file client. The client defaults to looking on the master server for # files, but can be directed to look at the local file directory setting # defined below by setting it to "local". Setting a local file_client runs the # minion in masterless mode. file_client: local ...
There are some configuration values that do not normally exist in
/etc/salt/minion
which you will need to add in order to run your minion in masterless mode. Copy the following lines into the end of/etc/salt/minion
:- File: /etc/salt/minion
1 2 3 4 5 6 7 8 9 10
... fileserver_backend: - roots - gitfs gitfs_remotes: - https://github.com/saltstack-formulas/plex-formula.git gitfs_provider: gitpython
The
fileserver_backend
block instructs the Salt minion to look for Salt configuration files in two places. First, it tells Salt to look for Salt state files in our minion’sroots
backend (/srv/salt
). Secondly, it instructs Salt to use the Git Fileserver (gitfs) to look for Salt configuration files in any Git remote repositories that have been named in thegitfs_remotes
section. The address for the Plex Salt formula’s Git repository is included in thegitfs_remotes
section.Note It is best practice to create a fork of the Plex formula’s Git repository on GitHub and to add your fork’s Git repository address in thegitfs_remotes
section. This will ensure that any further changes to the upstream Plex formula which might break your current configuration can be reviewed and handled accordingly, before applying them.Lastly, GitPython is specified as the
gitfs_provider
.
Create the Salt State Tree
Create a Salt state top file at
/srv/salt/top.sls
and copy in the following configuration. This file tells Salt to look for state files in the plex folder of the Plex formula’s Git repository, and for a state files nameddisk.sls
anddirectory.sls
, which you will create in the next steps.- File: /srv/salt/top.sls
1 2 3 4 5
base: '*': - plex - disk - directory
Create the
disk.sls
file in/srv/salt
:- File: /srv/salt/disk.sls
1 2 3 4 5 6 7 8 9 10 11
disk.format: module.run: - device: /dev/disk/by-id/scsi-0Linode_Volume_{{ pillar['volume_name'] }} - fs_type: ext4 /mnt/plex: mount.mounted: - device: /dev/disk/by-id/scsi-0Linode_Volume_{{ pillar['volume_name'] }} - fstype: ext4 - mkmnt: True - persist: True
This file instructs Salt to prepare your Block Storage Volume for use with Plex. It first formats your Block Storage Volume with the
ext4
filesystem type by using thedisk.format
Salt module, which can be run in a state file usingmodule.run
. Thendisk.sls
instructs Salt to mount your volume at/mnt/plex
, creating the mount target if it does not already exist withmkmnt
, and persisting the mount to/etc/fstab
so that the volume is always mounted at boot.Create the
directory.sls
file in/srv/salt
:- File: /srv/salt/directory.sls
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/mnt/plex/plex-media: file.directory: - require: - mount: /mnt/plex - user: username - group: plex /mnt/plex/plex-media/movies: file.directory: - require: - mount: /mnt/plex - user: username - group: plex /mnt/plex/plex-media/television: file.directory: - require: - mount: /mnt/plex - user: username - group: plex
The directories that are created during this step are for organizational purposes, and will house your media. Make sure you replace
username
with the name of the limited user account you created when following the Setting Up and Securing a Compute Instance guide. The location of the directories is the volume you mounted in the previous step. If you wish to add more directories, perhaps one for your music media, you can do so here, just be sure to include the- require
block, as this prevents Salt from trying to create the directory before the Block Storage Volume has been mounted.Go to the Plex Media Server download page and note the most recent version of their Linux distribution. At the time of writing, the most recent version is
1.13.9.5456-ecd600442
. Create theplex.sls
Pillar file in/srv/pillar
and change the Plex version number and the name of your Block Storage Volume as necessary:- File: /srv/pillar/plex.sls
1 2 3
plex: version: 1.13.9.5456-ecd600442 volume_name: plex
Create the Salt Pillar top file in
/srv/pillar
. This file will instruct Salt to look for theplex.sls
Pillar file you created in the previous step.- File: /srv/pillar/top.sls
1 2 3
base: '*': - plex
Apply your Salt state locally using
salt-call
:salt-call --local state.apply
You should see a list of the changes Salt applied to your system. You have successfully installed Plex using Salt.
Set Up Plex
Initial Configuration
You’ll need to create an SSH tunnel to your Linode to connect to Plex’s web UI. On your local computer, run the following command, replacing
<your_ip_address>
with your Plex server’s IP address.:ssh username@<your_ip_address> -L 8888:localhost:32400
In a browser, navigate to
http://localhost:8888/web/
.Sign in with your Plex username and password.
Name your media server. This example uses the name
linode-plex
. Be sure to check the box that reads Allow me to access my media outside my home and then click Next.
Organize Your Media
Click on the Add Library button:
Select Movies and click Next:
Click Browse for Media Folder and select the appropriate folder at
/mnt/plex/plex-media/movies
. Then click Add:Repeat the process to add your ‘Television’ folder.
When you are done adding your libraries, click Add Library.
To continue the configuration process, click Next.
Click on Get Plex Apps to download the appropriate Plex client for your device. Then click Done.
In the future you can add more libraries by hovering over the menu and clicking the plus sign (+) next to LIBRARIES.
Disable DLNA (Recommended)
DLNA is a protocol that incorporates Universal Plug and Play (or UPnP) standards for digital media sharing across devices. If you do not wish to make use of it, it’s recommended that you disable this feature, as it is openly connectable on port 1900
. From the Plex web interface, click the wrench icon in the upper right corner, and navigate to the DLNA section under SETTINGS. Uncheck Enable the DLNA server, and click Save Changes:
Connect to Your Plex Server
Visit the Plex Apps download page or the app store on your device to download Plex Media Player if you have not already done so.
Open your Plex app. The example provided here will use the Plex Media Player for macOS.
Sign in to Plex.
On the left there’s a dropdown menu where you can select your server by the name you chose. Select your server.
You are now able to stream your content with Plex.
Transfer Media to Your Server
You can use SCP to transfer media to your server from your local computer. Replace your username and
123.456.7.8
with the IP address of your Linode.scp example_video.mp4 username@123.456.7.8:/mnt/plex/plex-media/movies
Once you’ve transferred files to your Plex media server, you may need to scan for new files before they show up in your Library. Click on the ellipsis next to a Library and select Scan Library Files.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on