Install BitCannon on Ubuntu 14.x

bitcannon logoBitCannon enables you to create a personal archive of .torrent files from KAT and other providers. You can search in its database, download torrent files as if you were browsing the torrent site but instead it is right on your own machine. The idea is that even if torrent sites continue to be taken down, it will be easy for users to continue using the torrent database even if the host site is down. BitCannon comes in 32 and 64 bit versions and can autoupdate its database with an hourly torrent database dump. This guide is for Ubuntu 14.x, an Ubuntu 15.x guide with systemd script will follow. Do torrent safely with a VPN service like Private Internet Access or PureVPN.

VPN Service
All Platforms
Number of Connections
Monthly Cost
Annual Cost
Private Internet Access
Yes
5
$6.95
$39.95
($3.33 / month)
Pure VPN
Yes
5
$6.95
$59.95
($4.16 / month)
IPVanish
Yes
5
$10.00
$77.00
($6.41 / month)

Install Bitcannon on Ubuntu 14.x

Installing BitCannon on Ubuntu 14.x requires MongoDB for storing the database of .torrent files and a precompiled version of BitCannon for Linux.

Install Mongo Database

On Ubuntu it is very easy to install MongoDB

sudo apt-get install mongodb -y

Install BitCannon

Download BitCannon, the latest release from Stephen304’s page

You will be taken to a Mega page, click the BC_Linux version e.g. BC_Linux_v0.1.1.zip.

Click Standard Download – you may have to choose Download as ZIP in Chrome

bitcannon megaupload linux

Transfer the zip file to any folder on your Ubuntu device – your home folder is a good idea – using SFTP with a client like WinSCP

Back in SSH or local terminal session navigate to where the zip file is stored and install unzip

sudo apt-get install unzip -y

Unzip the Bitcannon package

unzip BC_Linux*

Move it to an appropriate install directory

sudo mv bitcannon /opt/bitcannon

Change the ownership of the directory so it doesn’t run as root, adjust user to your Ubuntu username

sudo chown -R user:user /opt/bitcannon

Open the BitCannon configuration file

nano /opt/bitcannon/config.json

If you have an API key for KAT you can insert your API key in place of $USERHASH

{
  "mongo": "127.0.0.1",
  "bitcannonPort": "1337",
  "scrapeEnabled": true,
  "scrapeDelay": 0,
  "trackers": [
    "udp://open.demonii.com:1337",
    "udp://tracker.istole.it:80",
    "udp://tracker.openbittorrent.com:80",
    "udp://tracker.publicbt.com:80",
    "udp://tracker.coppersurfer.tk:6969",
    "udp://tracker.leechers-paradise.org:6969",
    "udp://exodus.desync.com:6969"
  ],
  "archives": [{
    "name": "KickAssTorrents",
    "url": "https://kat.cr/api/get_dump/hourly/?userhash=$USERHASH&verified=1",
    "frequency": 3600
  }, {
    "name": "Demonoid",
    "url": "http://www.demonoid.pw/api/demonoid24h.txt.gz",
    "frequency": 86400
  }, {
    "name": "BitSnoop",
    "url": "http://bitsnoop.com/api/latest_tz.php?t=all"
  }]
}

Ctrl+X. Y and Enter to save the BitCannon config.json file

Enter the BitCannon folder

cd /opt/bitcannon

Test execution of BitCannon, for 32-bit

./bitcannon_linux_386

For 64-bit users (use the 32-bit if the 64-bit version fails)

./bitcannon_linux_amd64

Now open up a browser and point it to http://ip.address:1337 or http://localhost:1337 if you’re on the same machine to which you just installed BitCannon.

You should see this interface and can browse the last hour’s torrents from the torrent providers. You can now Browse and search your own personal KickAssTorrents backup.

bitcannon install main interface

If you want to import the whole KickAssTorrents database download you will need a KAT API key and then download it into your /opt/bitcannon folder. The below command should work – replace $USERHASH with API key – but I was unable to test it because my API key has not been approved yet.

