How to: Plex on Apple TV 3 using Ubuntu Headless and PlexConnect

12
995
Apple TV
Apple TV

Problem / Outcome Summary

  • This article will enable you to watch media served from any Plex server in your house on from Plex on your Apple TV 3
  • If you don’t have a Plex Media Server, have a look at our Plex Media Server on Ubuntu Linux Headless guide here.
  • Please see the ‘Summary Overview’ tab below for a high level view of the objectives this ‘how to’ will achieve.

Why might I want to do this?

  • Because you already have an Apple TV and it doesn’t work with Plex out of the box
  • Because Apple TV is a premium product, with full working remote and low power consumption
  • Because it saves you having to get another device, when you already have a capable Apple TV.
  • Because you don’t own a Mac, and PlexConnect works great running entirely on Ubuntu Linux Headless or any other Linux computer.

Foreword

To be clear, what does PlexConnect do?

Simply put, PlexConnect provides a ‘web system’, that runs on your Apple TV and ‘streams’ the media from your Plex device in a nice easy to use package.  This is not available by default with the Standard Apple TV 3, which is why plexconnect was created.

Pre-Requisites

Software Dependencies

Hardware Dependencies

  • An Apple TV 2 or 3
  • An internet Modem / Router capable of performing NAT

Tools Required

  • SSH Access
  • A recent web browser

Other Dependencies

  • A working internet connection

High Level Summary Steps

The below lists the high level summary of steps we’re about to take during this howto.

  • Connect to Ubuntu Linux and download required software
  • Configure PlexConnect
  • Test your software
  • Start PlexConnect automatically at boot
  • Configure your Apple TV

Implementation

Connect to Ubuntu Linux and Download Required Software

  1. Log in to your Ubuntu box with SSH
  2. Ensure you are in your home directory e.g. /home/yourname
  3. sudo apt-get update (to update packages to latest versions
  4. sudo apt-get install unzip
  5. sudo apt-get install python-imaging (for fanart backgrounds that look nice)
  6. wget https://github.com/iBaa/PlexConnect/archive/master.zip (latest version of PlexConnect)

Configure PlexConnect

  1. While still in the root of your home directory,
  2. unzip master.zip
  3. sudo mv PlexConnect-master /usr/local/lib

Generate the required certificates.

Please note: Yes it’s perfectly good to do this entirely on Ubuntu rather than on a Mac as some people have tried to suggest, which is great if you don’t own a mac.

**Update 11Dec2016:  There is one comment below from Aylin about receiving an error when making a certificate request.  It was solved by changing the path of the key files.  Be mindful of which directory you are in and where your files are.  Happy to answer questions if you get stuck.**

  1. Again, while still in your home directory, perform the below
  2. openssl req -new -nodes -newkey rsa:2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj “/C=US/CN=trailers.apple.com”
  3. openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem
  4. cp *.cer *.key *.pem /usr/local/lib/PlexConnect-master/assets/certificates/
  5. cd /usr/local/lib/PlexConnect-master
  6. sudo vi Settings.py Change, “ip_dnsmaster = 8.8.8.8″ and replace 8.8.8.8 with your internal routers IP address or similar if you have geo-unblocking or similar”

* Note the ‘prevent_atv_update = True’ line, which you can change should you wish to update your firmware on your ATV

Test your software

cd /usr/local/lib/PlexConnect-master

sudo ./PlexConnect.py

You’ll get similar to the following:
12:11:11 PlexConnect: ***
12:11:11 PlexConnect: PlexConnect
12:11:11 PlexConnect: Press CTRL-C to shut down.
12:11:11 PlexConnect: ***
12:11:11 Settings: add setting enable_plexgdm=True
12:11:11 Settings: add setting ip_pms=192.168.178.10
12:11:11 Settings: add setting port_pms=32400
12:11:11 Settings: add setting enable_dnsserver=True
12:11:11 Settings: add setting port_dnsserver=53
12:11:11 Settings: add setting ip_dnsmaster=192.168.1.1
12:11:11 Settings: add setting prevent_atv_update=True
12:11:11 Settings: add setting enable_plexconnect_autodetect=True
12:11:11 Settings: add setting ip_plexconnect=0.0.0.0
12:11:11 Settings: add setting hosttointercept=trailers.apple.com
12:11:11 Settings: add setting port_webserver=80
12:11:11 Settings: add setting enable_webserver_ssl=True
12:11:11 Settings: add setting port_ssl=443
12:11:11 Settings: add setting certfile=./assets/certificates/trailers.pem
12:11:11 Settings: add setting allow_gzip_atv=False
12:11:11 Settings: add setting allow_gzip_pmslocal=False
12:11:11 Settings: add setting allow_gzip_pmsremote=True
12:11:11 Settings: add setting loglevel=Normal
12:11:11 Settings: add setting logpath=.
12:11:11 PlexConnect: started: 12:11:11
12:11:11 PlexConnect: Version: 0.5-dev-020615
12:11:11 PlexConnect: Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]
12:11:11 PlexConnect: Host OS: linux2
12:11:11 PlexConnect: PILBackgrounds: Is PIL installed? True
12:11:11 PlexConnect: IP_self: 192.168.1.20
12:11:11 DNSServer: started: 12:11:11
12:11:11 DNSServer: ***
12:11:11 DNSServer: DNSServer: Serving DNS on 192.168.43.20 port 53.
12:11:11 DNSServer: intercept: [‘trailers.apple.com’] => 192.168.43.20
12:11:11 DNSServer: restrain: [‘mesu.apple.com’, ‘appldnld.apple.com’, ‘appldnld.apple.com.edgesuite.net’] => 127.0.0.1
12:11:11 DNSServer: forward other to higher level DNS: 192.168.1.1
12:11:11 DNSServer: ***
12:11:11 WebServer: started: 12:11:11
12:11:11 WebServer: ***
12:11:11 WebServer: WebServer: Serving HTTP on 192.168.43.20 port 80.
12:11:11 WebServer: ***
12:11:11 WebServer: started: 12:11:11
12:11:11 WebServer: ***
12:11:11 WebServer: WebServer: Serving HTTPS on 192.168.43.20 port 443.
12:11:11 WebServer: ***

Press CTRL-C to shutdown afterwards if you wish to make it start automatically at boot.

[spacer color=”429d4a” icon=”fa-angle-double-down” style=”3″]

Start PlexConnect automatically at boot

  1. sudo ln -s /usr/local/lib/PlexConnect-master/PlexConnect_daemon.bash /etc/init.d/PlexConnect_daemon.bash
  2. sudo update-rc.d PlexConnect_daemon.bash defaults

PlexConnect should start automatically upon a reboot of your Ubuntu Linux system.

Configure your Apple TV

  1. Go to the settings menu on the Apple TV
  2. Select the General option
  3. Then scroll down and ‘highlight’ the ‘send data to apple’ and change to ‘No’
  4. While this remains highlighted, press the ‘Play’ button on the Apple Remote
  5. Enter http://your_plexconnect_ip_address/trailers.cer (so make it like 192.168.1.20/trailers.cer)

You also have to change the DNS on the Apple TV to point to your PlexConnect IP address.  You do this through Settings, General Network, WiFi, or Settings General, Network, Ethernet.

Go through the network settings as if you were setting them up from scratch and when it get’s to the configuration page, change the Configure DNS setting to Manual and enter in your IP address there.  At this point you should be all done and all should be working.  You may have to restart your Apple TV.

You access Plex by clicking on the trailers icon on the apple TV.

That’s it!

Final Word

Note that running Plex on Apple TV actually forces the Plex Server to do CPU intensive Transcoding.  This is because the Apple TV has been designed by Apple to only play approved media formats which usually don’t cover those included in your Plex Server.  Plex therefore has to convert media from whatever format you have it in, into the Apple TV supported format.

As a guide, you need about 2000 on CPU Mark per 1080p transcode.  Check your CPU and how it stacks up here.

See our latest guide on how to set up Plex Media Server file permissions here.

Marshalleq