Jail information
Here you can see the jail information I used to create the jail via the FreeNAS web interfaceproperty | value |
---|---|
Jailname | PMS-PRD |
IPv4 address | 192.168.1.101 |
type | standard |
vanilla | FALSE (unchecked) |
Installing Plex Media Server
Start by SSHing into the FreeNAS server and open a shell into the PMS-PRD jail: jexec PMS-PRD csh.Get the portstree inside the jail: portsnap fetch extract After the portstree is extracted inside the jail, navigate to the Plex media server port and initiate the installation: cd /usr/ports/multimedia/plexmediaserver-plexpass && make install clean
Note: If you don't own a plex account with an active plexpass, you should not use the plexmediaserver-plexpass port but the plexmediaserver port. After the port is installed, the following information is shown:
user: plex with user ID 972
group: plex with group ID 972
startupscript: /usr/local/etc/rc.d/plexmediaserver_plexpass
In order to have Plex Media Server running after each reboot, add the following line in /etc/rc.conf:
plexmediaserver_plexpass_enable="YES"
Start the service by executing the following command: service plexmediaserver_plexpass start At this point the plex media server should be accessible by opening a web browser and navigating to http://192.168.1.101:32400/web
Mount dataset inside jail
Plex Media Server will be streaming music, series and movies. For those 3 types of media, I created 3 datasets on my FreeNAS box, with the permissions set so that everyone can read and execute. Just mounting the dataset inside the jail should be sufficient as the permissions configured on the dataset are fine. Before configuring the Plex Media Server, restart the service so the mounted storage inside the jail is recognised: service plexmediaserver_plexpass restartPlexpy monitoring tool
Another nice piece of software to install is Plexpy. It provides functionality to monitor your server and send notifications on events (ex. when a stream is started).Preparations
Before the application can be used, additional software should be installed; pkg install python2 databases/py-sqlite3 security/py-openssl security/ca_root_nss git Then move into the directory where a clone of the plexpy git repository will be created: cd /usr/local/share/ Now clone the plexpy git repository: git clone https://github.com/drzoidberg33/plexpy.git It is also advised to have a dedicated user to execute the plexpy application. In order to do this, use the useradd command. The user name given 'plexpy'. Modify the permissions on the plexpy folder: chmod -R 770 plexpy Modify the owner and groupowner on the plexpy folder: chown -R plexpy:plexpy plexpy Now log in to a shell as the plexpy user created earlier so that the application can be tested: su plexpy cd /usr/local/share/plexpy python2 PlexPy.py From here, the plex application should be running and accessible via http://192.168.1.101:8181Start plexpy automatically at boot
The next steps will allow the plexpy application to start automatically at boot or restart of the jail. Copy the sample initscript inside the /etc/rc.d/ folder and modify the permissions so that user, group and other can read and execute.cp /usr/local/share/plexpy/init-scripts/init.freenas /etc/rc.d/plexpy
chmod 555 /etc/rc.d/plexpy
Then, modify the startup script so that the 'plexpy' user will be used to start the plexpy application:
ee /etc/rc.d/plexpy
: ${plexpy_user:="plexpy"}
Lastly, add the following line
plexpy_enable="YES"
inside the /etc/rc.conf file. If the jail would now be restarted, plex media server and plexpy should be automatically started.