So I got me another Raspberry Pi 2, and I’m working on building my main media center on it. Of, course, most of the stuff needed for a media center on a Raspberry Pi is pretty straight forward today, and there are lots of guides on the net which will help building a perfect media center. However, one thing I did not find, and it is installing CouchPotato server on an official build of OpenELEC. This is mainly because OpenELEC is specifically optimized distribution of Linux for media centers. Anyways, after some playing with OpenELEC through SSH (can be enabled in the system settings), I’ve managed to run the latest CouchPotato as a service using systemd. Below are the steps to accomplish the above:

1. First, we need to get the latest version of CouchPotato

git clone https://github.com/RuudBurger/CouchPotatoServer.git

2. Next, push the files to a to a directory of your choice:
NOTE: Default password for root is ‘openelec’, pretty hard to change it, but a lot of guides on the web are available on this topic. I use the private key authentication method (no password allowed).

cd ~/CouchPotatoServer
scp -r ./ mich@media-rpi:/storage/CouchPotatoServer
3. SSH into your OpenELEC installation, and create a service file for CouchPotato:

cd ~/.config/system.d/
vi couchpotato.service

 4. Paste the following into the service file (editing paths if you need to)

[Unit]
Description=CouchPotato application instance
Requires=network-online.service
#After=storage-downloads.mount storage-movies.mount

[Service]
Type=idle
ExecStart=/bin/sh -c "/usr/bin/python /storage/CouchPotatoServer/CouchPotato.py --daemon"
GuessMainPID=no
Type=forking
TimeoutStopSec=1
Restart=always
RestartSec=2
StartLimitInterval=0

[Install]
WantedBy=kodi.target

NOTE: The after= line is optional, I use samba shares that are mounted using services, and I need them mounted before CouchPotato as my library is there.

3. And finally, enable and start the service you just created

systemctl enable couchpotato.service
systemctl start couchpotato.service

 

That’s it! Till next time!