# Install on Ubuntu Server

**URL:** <https://forums.plex.tv/t/install-on-ubuntu-server/99103>\
**Category:** Apps & Creations\
**Created:** [April 6, 2015, 1:26am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103 "2015-04-06T01:26:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![S1naps1s](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@S1naps1s](https://forums.plex.tv/u/S1naps1s)\
**Post date:** [April 6, 2015, 1:26am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/1 "2015-04-06T01:26:52Z")

</div>

I am new to Plex, Plex Connect, and Ubuntu. So, this may be a newb question, but how do I install Plex Connect on Ubuntu Server? Sorry, if this is a dumb question, but, I have looked all over and can't find anything that says it can be done. Please help!

---

<div class="post-metadata">

**Author:** ![drewbie](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/drewbie/32/6262_2.png) [@drewbie](https://forums.plex.tv/u/drewbie)\
**Post date:** [April 6, 2015, 11:24am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/2 "2015-04-06T11:24:22Z")

</div>

[https://github.com/iBaa/PlexConnect/wiki/Install-Guide-Linux](https://github.com/iBaa/PlexConnect/wiki/Install-Guide-Linux) ?

---

<div class="post-metadata">

**Author:** ![AltonV](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/altonv/32/84340_2.png) [@AltonV](https://forums.plex.tv/u/AltonV)\
**Post date:** [April 6, 2015, 11:26am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/3 "2015-04-06T11:26:49Z")

</div>

Installation instructions are found here:  
[https://github.com/iBaa/PlexConnect/wiki/Install-Guide-Linux](https://github.com/iBaa/PlexConnect/wiki/Install-Guide-Linux)  
But they are more geared towards those with a desktop distro.

```
wget https://github.com/iBaa/PlexConnect/archive/master.zip
unzip master.zip
sudo mv PlexConnect-master/ /usr/local/lib/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.* /usr/local/lib/PlexConnect/assets/certificates/
```

After that you can run plexconnect manually with

```
sudo /usr/local/lib/PlexConnect/PlexConnect.py
```

If you want plexconnect to start automatically you need to create a startup script.  
Run

```
sudo nano /etc/init.d/plexconnect
```

and input this into the file

```
#!/bin/bash
### BEGIN INIT INFO
# Provides: plexconnect
# Required-Start: plexmediaserver networking
# Required-Stop: plexmediaserver networking
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: This is the Plex Connect daemon
# Description: This script starts the Plex Connect
# Python scripts in a detached screen.
### END INIT INFO
# Using the lsb functions to perform the operations.

. /lib/lsb/init-functions

# Process name ( For display )

NAME=PlexConnect

# Daemon name, where is the actual executable

DAEMON="/usr/bin/screen"  
DAEMON\_OPTS="-S PlexConnect -d -m /usr/local/lib/PlexConnect/PlexConnect.py"  
DAEMON\_USER=“root”

# pid file for the daemon

PIDFILE=/var/run/PlexConnect.pid

# If the daemon is not there, then exit.

test -x “$DAEMON” || exit 5

case $1 in  
start)

# Checked the PID file exists and check the actual status of process

if [-e $PIDFILE]; then  
status\_of\_proc -p $PIDFILE “$DAEMON $DAEMON\_OPTS” “$NAME process” && status=“0” || status="$?"

# If the status is SUCCESS then don’t need to start again.

if [$? = “0”]; then  
log\_success\_msg “Starting the process $NAME”  
exit # Exit  
fi  
fi

# Start the daemon.

# Start the daemon with the help of start-stop-daemon

# Log the message appropriately

if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -p $PIDFILE – ${DAEMON\_OPTS}; then  
while read line ; do [[$line =~ ([0-9]\*).PlexConnect ]] && echo ${BASH\_REMATCH[1]} ; done \< \<(screen -ls) \> $PIDFILE  
log\_success\_msg “Starting the process $NAME”  
else  
log\_failure\_msg “Starting the process $NAME”  
fi  
;;  
stop)

# Stop the daemon.

if [-e $PIDFILE]; then  
status\_of\_proc -p $PIDFILE “$DAEMON DAEMON\_OPTS” “Stoppping the $NAME process” && status=“0” || status="$?"  
if [“$?” = 0]; then  
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE  
/bin/rm -rf $PIDFILE  
log\_success\_msg ““Stopping the $NAME process””  
fi  
else  
log\_failure\_msg “$NAME process is not running”  
fi  
;;  
restart)

# Restart the daemon.

$0 stop && sleep 2 && $0 start  
;;  
status)

# Check the status of the process.

if [-e $PIDFILE]; then  
status\_of\_proc -p $PIDFILE “$DAEMON $DAEMON\_OPTS” “$NAME process” && exit 0 || exit $?  
log\_success\_msg “$NAME process is running”  
else  
log\_failure\_msg “$NAME process is not running”  
fi  
;;  
reload)  
$0 restart  
;;  
\*)

# For invalid arguments, print the usage message.

echo “Usage: $0 {start|stop|restart|reload|status}”  
exit 2  
;;  
esac
```

_(Script taken from [this post](https://forums.plex.tv/topic/71220-linux-install-for-plex-connect/).)_  
&nbsp;  
After that run

  
  

```
sudo apt-get -y install screen
sudo chown root:root /etc/init.d/plexconnect
sudo chmod 755 /etc/init.d/plexconnect
sudo update-rc.d plexconnect defaults
sudo service plexconnect start
```

Done.  
Go and setup your appletv.  
[https://github.com/iBaa/PlexConnect/wiki/Install-Guide](https://github.com/iBaa/PlexConnect/wiki/Install-Guide)

---

<div class="post-metadata">

**Author:** ![S1naps1s](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@S1naps1s](https://forums.plex.tv/u/S1naps1s)\
**Post date:** [April 6, 2015, 7:16pm UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/4 "2015-04-06T19:16:32Z")

</div>

First off, thanks for your help, it worked 99% flawlessly. The only issue I have is this:  
  
When I type:

```
sudo update-rd.d plexconnect defaults
```
I get:
```
insserv: Service plexmediaserver has to be enabled to start service plexconnect
insserv: exiting now!
update-rc.d: error: insserv rejected the script header
```
PMS IS running, I have tried stopping it and restarting it. Any suggestions or thoughts what I may be doing wrong?

---

<div class="post-metadata">

**Author:** ![AltonV](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/altonv/32/84340_2.png) [@AltonV](https://forums.plex.tv/u/AltonV)\
**Post date:** [April 6, 2015, 11:30pm UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/5 "2015-04-06T23:30:18Z")

</div>

> First off, thanks for your help, it worked 99% flawlessly. The only issue I have is this:  
> When I type:
> 
> ```
> sudo update-rd.d plexconnect defaults
> ```
> I get:
> ```
> insserv: Service plexmediaserver has to be enabled to start service plexconnect
> insserv: exiting now!
> update-rc.d: error: insserv rejected the script header
> ```
> PMS IS running, I have tried stopping it and restarting it. Any suggestions or thoughts what I may be doing wrong?

Strange. It did work fine for me.

You could try editing the&nbsp;/etc/init.d/plexconnect file and change

```
# Required-Start:    plexmediaserver networking
# Required-Stop:     plexmediaserver networking
```

to

```
# Required-Start:    networking
# Required-Stop:     networking
```

---

<div class="post-metadata">

**Author:** ![izznogooood](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/izznogooood/32/118410_2.png) [@izznogooood](https://forums.plex.tv/u/izznogooood)\
**Post date:** [March 3, 2016, 12:00am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/6 "2016-03-03T00:00:39Z")

</div>

I highly suggest that this guide be renamed and sticked to “Install as a service in Ubuntu”.

Following the last post this works perfectly on 15.10 as well.

I wish i knew about this a long time ago, this is genius…

---

<div class="post-metadata">

**Author:** ![izznogooood](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/izznogooood/32/118410_2.png) [@izznogooood](https://forums.plex.tv/u/izznogooood)\
**Post date:** [March 21, 2016, 4:36pm UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/7 "2016-03-21T16:36:36Z")

</div>

Does anyone else have a problem with a reboot? My plexconnect then starts as:

`Active (exited)`

After a restart its back to:

`Avtice (Running)`

---

<div class="post-metadata">

**Author:** ![tommyprevatt](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@tommyprevatt](https://forums.plex.tv/u/tommyprevatt)\
**Post date:** [April 25, 2016, 3:21am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/8 "2016-04-25T03:21:01Z")

</div>

> @AltonV said:
> 
> Strange. It did work fine for me.
> 
> You could try editing the&nbsp;/etc/init.d/plexconnect file and change
> 
> # Required-Start:&nbsp;&nbsp;&nbsp; plexmediaserver networking
> 
> # Required-Stop:&nbsp;&nbsp;&nbsp;&nbsp;plexmediaserver networking
> 
> to
> 
> # Required-Start: &nbsp; &nbsp;networking
> 
> # Required-Stop: &nbsp; &nbsp;networking

It worked with this edit for me! Didn’t work before. Thanks for the script!

---

<div class="post-metadata">

**Author:** ![tommyprevatt](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@tommyprevatt](https://forums.plex.tv/u/tommyprevatt)\
**Post date:** [April 25, 2016, 3:28am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/9 "2016-04-25T03:28:21Z")

</div>

> @tommyprevatt said:
> 
> > @AltonV said:
> > 
> > Strange. It did work fine for me.
> > 
> > You could try editing the&nbsp;/etc/init.d/plexconnect file and change
> > 
> > # Required-Start:&nbsp;&nbsp;&nbsp; plexmediaserver networking
> > 
> > # Required-Stop:&nbsp;&nbsp;&nbsp;&nbsp;plexmediaserver networking
> > 
> > to
> > 
> > # Required-Start: &nbsp; &nbsp;networking
> > 
> > # Required-Stop: &nbsp; &nbsp;networking
> 
> It worked with this edit for me! Didn’t work before. Thanks for the script!

I take that back, after reboot it does not start…

Isn’t there just some way to make linux run “./usr/local/lib/PlexConnect\_daemon.bash start” upon boot??  
Because that command works every time…

---

<div class="post-metadata">

**Author:** ![AltonV](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/altonv/32/84340_2.png) [@AltonV](https://forums.plex.tv/u/AltonV)\
**Post date:** [April 25, 2016, 3:34pm UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/10 "2016-04-25T15:34:46Z")

</div>

> @tommyprevatt said:
> 
> > @tommyprevatt said:
> > 
> > > @AltonV said:
> > > 
> > > Strange. It did work fine for me.
> > > 
> > > You could try editing the&nbsp;/etc/init.d/plexconnect file and change
> > > 
> > > # Required-Start:&nbsp;&nbsp;&nbsp; plexmediaserver networking
> > > 
> > > # Required-Stop:&nbsp;&nbsp;&nbsp;&nbsp;plexmediaserver networking
> > > 
> > > to
> > > 
> > > # Required-Start: &nbsp; &nbsp;networking
> > > 
> > > # Required-Stop: &nbsp; &nbsp;networking
> > 
> > It worked with this edit for me! Didn’t work before. Thanks for the script!
> 
> I take that back, after reboot it does not start…
> 
> Isn’t there just some way to make linux run “./usr/local/lib/PlexConnect\_daemon.bash start” upon boot??  
> Because that command works every time…

You could use cron.

Run “crontab -e” and it will open a file in your prefered editor.  
Add the line “@reboot ./usr/local/lib/PlexConnect\_daemon.bash start” without the quotes.

---

<div class="post-metadata">

**Author:** ![izznogooood](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/izznogooood/32/118410_2.png) [@izznogooood](https://forums.plex.tv/u/izznogooood)\
**Post date:** [May 5, 2016, 8:55am UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/11 "2016-05-05T08:55:07Z")

</div>

Take a look here:

> **[Ubuntu 15+, Debian 8+, Raspbian (Jessie), Arch (or based) Autostart](http://forums.plex.tv/discussion/213637/ubuntu-15-debian-8-raspbian-jessie-guide-for-service-installation-autostart)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 8, 2020, 6:55pm UTC](https://forums.plex.tv/t/install-on-ubuntu-server/99103/12 "2020-01-08T18:55:50Z")

</div>


