Ultimate multi user Plex Server setup - Part 1

  • Thread starter Thread starter Rehan Kumar
  • Start date Start date
  • Replies Replies 0
  • Views Views 4,113
This is my first guide and I will try to make a complete guide on setting up a Plex linux server (Ubuntu 18.04 minimal here)
I will try to this in 2 parts, in this part i will install qbittorrent (multiple instances), Plex with custom scanner, Sonarr( To automate TV shows downloads, vsftpd and jackett (indexer)

1)Update and upgrade all repositories using
Code:
sudo apt-get update && apt-get upgrade -y
2) First let us create folders, users and grant proper permissions, I will be creating 2 users with directory /Media/Family and /Media/Friends
Code:
sudo useradd family -d /Media/Family -m
sudo useradd friends -d /Media/Friends -m
mkdir /qBittorrent-conf
Code:
chgrp family /Media/Family -R
chgrp friends /Media/Friends -R
sudo chmod 2770 /Media/Family -R
sudo chmod 2770 /Media/Friends -R
sudo chmod 2777 /qBittorrent-conf -R
For added security make the chmod /qBittorrent-conf as 2770 and assign it to a group and add family and friends user to that group


3)We will now move on to install 2 instances of qBittorrent using systemd
Code:
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:qbittorrent-team/qbittorrent-stable
sudo apt install qbittorrent-nox -y
3.1)Now make 2 systemd files named qbittorrent-(user1).service and qbittorrent-(user2).service
Code:
sudo nano /etc/systemd/system/qbittorrent-family.service
and edit it
Code:
[Unit]
Description=qBittorrent Command Line Client
After=network.target

[Service]
#Do not change to "simple"
Type=forking
User=family
Group=family
UMask=007
ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8080 --profile=qBittorrent-conf/family
Restart=on-failure

[Install]
WantedBy=multi-user.target
2nd file as, change User, Group fields accordingly, change webui-port and profile directory
Code:
sudo nano /etc/systemd/system/qbittorrent-friends.service
Code:
[Unit]
Description=qBittorrent Command Line Client
After=network.target

[Service]
#Do not change to "simple"
Type=forking
User=friends
Group=friends
UMask=007
ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8081 --profile=qBittorrent-conf/friends
Restart=on-failure

[Install]
WantedBy=multi-user.target
3.2)Turn qbittorrent-nox On and Check if the config files are okay
Code:
sudo systemctl start qbittorrent-family
sudo systemctl start qbittorrent-friends
sudo systemctl status qbittorrent-family
sudo systemctl status qbittorrent-friends
If status shows as active (running then try to access the qBittorrent using ip-address-of-server:8080 for user family and ip-address-of-server:8081 for user friends, change save directory in qbit settings as /Media/Family and /Media/Friends respectively and try downloading some sample file, Now
Code:
sudo systemctl enable qbittorrent-family
sudo systemctl enable qbittorrent-friends
Now, we have 2 instances of qbittorrent-nox running with separate directory, Now onto Plex

4)To install plex
Code:
mkdir /Downloads
cd /Downloads
wget https://downloads.plex.tv/plex-media-server-new/1.19.3.2764-ef515a800/debian/plexmediaserver_1.19.3.2764-ef515a800_amd64.deb
sudo dpkg -i plex(press tab to complete name)
systemctl status plexmediaserver
adduser plex family
adduser plex friends
4.1)If status shows as active (running), reboot server
open cmd and type
Code:
ssh ip-address-of server -L 8888:localhost:32400 -l root
Type yes on promt, then enter password for root(or any other user)
4.2)open browser and goto localhost:8888/web
setus using GUI interface, for media folders add /Media/Family and /Media/Friends

4.3)Now to add custom scanner for better scanning

Code:
mkdir -p '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Scanners/Series'
wget -O '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Scanners/Series/Absolute Series Scanner.py' https://raw.githubusercontent.com/ZeroQI/Absolute-Series-Scanner/master/Scanners/Series/Absolute%20Series%20Scanner.py
chown -R plex:plex '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Scanners'
chmod 775 -R '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Scanners'
systemctl restart plexmediaserver

Access the plug-in by clicking on three dots near the category (eg. TV Shows) then go to manage library then edit then advanced then change scanner to absolute series scanner

5)Now to install sonarr using docker


Code:
sudo apt install docker.io
sudo systemctl enable docker

Now, change /Media/Family to respective directory in the following code, Find group and user ID.
You can have a sub-folder named TV to better organize the data
Code:
id -g family (Output 1000 in this case)
id -u family (output 1000 in this case)

docker create \
  --name=sonarr \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Kolkata \
  -e UMASK_SET=022 `#optional` \
  -p 8989:8989 \
  -v /Media/Family/Sonarr:/config \
  -v /Media/Family/TV:/tv \
  -v /Media/Family/:/downloads \
  --restart unless-stopped \
  linuxserver/sonarr

Docker start sonarr
similarly add another program named sonarr1 etc. with user2 directory


5.1)Access the sonarr using ip-address-of-server:8989 and go to system-- >settings-- >Download client-- >qBittorrent-- >enter all the asked details
To enable password on Sonnarr go to settings-- >general-- >security

Now you can add a indexer manually or use the next installation called jackett to enable,

6)Installing Jackett (torrent indexer/API for sonarr)
Code:
cd /Downloads
#https://github.com/Jackett/Jackett/releases, copy link from here
wget https://github.com/Jackett/Jackett/releases/download/v0.16.310/Jackett.Binaries.LinuxAMDx64.tar.gz
tar -xvf Jackett (press tab to complete name)
cd Jackett
sudo ./install_service_systemd.sh

6.1) Go to ip-address-of-server:9117 to access Jackett, click on add indexer and add the ones you want then click on copy torznab feed and API Key.
now goto Sonarr-- >settings-- >indexer-- >torznab-- >custom-- >for anime add category as 5070 in anime field, in URL paste torznab feed and API Key in API, choose a name of your choice and add password to Jackett


Guide currently under work, Adding more details
 

Top