Skip to content

Instantly share code, notes, and snippets.

@airtonix
Last active March 13, 2021 14:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save airtonix/8120365 to your computer and use it in GitHub Desktop.
Save airtonix/8120365 to your computer and use it in GitHub Desktop.
How to Install Couchpotato "The Right Way(tm)"

This guide will walk you through installing couchpotato from source.

There are a few assumptions I'm making about you and your system :

  • your current user has write access to /opt/
  • virtualenv installed : sudo apt-get install python-virtualenv
  • git is installed: sudo apt-get install git

First, download the source code and setup the environ in a directory.

cd /opt/
git clone https://github.com/RuudBurger/CouchPotatoServer.git ./couchpotato
cd ./couchpotato
virtualenv ./environ/
sudo useradd --system --user-group --no-create-home couchpotato
sudo chown -R couchpotato:couchpotato ./couchpotato

This sets the stage for getting couchpotato up and running on system start.

cd couchpotato
sudo cp ./init/ubuntu /etc/init.d/couchpotato
sudo cp ./init/ubuntu.default /etc/default/couchpotato

Customise the config defaults sudo nano /etc/default/couchpotato, because they are going to contain invalid details

CP_HOME=/opt/couchpotato
CP_USER=couchpotato
PYTHON_BIN=$CP_HOME/environ/bin/python

You should have something like:

/opt$ ls -al ./couchpotato/
total 84
drwxr-xr-x  6 couchpotato   couchpotato    4096 Dec 25 15:20 .
drwxrwxrwx 10 administrator administrator  4096 Dec 25 15:20 ..
-rw-rw-r--  1 couchpotato   couchpotato    1086 Dec 25 15:20 contributing.md
drwxrwxr-x  5 couchpotato   couchpotato    4096 Dec 25 15:20 couchpotato
-rwxrwxr-x  1 couchpotato   couchpotato    4486 Dec 25 15:20 CouchPotato.py
drwxrwxr-x  8 couchpotato   couchpotato    4096 Dec 25 15:20 .git
-rw-rw-r--  1 couchpotato   couchpotato      46 Dec 25 15:20 .gitignore
drwxrwxr-x  2 couchpotato   couchpotato    4096 Dec 25 15:20 init
drwxrwxr-x 40 couchpotato   couchpotato    4096 Dec 25 15:20 libs
-rw-rw-r--  1 couchpotato   couchpotato   35125 Dec 25 15:20 license.txt
-rw-rw-r--  1 couchpotato   couchpotato    3849 Dec 25 15:20 README.md
-rw-rw-r--  1 couchpotato   couchpotato      33 Dec 25 15:20 version.py

And when you run it :

/opt$ sudo service couchpotato start
Starting CouchPotato

/opt$ ps -fe | grep couchpotato
997      13998     1  7 15:52 ?        00:00:02 /opt/couchpotato/environ/bin/python CouchPotato.py --quiet --daemon --pid_file=/var/run/couchpotato.pid --data_dir=/var/couchpotato

```
@ShawnMTherrien
Copy link

There was a bug here for me on ubuntu server 14.04.

The line:
virtualenv ./environ/
had to be amended to place the environ folder inside the couchpotato folder:
virtualenv ./couchpotato/environ/

Otherwise, no problems :)

@airtonix
Copy link
Author

@ShawnMTherrien fixed. cheers.

@overloadsix
Copy link

Why do people choose when they want to use sudo? Your code is still not "the right way".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment