How to set up plexmediaserver in Ubuntu 16.04?

I can install it but it can't see my files. I believe It's a permission issue because plexmediaserver is run by 'plex' user. In Ubuntu 14.04, I could edit /etc/default/plexmediaserver so that it would be run by me. It's doesn't seem to work in 16.04 (because systemd ?).

I've tried http://www.htpcguides.com/install-plex-media-server-ubuntu-16-x-and-later/, with the debian source or with the deb. I can't seem to start the service ..

[user@machine]:[~] $  sudo systemctl start plexmediaserver.service
Job for plexmediaserver.service failed because the control process exited with error code. See "systemctl status plexmediaserver.service" and "journalctl -xe" for details.
[user@machine]:[~] $ systemctl status plexmediaserver.service
● plexmediaserver.service - Plex Media Server for Linux
   Loaded: loaded (/etc/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/plexmediaserver.service.d
           └─local.conf
   Active: inactive (dead) (Result: exit-code) since lun. 2016-05-02 18:58:40 CEST; 34s ago
  Process: 2784 ExecStart=/bin/sh -c /usr/lib/plexmediaserver/Plex\ Media\ Server (code=exited, status=139)
  Process: 2779 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" (code=exited, status=0
 Main PID: 2784 (code=exited, status=139)

mai 02 18:58:35 machine systemd[1]: plexmediaserver.service: Unit entered failed state.
mai 02 18:58:35 machine systemd[1]: plexmediaserver.service: Failed with result 'exit-code'.
mai 02 18:58:40 machine systemd[1]: plexmediaserver.service: Service hold-off time over, scheduling restart.
mai 02 18:58:40 machine systemd[1]: Stopped Plex Media Server for Linux.
mai 02 18:58:40 machine systemd[1]: plexmediaserver.service: Start request repeated too quickly.
mai 02 18:58:40 machine systemd[1]: Failed to start Plex Media Server for Linux.
mai 02 18:59:02 machine systemd[1]: plexmediaserver.service: Start request repeated too quickly.
mai 02 18:59:02 machine systemd[1]: Failed to start Plex Media Server for Linux.

Solution 1:

Plex Media Server on Ubuntu 16.04LTS (only for Plex-Pass free Downloads)

init.d is legacy so forget /etc/default/plexmediaserver because its ignored. Instead use systemctl.

Setting it up; add the repo for “automatic” updates:

echo deb https://downloads.plex.tv/repo/deb ./public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
sudo apt update
sudo apt install plexmediaserver -y

To avoid permission problems run the server as your standard user, replace “plex” with your user and group in:

sudo nano /etc/systemd/system/plexmediaserver.service

If this file is empty, paste the following into the file.

[Unit]
Description=Plex Media Server for Linux
After=network.target

[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support"
Environment=PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
Environment=PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
Environment=PLEX_MEDIA_SERVER_TMPDIR=/tmp
Environment=LD_LIBRARY_PATH=/usr/lib/plexmediaserver
Environment=LC_ALL=en_US.UTF-8
Environment=LANG=en_US.UTF-8
ExecStartPre=/bin/sh -c '/usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"'
ExecStart=/bin/sh -c '/usr/lib/plexmediaserver/Plex\ Media\ Server'
Type=simple
User=user
Group=group
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3

[Install]
WantedBy=multi-user.target

Now also change the ownership of the next subdir to your user!

sudo chown -R user:group /var/lib/plexmediaserver
sudo systemctl --system daemon-reload
sudo service plexmediaserver start

Now you can set up your pms.