Install NZBMegaSearch Raspberry Pi

raspberry_pi_nzbmegasearchNZBMegaSearch is the only search provider you will need. It combines all of your usenet indexers into one search engine. NZBMegaSearch has NZBGet and Sabnzbd integration so you can send your desired release straight to your downloader. You can also use it for services like sonarr (NzbDrone), SickRage, CouchPotato, Mylar and Headphones so that the service will only need to use NZBMegaSearch to look for your content, it won’t have to search each individually. You will host this awesome search aggregator service on your home media server which means it will always be on and available. If you do open it up to outside networks, do password protect it and use https for security.

If you are on Raspbian or Minibian Jessie follow the Ubuntu 15.x guide

If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.

Usenet Provider
Backbone
Retention
Speed
Connections
VPN
Monthly
Annual
UsenetServer
UsenetServer
2265
Unlimited
20
Yes
$10
$95.40
Usenetlink
Cloudgate
2000
100 Mbit
30
No
$15
$140
Astraweb
Astraweb
2264
Unlimited
20
No
$7.50
$96.00
UsenetBucket
XS News
1100
40 Mbit
25
No
€4.95
€60.00
Frugal
Blocknews
600
Unlimited
60
No
$4.99
$50.00

Install NZBMegasearch Raspberry Pi

Install NZBMegasearch dependencies

sudo apt-get install python2.7 git python-openssl -y

Git clone the latest nzbmegasearch

sudo git clone https://github.com/Mirabis/usntssearch /opt/nzbmegasearch

Change the owner to pi

sudo chown -R pi:pi /opt/nzbmegasearch

Try and execute the nzbmegasearch python script

python /opt/nzbmegasearch/NZBmegasearch/mega2.py daemon

Open a browser on a device on your network and point to the Raspberry Pi’s local IP address at http://ip.address:5000

Hit Ctrl+C or Ctrl+Z to get out of the daemon if it is still occupying terminal.

Autostart NZBMegaSearch on Raspberry Pi

You should choose either the init.d script or the upstart script. The init.d script is preferable.

NZBMegaSearch init.d Script

Create the NZBMegaSearch init.d script

sudo nano /etc/init.d/nzbmegasearch

Paste the Raspberry Pi NZBMegaSearch init.d script

#!/bin/sh
### BEGIN INIT INFO
# Provides:          NZBMegaSearch
# 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: NZBMegaSearch
# Description:       NZBMegaSearch provides unified usenet searching
### 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="NZBMegaSearch"
DAEMON_USER="pi"
DAEMON_PATH="/usr/bin/python"
DAEMON_OPTS="/opt/nzbmegasearch/NZBmegasearch/mega2.py daemon"
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/nzbmegasearch'

[ -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}" -- $DAEMON_OPTS
			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}" -- $DAEMON_OPTS
			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
	return $result
}

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 NZBMegaSearch init.d script executable

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

Enable the NZBMegaSearch init.d script to start at boot

sudo update-rc.d nzbmegasearch defaults

Finally start the NZBMegaSearch service

sudo service nzbmegasearch start

If you find NZBMegaSearch doesn’t start on boot you can use this workaround which starts the script after your networking devices are enabled. Be warned if you make an error here it can prevent the Pi from booting and you will need a screen and keyboard or Linux machine (virtual guide) to undo it.

sudo nano /etc/network/interfaces

Add this line at the bottom

post-up /etc/init.d/nzbmegasearch start

Ctrl+X, Y and Enter to save

NZBMegaSearch Upstart Script

If you are using the init.d script then do not install upstart, skip down to the bottom

Install upstart

sudo apt-get install upstart

Enter Yes, do as I say!

sudo nano /etc/init/nzbmegasearch.conf

Paste this NZBMegaSearch upstart script

Raspbmc Note: if you are running Raspbmc remove the setuid and setgid lines

#author "HTPCGuides.com"
#description "Upstart Script to run NZBMegasearch as a service on Ubuntu/Debian

#Set username for the process. Should probably be what you use for logging in
setuid pi
setgid pi

start on runlevel [2345]
stop on runlevel [016]

respawn

exec python /opt/nzbmegasearch/NZBmegasearch/mega2.py

Try and start the NZBmegasearch service

sudo start nzbmegasearch

or

sudo service nzbmegasearch start

Should see something like

nzbmegasearch start/running, process 1374

You may see one of these errors

start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

start: unrecognized service

Just reboot and NZBmegasearch should start. It may take a minute or two for the interface to be accessible because the Raspberry Pi is slow

sudo reboot

Open a browser and point to http://ip.address:5000 to configure NZBmegasearch