My goal was to set up a media server that would meet these criteria:
- Plex server
- Linux (free)
- Secondary disk with all my media (movies, music, etc.)
- Disk accessible in sharing with Windows and Linux
First, I built myself a machine with old parts (i3-2120) with an SSD for the OS and a big disk for the media files.
The installation of Debian 11 is rather standard and does not cause problems.
Installing Plex
After downloading Plex Media Server, just install it. Example:
sudo apt install ./plexmediaserver_1.31.1.6733-bc0674160_amd64.deb
Then start the Plex server:
sudo systemctl start plexmediaserver
Disk
For the secondary disk to be accessible at all times, it must be permanently mounted. Open the disk configuration tool in Linux:
In the options to mount the disc, choose a mount point in /media/<user>. In my case, with user “eric”, I specified the path /media/eric/mediadisk:
The disc will thus be easily accessible at all times.
Permissions
When installing Plex, a group and user named plex is created automatically. You must configure the access rights correctly so that plex has access to the disk.
Add yourself to plex group :
sudo adduser eric plex
Set plex as the folder owner:
sudo chgrp plex "/media/eric/"
sudo chmod g+rX "/media/eric/"
sudo chgrp plex "/media/eric/mediadisk/"
sudo chmod g+rX "/media/eric/mediadisk/"
Ensure ACL permissions:
sudo setfacl -m g:plex:rx /media/eric/
Samba
For the folder to be accessible on a network share, you must install and configure samba . Here are the steps:
sudo apt install samba smbclient cifs-utils
Configure a samba user:
sudo smbpasswd -a eric
sudo smbpasswd -e eric
Edit samba configuration file:
sudo nano /etc/samba/smb.conf
In the text file, in the [global] section, add or modify the following lines:
workgroup = WORKGROUP
server min protocol = NT1
The “WORKGROUP” workgroup is the default one in Windows. The NT1 protocol allows Linux clients to communicate with samba.
At the end of the file, add another section as follows:
[media]
comment = Media Folder
path = /media/eric/mediadisk
writable = yes
guest ok = no
valid users = @plex
force create mode = 770
force directory mode = 770
inherit permissions = yes
Restart samba:
sudo service smbd restart
Network discovery
In order to improve the discovery of the machine on the network, the installation of WSDD is suggested. Here’s how:
sudo su
wget -O- https://pkg.ltec.ch/public/conf/ltec-ag.gpg.key | gpg --dearmour > /usr/share/keyrings/wsdd.gpg
source /etc/os-release
echo "deb [signed-by=/usr/share/keyrings/wsdd.gpg] https://pkg.ltec.ch/public/ ${UBUNTU_CODENAME:-${VERSION_CODENAME:-UNKNOWN}} main" > /etc/apt/sources.list.d/wsdd.list
apt update
apt install wsdd
For more info on this network discovery module:
https://github.com/christgau/wsdd/blob/master/README.md
At this stage, it is recommended to restart the machine.
Setting up Plex
In the Plex software, it will now be possible to add your media. When adding libraries, the disk will be accessible by Plex:
Access to sharing via Windows
If you are unable to access the share on a window station, you may need to add an additional module. In Windows, launch “Turn Windows features on or off ”, then activate SMB 1.0/CIFS Client. This will allow Windows to access the samba share: