wlado's website

Raspberry Pi 3 - Plex server - headless

Postup instalace Plex serveru na Raspbian Stretch lite 2018-11-13.

Instalace je bez okenní nástavby, bez připojeného monitoru (headless) a bez SD karty přímo na SSD 860 EVO 1TB odkud se spouští a běží celý systém i data. Veškerá instalce a ovládání probíha na Macbooku se systémem Mac OS X 10.6.8 přes aplikaci Terminál.

Součásti:

- Raspberry 3
- SSD disk
- USB SATA převodník (s externím napájením)
- Napájecí zdroj s USB
- USB USB mikro napájecí kabel
- Ethernet kabel
- Krabička

1. Instalace Raspbian lite
--------------------------

1.1 Připojit zformátovaný SSD pomocí USB k MacOSX

$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS HD1TB 999.9 GB disk0s2
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *1.0 TB disk1
1: DOS_FAT_32 UNTITLED 1.0 TB disk1s1
$

1.2 Odpojit SSD disk

$ sudo diskutil unmount /dev/disk1s1
Password:
Volume UNTITLED on disk1s1 unmounted
$

1.3 Vypálit obraz disku na SSD

$ sudo dd bs=1m if=/Users/user/install/raspberrypi/2018-11-13-raspbian-stretch-lite.img of=/dev/rdisk1
1780+0 records in
1780+0 records out
1866465280 bytes transferred in 51.191174 secs (36460685 bytes/sec)
$

1.4 Pro headless instalaci přidat do boot oddílu prázdný soubor s názvem ssh. (Po instalaci ho systém smaže.)

$ cd /Volumes/boot/
$ touch ssh
$

1.5 Zavřít okno Terminálu a znovu ho otevřít - jinak mi nejde vysunout disk

$ sudo diskutil eject /dev/rdisk1
Password:
Disk /dev/rdisk1 ejected
$

1.6 Odpojit fyzicky SSD disk z počítače a vložit do vypnutého Raspberry Pi

1.7 Spustit RaspberryPi

Během 15 sekund Raspberry Pi 3 poprvé nabootuje a pak provede resize a rebootuje. Doba trvání celkem cca 1 minuta

Po rebootu musí červená LED na Raspberry Pi trvale svítit (Power) a zelená začít pomalu blikat (Disk). Pokud bliká červená znamená to pokles napětí z 5V pod 4,63 V.

Více: https://elinux.org/R-Pi_Troubleshooting#Red_power_LED_is_on.2C_green_LED_does_not_flash.2C_nothing_on_display

1.8 Zjistit IP adresu na routeru (musí být spuštěný DHCP server)

1.9 Připojit se pomocí SSH

$ ssh pi@10.0.0.107
The authenticity of host '10.0.0.107 (10.0.0.107)' can't be established.
RSA key fingerprint is 62:88:8d:21:eb:83:25:d8:5f:e9:64:4f:98:cf:dc:eb.
Are you sure you want to continue connecting (yes/no)? yes [ENTER]
Warning: Permanently added '10.0.0.107' (RSA) to the list of known hosts.
pi@10.0.0.107's password: raspberry
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi:~ $

1.10 Změna hesla

pi@raspberrypi:~ $ passwd
Changing password for pi.
(current) UNIX password: raspberry
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
pi@raspberrypi:~ $

1.11 aktualizace

pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get upgrade

2) Instalace HTTPS download transport pro APT (pokud chybí)
-----------------------------------------------------------

$ sudo apt-get install apt-transport-https -y --force-yes
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.4.8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$

3) Stažení klíče pro download
-----------------------------

pi@raspberrypi:~ $ wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -
--2019-03-06 22:21:44-- https://dev2day.de/pms/dev2day-pms.gpg.key
Resolving dev2day.de (dev2day.de)... 144.76.172.47, 2a01:4f8:200:502e::2
Connecting to dev2day.de (dev2day.de)|144.76.172.47|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1646 (1.6K) [application/pgp-keys]
Saving to: ‘STDOUT’

- 100%[======================>] 1.61K --.-KB/s in 0s

2019-03-06 22:21:44 (38.3 MB/s) - written to stdout [1646/1646]

OK
pi@raspberrypi:~ $

4) Přidání Plex repozitáře do seznamu zdrojů
--------------------------------------------

pi@raspberrypi:~ $ echo "deb https://dev2day.de/pms/ st
retch main" | sudo tee /etc/apt/sources.list.d/pms.list
deb https://dev2day.de/pms stretch main

5) znovu update
---------------

$ sudo apt-get update
Hit:1 http://mirrordirector.raspbian.org/raspbian stretch InRelease
Hit:2 http://archive.raspberrypi.org/debian stretch InRelease
Get:3 https://dev2day.de/pms stretch InRelease [1,801 B]
Get:4 https://dev2day.de/pms stretch/main armhf Packages [503 B]
Fetched 2,763 B in 1s (1,400 B/s)
Reading package lists... Done
$

6) Instalace Plex Media Server
------------------------------

pi@raspberrypi:/ $ sudo apt-get install -t stretch plexmediaserver-installer -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
plexmediaserver-installer
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,680 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 https://dev2day.de/pms stretch/main armhf plexmediaserver-installer armhf 1.14.1.5488-cc260c476-1 [7,680 B]
Fetched 7,680 B in 0s (10.8 kB/s)
Selecting previously unselected package plexmediaserver-installer.
(Reading database ... 34705 files and directories currently installed.)
Preparing to unpack .../plexmediaserver-installer_1.14.1.5488-cc260c476-1_armhf.deb ...
Unpacking plexmediaserver-installer (1.14.1.5488-cc260c476-1) ...
Setting up plexmediaserver-installer (1.14.1.5488-cc260c476-1) ...
Adding user plex to group video
Downloading readynas package ...
######################################################################## 100.0%
Passed checksum test.
Extracting readynas.deb ...
rm: cannot remove '/etc/systemd/system/plexmediaserver.service.d/override.conf': No such file or directory
Synchronizing state of plexmediaserver.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable plexmediaserver
Processing triggers for systemd (232-25+deb9u9) ...
pi@raspberrypi:/ $

7) reboot
---------

$ sudo reboot

8) Spuštění Plexu na prohlížeči
-------------------------------

8.1 Ve web prohlížeči: http://ip_adresa_raspberrypi:32400/web

8.2 zmáčknout vpravo dole What’s this?

8.3 zmáčknout dole Skip...

8.4 zmáčknout: Rozumím

8.5 zavřít okno Plex Pass

8.6 Základní nastavení serveru
- Pojemnování ... : plex
- Nezaškrtnout: Povolit přístup k mým médiím i mimo můj domov
- Další

8.7 Nastavení media složek na serveru
- Přidat knihovnu
- Další

tady někde to skončí ve smyčce, protože nejsou na disku žádná užitečná data

9) Nastavení uživatele
----------------------

$ sudo nano /etc/default/plexmediaserver.prev
(defaultní výpis)

# default script for Plex Media Server

# the number of plugins that can run at the same time
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6

# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000

# where the mediaserver should store the transcodes
PLEX_MEDIA_SERVER_TMPDIR=/tmp

# uncomment to set it to something else
# PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application\ Support"

# the user that PMS should run as, defaults to 'plex'
# note that if you change this you might need to move
# the Application Support directory to not lose your
# media library
PLEX_MEDIA_SERVER_USER=plex

* Poznámky k posledním verzím 2017: https://forums.plex.tv/discussion/288301/update-plexmediaserver-on-raspberry-pi-3

* Starší návod: https://medium.com/@nem25/plex-media-server-on-raspberry-pi-3-using-raspbian-lite-b2f67761e674

* Novější návod: https://medium.com/@nem25/plex-media-server-on-raspberry-pi-3-using-raspbian-lite-stretch-feace75f2b1d

10. Samba
---------

10.1 Instalace

$ sudo apt-get install samba samba-common-bin -y

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
attr libaio1 libfile-copy-recursive-perl libgpgme11 python-dnspython
samba-dsdb-modules samba-vfs-modules tdb-tools update-inetd
Suggested packages:
gpgsm bind9 bind9utils ctdb ldb-tools ntp | chrony smbldap-tools winbind
ufw heimdal-clients
The following NEW packages will be installed:
attr libaio1 libfile-copy-recursive-perl libgpgme11 python-dnspython samba
samba-common-bin samba-dsdb-modules samba-vfs-modules tdb-tools
update-inetd
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,869 kB/2,424 kB of archives.
After this operation, 15.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...
Setting up samba-common-bin (2:4.5.12+dfsg-2+deb9u4) ...
Setting up samba-dsdb-modules (2:4.5.12+dfsg-2+deb9u4) ...
Setting up attr (1:2.4.47-2) ...
Setting up libfile-copy-recursive-perl (0.38-1) ...
Setting up update-inetd (4.44) ...
Setting up samba-vfs-modules (2:4.5.12+dfsg-2+deb9u4) ...
Setting up samba (2:4.5.12+dfsg-2+deb9u4) ...
Adding group `sambashare' (GID 114) ...
Done.
Samba is not being run as an AD Domain Controller, masking samba-ad-dc-service.
Please ignore the following error about deb-systemd-helper not finding samba-ad-dc-service.
Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service
/lib/systemd/system/nmbd.service.
Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service
/lib/systemd/system/smbd.service.
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Processing triggers for systemd (232-25+deb9u6) ...

10.2 Zálohovat soubor smb.conf

$ sudo cp /etc/samba/smb.conf /etc/samba/smb.bak

10.3 Editovat smb.conf

$ sudo nano /etc/samba/smb.conf
# wins support = no
změnit na
wins support = yes

10.4 Nastavení sdílené složky

# name of share, it will be displayed when we search your network for shares
[plexmedia]
# komentář
comment = Plex media share
# path to shared folder
path = /home/pi/media
# this argument will determine the permission settings used when
# we create a new file in our share
create mask = 0775
directory mask = 0775
# alow our share to be seen by the windows client
browseable = yes

only guest = no
# alow guests to read/download files in our share (0775)
guest ok = yes
security = user

[public]
comment=veřejná složka
path=/home/pi/public
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
#public=no
guest ok=yes


10.5 Kontrola nastavení
------------------

$ testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[PLEXMEDIA]"
Processing section “[public]”
Loaded services file OK.
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

10.6 Nastavit uživatele

$ sudo smbpasswd -a pi
-- heslo stejne jako k uzivateli pi (aby se to lépe pamatovalo)
New SMB password:
Retype new SMB password:
Added user pi.
$

10.7 Restart
-------

$ sudo /etc/init.d/samba restart
Restarting nmbd (via systemctl): nmbd.service.
Restarting smbd (via systemctl): smbd.service.

10.8 Vytvoření složek

$ cd /home/pi/
pi@raspberrypi:~ $ ls
pi@raspberrypi:~ $ mkdir public
pi@raspberrypi:~ $ mkdir media

11 Dodatky

11.1 Změnit název Raspberry na plex

$ sudo raspi-config
2 Network Options -- N1 Hostname -- Please enter hostname: plex -- OK -- Finish -- Would you like to reboot now? -- Yes

--------------------------------------------------
Zdroje:

https://medium.com/@nem25/plex-media-server-on-raspberry-pi-3-using-raspbian-lite-b2f67761e674

parametry samba: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html