====== Ubuntu - Plex - Configure Plex Media Server ======
Create the directories that will store the Plex media files:
sudo mkdir -p /mnt/{tv,movies}
sudo chown -R plex: /mnt
**NOTE:** The Plex Media Server runs as the user **plex**, which must have read and execute permissions to the media files and directories.
* The chown command sets this correct ownership.
----
====== Use Media on another system ======
To allow connecting to an Samba Share, install CIFS.
sudo apt install cifs-utils
----
===== Manually mount the remote content =====
**NOTE:** set the **username** and **password** as required.
**NOTE:** The problem with this manual mount option includes:
- The mount gets forgotten at boot.
* It would make sense to have the mounts automatically be enabled whenever the system is rebooted.
- The username and password are written to the log files. This is a security risk.
* It would be best to hide these.
----
==== To hide the Samba Password from being included directly into the mount command ====
Create a credentials file, **.smbcredentials**:
username=peter
password=some_strong_password
#domain=optional_domain_or_workgroupname
**NOTE:** The credentials file starts with a dot, which makes it a hidden file.
* Set the **username** and **password** as required.
* Uncomment the **domain** part by removing the hash sign in front if this is needed.
----
===== Set the permissions on the Credentials file =====
chmod 0600 ~/.smbcredentials
**NOTE:** The 0600 makes this file only read accessible to the user.
* **chmod 0600** (chmod a+rwx,u-x,g-rwx,o-rwx,ug-s,-t) sets permissions so that, (U)ser / owner can read, can write and cannot execute.
----
===== Have Plex Shares automatically load at boot =====
Add the following lines to /etc/fstab:
#Plex
//192.168.1.35/Movies /mnt/movies cifs credentials=/home/peter/.smbcredentials,uid=peter,gid=peter 0 0
//192.168.1.35/TV /mnt/tv cifs credentials=/home/peter/.smbcredentials,uid=peter,gid=peter 0 0
**NOTE:** This references the credentials file.
----
===== Test that this configuration works to mount the Samba shares =====
sudo mount -a
**NOTE:** This should automatically mount the shares shown in the /etc/fstab file.
Confirm this by looking at the share directories, in this case:
* /mnt/movies
* /mnt/tv
----
====== Configure the Plex GUI ======
Open a Web Browser, and type http://YOUR_SERVER_IP:32400/web, and you will be redirected to the plex website:
----
===== References =====
https://linuxize.com/post/how-to-install-plex-media-server-on-ubuntu-20-04/
https://askubuntu.com/questions/157128/proper-fstab-entry-to-mount-a-samba-share-on-boot