wget https://kat.cr/api/get_dump/daily/?userhash=$USERHASH&verified=1 -O dailydump.txt.gz

Then execute bitcannon and point to the daily dump to import it

./bitcannon_linux_386 dailydump.txt.gz

Autostart BitCannon init.d Script

You will want to terminate the BitCannon process using Ctrl+C or Ctrl+Z in the Terminal session

Create the BitCannon init.d script

sudo nano /etc/init.d/bitcannon

Paste the BitCannon init.d script changing user to your Ubuntu username and bitcannon_linux_386 to amd64 if it worked for you in the above test

#!/bin/sh
### BEGIN INIT INFO
# Provides:          BitCannon
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: BitCannon
# Description:       BitCannon provides personal torrent archive
### END INIT INFO


# Documentation available at
# http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptfunc.html
# Debian provides some extra functions though
. /lib/lsb/init-functions

DAEMON_NAME="BitCannon"
DAEMON_USER="user"
DAEMON_PATH="/opt/bitcannon/bitcannon_linux_386"
DAEMON_PWD="${PWD}"
DAEMON_DESC=$(get_lsb_header_val $0 "Short-Description")
DAEMON_PID="/var/run/${DAEMON_NAME}.pid"
DAEMON_NICE=0
DAEMON_LOG='/var/log/bitcannon'

[ -r "/etc/default/${DAEMON_NAME}" ] && . "/etc/default/${DAEMON_NAME}"

do_start() {
  local result

        pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
        if [ $? -eq 0 ]; then
                log_warning_msg "${DAEMON_NAME} is already started"
                result=0
        else
                log_daemon_msg "Starting ${DAEMON_DESC}" "${DAEMON_NAME}"
                touch "${DAEMON_LOG}"
                chown $DAEMON_USER "${DAEMON_LOG}"
                chmod u+rw "${DAEMON_LOG}"
                if [ -z "${DAEMON_USER}" ]; then
                        start-stop-daemon --start --quiet --oknodo --background \
                                --nicelevel $DAEMON_NICE \
                                --chdir "${DAEMON_PWD}" \
                                --pidfile "${DAEMON_PID}" --make-pidfile \
                                --exec "${DAEMON_PATH}"
                        result=$?
                else
                        start-stop-daemon --start --quiet --oknodo --background \
                                --nicelevel $DAEMON_NICE \
                                --chdir "${DAEMON_PWD}" \
                                --pidfile "${DAEMON_PID}" --make-pidfile \
                                --chuid "${DAEMON_USER}" \
                                --exec "${DAEMON_PATH}"
                        result=$?
                fi
                log_end_msg $result
        fi
        return $result
}

do_stop() {
        local result

        pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
        if [ $? -ne 0 ]; then
                log_warning_msg "${DAEMON_NAME} is not started"
                result=0
        else
                log_daemon_msg "Stopping ${DAEMON_DESC}" "${DAEMON_NAME}"
                killproc -p "${DAEMON_PID}" "${DAEMON_PATH}"
                result=$?
                log_end_msg $result
                rm "${DAEMON_PID}"
        fi
        return $result
}

do_restart() {
        local result
        do_stop
        result=$?
        if [ $result = 0 ]; then
                do_start
                result=$?
        fi
}

do_status() {
        local result
        status_of_proc -p "${DAEMON_PID}" "${DAEMON_PATH}" "${DAEMON_NAME}"
        result=$?
        return $result
}

do_usage() {
        echo $"Usage: $0 {start | stop | restart | status}"
        exit 1
}

case "$1" in
start)   do_start;   exit $? ;;
stop)    do_stop;    exit $? ;;
restart) do_restart; exit $? ;;
status)  do_status;  exit $? ;;
*)       do_usage;   exit  1 ;;
esac

Make the BitCannon init.d script executable

sudo chmod +x /etc/init.d/bitcannon

Enable the BitCannon init.d scripts

sudo update-rc.d bitcannon defaults

Start the BitCannon service

sudo service bitcannon start