How to Install CouchPotato on Ubuntu Server/Desktop

This tutorial will show you how to install CouchPotato on Ubuntu. CouchPotato is a free and open-source (GPL3) tool to download upcoming movies automatically. It periodically searches for movies on Usenet and torrent sites, and once they are available, it automatically downloads them with your chosen Usenet client or torrent client. We will use the Deluge torrent client as an example.

couchpotato ubuntu

CouchPotato Features:

  • An intuitive web interface
  • Allows you to choose movie quality
  • The ability to rename download movies
  • download subtitles
  • A browser extension to easily add movies via imdb.com
  • Supports many public and private trackers (RARBG, ThePirateBay, SceneTime, TorrentBytes, etc.)
  • Supports transmission, qBittorrent, rTorrent, Deluge, uTorrent.
  • Supports many Usenet indexers and Usenet clients (Sabnzbd, CouchPotato)

Now let’s see the installation process.

How to Install CouchPotato on Ubuntu Server/ Desktop

First, open up a terminal window and install Python and LXML.

sudo apt install python python-lxml

Then install the latest version of pyOpenSSL. (If you use Ubuntu 20.04, you don’t need to do this.)

sudo apt install python-pip

sudo pip install --upgrade pyopenssl

Change directory to /var/lib/.

cd /var/lib/

Install Git and clone CouchPotato repository on Github.

sudo apt install git-core

sudo git clone https://github.com/CouchPotato/CouchPotatoServer.git

Now CouchPotato is downloaded to the directory /var/www/CouchPotatoServer. To start CouchPotato server, run the following command.

python2 /var/lib/CouchPotatoServer/CouchPotato.py

Create a Systemd Service Unit for CouchPotato

It’s inconvenient to use the above command to start and stop CouchPotato server. We can use systemd instead. Press Ctrl+C to stop CouchPotato server.

To make CouchPotato automatically start at boot time, we need to copy the systemd service file.

sudo cp /var/lib/CouchPotatoServer/init/couchpotato.service /etc/systemd/system/couchpotato.service

Then edit the file.

sudo nano /etc/systemd/system/couchpotato.service

Find the following line:

ExecStart=/var/lib/CouchPotatoServer/CouchPotato.py

Change it to:

ExecStart=python2 /var/lib/CouchPotatoServer/CouchPotato.py

Also change the value of User and Group from couchpotato to your own username and group like below.

User=linuxbabe
Group=linuxbabe

Save and close the file. Start the service.

sudo systemctl start couchpotato.service

And enable auto-start at boot time.

sudo systemctl enable couchpotato.service

Check its status.

systemctl status couchpotato.service

As you can see, it’s active (running).

couchpotato systemd service unit

Launch the Setup Wizard

If you installed CouchPotato on a local Ubuntu computer, enter http://127.0.0.1:5050/wizard/ in the web browser address bar to launch the setup wizard. If you installed CouchPotato on a remote Ubuntu server, you need to set up a reverse proxy with Nginx or Apache in order to access the web UI, which is explained later in this tutorial.

In the setup wizard, you can set a username and password to secure the CouchPotato web interface. You also have the option to enable a dark theme.

couchpotato ubuntu 16.04

Next, you need to select the download application.

couchpotato ubuntu 16.04 install

If you want to download movies and TV Shows on Usenet, then you need to select a Usenet client like NZBGet. NZBGet by default listens on port 6789, so enter localhost:6789 in the Host field, then enter the password.

couchpotato nzbget

And if you like to download Movies and TV Shows from torrent sites, then you need to select a torrent client. In this tutorial, I choose the Deluge torrent client.

deluge couchpotato ubuntu

By default, Deluge client daemon listens on port 58846, so enter localhost:58846 in the Host field. Then you need to edit the Deluge auth file.

sudo nano /var/lib/deluge/.config/deluge/auth

The default username is localclient. Number 10 indicates this account is used for administration. We can create a new account for CouchPotato like below. Number 5 indicates this account has read and write access.

couchpotato:password:5

couchpotato deluge username

Save and close the file. Then restart the deluge daemon.

sudo systemctl restart deluged

Next, enter the new username and password in CouchPotato wizard and specify the downloads directory.

After that, you need to choose your Usenet indexer or torrent site. Most of these torrent sites are private and require registration, but you can choose public torrent sites like RARBG and ThePirateBay.

couchpotato ubuntu 16.04 server

For Usenet indexer, I use nzbfinder.ws. Enter the API key of your nzbfinder account.

couchpotato usenet indexer

Once you fill needed details in the setup wizard, click the big orange button at the bottom. Now you can login with your username and password.

couchpotato deluge username does not exist

You can now search and add new movie to your wanted list in CouchPotato web interface. Please note that in order for Deluge to automatically download added movies, you need to go to settings and disable black hole.

couchpotato black hole

If it’s enabled, then you will need to set up a watched folder in Deluge for new .torrent files.

It’s also a good idea to go to settings > Downloaders and test connection to Deluge.

couchpotato deluge connection

If you followed the previous Deluge install tutorial, then make sure that deluge user has read and write permissions on the downloads folder. For example, if the downloads folder is ~/Downloads/. Then you can run the following command to give read and write permission to deluge user.

sudo apt install acl

sudo setfacl -R -m "u:deluge:rwx" ~/Downloads/

Warning: Your online activity can be easily tracked. Be sure to use VPN when downloading torrents. See how to connect to VPN from Linux command line.

Once everything is set up correctly, you will see movies are being downloaded in Deluge.

install couchpotato

To install CouchPotato browser extension, go to settings > Automation and click on the Install extension button.

Setting Up Reverse Proxy

To access CouchPotato web interface from a remote connection (e.g. outside your LAN) using domain name, you can set up reverse proxy with Nginx or Apache.

If you don’t have a real domain name, I recommend going to NameCheap to buy one. The price is low and they give whois privacy protection free for life.

Nginx

Install Nginx on Ubuntu.

sudo apt install nginx

Start Nginx web server.

sudo systemctl start nginx

Then create a new server block file in /etc/nginx/conf.d/ directory.

sudo nano /etc/nginx/conf.d/couchpotato.conf

Paste the following text into the file. Replace couchpotato.your-domain.com with your preferred domain name and don’t forget to create DNS A record for it.

server {
       listen 80;
       listen [::]:80;
       server_name couchpotato.your-domain.com;

       location / {
              proxy_pass http://127.0.0.1:5050;
              proxy_set_header Host $http_host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header X-Forwarded-Proto $scheme;
        }
}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx.

sudo systemctl reload nginx

Now you can access CouchPotato Web interface via couchpotato.your-domain.com.

Apache

If you use Apache web server rather than Nginx, then follow the instructions below to set up reverse proxy.

Install Apache web server.

sudo apt install apache2

To use Apache as a reverse proxy, we need to enable the proxy modules and we will also enable the rewritemodule.

sudo a2enmod proxy proxy_http rewrite

Then create a virtual host file for CouchPotato.

sudo nano /etc/apache2/sites-available/couchpotato.conf

Put the following texts into the file. Replace couchpotato.your-domain.com with your actual domain name and don’t forget to set DNS A record for it.

<VirtualHost *:80>
    ServerName couchpotato.your-domain.com

    ProxyPass / http://127.0.0.1:5050/
    ProxyPassReverse / http://127.0.0.1:5050/
</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite couchpotato.conf

Reload Apache for the changes to take effect.

sudo systemctl reload apache2

Now you can remotely access CouchPotato by entering the domain name (couchpotato.your-domain.com ) in browser address bar.

Enable HTTPS

To encrypt the HTTP traffic when you visit CouchPotato web interface from outside, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Ubuntu.

sudo apt install certbot

If you use Nginx, then you also need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d couchpotato.your-domain.com

If you use Apache, then you need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

Next, run the following command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d couchpotato.your-domain.com

Where:

  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

couchpotato https

Wrapping Up

That’s it! I hope this tutorial helped you install CouchPotato on Ubuntu 16.04 with Deluge. As always, if you found this post useful, then subscribe to our free newsletter to get new tutorials.

Rate this tutorial
[Total: 10 Average: 4.3]

One Response to “How to Install CouchPotato on Ubuntu Server/Desktop

  • Something I ran into, might help other users

    In 18.04 LTS the file to add couchpotato’s username and password isn’t /var/lib/deluge/.config/deluge/auth anymore. It’s /home/deluge/.config/deluge/auth. Hope this helps someone!

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here