Prerequisites
This guide assumes you already have Plexmediaserver up and running and am familiar with how to set a static IP (Which is needed for running plexconnect)
Background Story
(New users (fresh install) skip straight to How to install)
I have been running Plexconnect as a service through sysvinit (/etc/init.d/) as explained in this post:
After each reboot i still had to restart the service.
This is because now (After 15.x) Ubuntu uses systemd, naturally Plex Media Server now comes with a unit file (systemd) . So what we need now is a systemd unit file for plexconnect. Ill follow most of the old steps as i have no intention of reinventing the wheel.
It’s also worth mentioning if you have your init.d script running without any issues, you dont need to follow this guide.
Removing the old sysvinit script (/etc/init.d/plexconnect)
(If you never followed the old guide you obviously dont have to do this)
Stop the server:
sudo service plexconnect stop
Backup your current script in case our new unit file does not work for you!
sudo mv /etc/init.d/plexconnect /etc/init.d/plexconnect.bak
Remove the script from rc.d
sudo update-rc.d plexconnect remove
Now you are ready to proceed.
If for some reason our new unit file does not work, you can revert to init.d:
sudo mv /etc/init.d/plexconnect.bak /etc/init.d/plexconnect
sudo update-rc.d plexconnect defaults
How to Install
Part 1
If you have installed plexconnect in the directories specified bellow (/opt/PlexConnect) and it’s up and running/working skip straight to step 2.
Full installation documentation can be found here:
We start by downloading Plexconnect, moving it to a more suitable location, adding some sql keys & certificates for the appletv and then moving the certificates. Do this commands one at a time (Trippel click on each line and copy) .
wget https://github.com/iBaa/PlexConnect/archive/master.zip
unzip master.zip
sudo mv PlexConnect-master/ /opt/PlexConnect
openssl req -new -nodes -newkey rsa:2048 -out ./trailers.pem -keyout ./trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"
openssl x509 -in ./trailers.pem -outform der -out ./trailers.cer && cat ./trailers.key >> ./trailers.pem
mv trailers.* /opt/PlexConnect/assets/certificates/
Part2
Now we are going to make the unit file for the startup process:
(If you have installed Plexconnect somewhere else than “/opt/PlexConnect” you need to replace this path with yours in every step its mentioned)
sudo nano /etc/systemd/system/plexconnect.service
Paste the following: (Look under for Arch)
[Unit]
Description=Plexconnect
After=plexmediaserver.service
[Service]
Type=simple
ExecStart=/usr/bin/python /opt/PlexConnect/PlexConnect.py
User=root
Group=root
Restart=on-failure
RestartSec=15
StartLimitInterval=10s
StartLimitBurst=3
[Install]
WantedBy=multi-user.target
For Arch (or based)
[Unit]
Description=Plexconnect
After=plexmediaserver.service
[Service]
Type=simple
ExecStart=/usr/bin/python2.7 /opt/PlexConnect/PlexConnect.py
User=root
Group=root
Restart=on-failure
RestartSec=15
StartLimitInterval=10s
StartLimitBurst=3
[Install]
WantedBy=multi-user.target
Exit and save with: “Ctrl-x, Y, Enter”
Now we should set the right permissions for our unit file:
sudo chmod 644 /etc/systemd/system/plexconnect.service
Now we update systemd: (Not so sure this is needed any more but doesn’t hurt)
sudo systemctl daemon-reload
Start at boot:
sudo systemctl enable plexconnect.service
Now our service is ready and we can start it with:
sudo systemctl start plexconnect.service
You can check your service status with:
sudo systemctl status plexconnect.service
Finally, how to setup your apple-tv:
Sources: