Install Plex Requests on Ubuntu 14.x

plexrequests-logo Install Plex Requests on Ubuntu 14.x so your friends and family can make requests for your Plex Media Server. Plex Requests integrates with automation software like CouchPotato, Sonarr and SickRage to fulfill requests on the fly by letting the automation software to grab content automatically from usenet or torrents. This Plex Requests tutorial was tested on Ubuntu 14.x. The how-to includes a Plex Requests init.d script so Plex Requests will autostart on boot in case you ever restart your server.

Usenet Provider
Backbone
Retention
Speed
Connections
VPN
Monthly
Annual
UsenetServer
UsenetServer
3199
Unlimited
30
Yes
$10
$95.40
Newshosting
Newshosting
3199
Unlimited
30
Yes
$10
$99
Frugal
Frugal
3000
Unlimited
20
No
$4.16
$50
Usenetlink
Cloudgate
2000
100 Mbit
30
No
$15
$140

The Plex Requests web interface is quite simple and lean

plex-requests-welcome-screen

Install Plex Requests Ubuntu

Update repositories

sudo apt-get update

Install nodejs, mongodb and git

sudo apt-get install nodejs mongodb git -y

Install meteor by building from source and link it to /usr/bin/meteor so we don't have to alter PATH variables

sudo apt-get install curl build-essential -y
cd /usr/local/lib
sudo git clone https://github.com/4commerce-technologies-AG/meteor.git
cd meteor
sudo ./scripts/generate-dev-bundle.sh
sudo ln -s /usr/local/lib/meteor/meteor /usr/bin/meteor

Install Plex Requests from the git repository and make your regular sudo user the owner

sudo git clone https://github.com/lokenx/plexrequests-meteor /opt/plexrequests
sudo chown -R htpcguides:htpcguides /opt/plexrequests
cd /opt/plexrequests
sudo meteor

The Plex Requests script will download all the nodejs dependencies and install them for you

logging: updating npm dependencies -- cli-color...
xmlbuilder: updating npm dependencies -- xmlbuilder...
=> Running Meteor from a checkout -- overrides project version (Meteor 1.2.1)
[[[[[ /opt/plexrequests ]]]]]

=> Started proxy.
=> Started MongoDB.
webapp: updating npm dependencies -- connect, send, useragent...
ddp-server: updating npm dependencies -- permessage-deflate, sockjs...
mongo: updating npm dependencies -- mongodb-uri...
npm-bcrypt: updating npm dependencies -- bcrypt...
email: updating npm dependencies -- mailcomposer, simplesmtp, stream-buffers...
caching-compiler: updating npm dependencies -- lru-cache, async...
minifiers: updating npm dependencies -- uglify-js, css-parse, css-stringify...
http: updating npm dependencies -- request...
compileCoffeescript: updating npm dependencies -- coffee-script, source-map...
compileLessBatch: updating npm dependencies -- less...
npm-container: updating npm dependencies -- winston...
minifyStd: updating npm dependencies -- source-map...
=> Started your app.

=> App running at: http://localhost:3000/
W20151229-20:00:33.691(-5)? (STDERR) error: Adding default settings

You can now check to see Plex Requests is running on your Ubuntu server on http://ip.address:3000

If it is running then you can kill the process by hitting Ctrl+C or Ctrl+X in the terminal window or SSH session. This way we can set Plex Requests to autostart as a system daemon using init.d.

Autostart Plex Requests on Ubuntu

Create the Plex Requests init.d script

sudo nano /etc/init.d/plexrequests

Paste the Plex Requests init.d script

#!/bin/sh
### BEGIN INIT INFO
# Provides:          PlexRequests
# 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: PlexRequests
# Description:       PlexRequests for streamlined Plex sharing
### 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="PlexRequests"
DAEMON_USER=root
DAEMON_PATH="/usr/bin/meteor"
DAEMON_OPTS=""
DAEMON_PWD="/opt/plexrequests"
DAEMON_DESC=$(get_lsb_header_val $0 "Short-Description")
DAEMON_PID="/var/run/${DAEMON_NAME}.pid"
DAEMON_NICE=0
DAEMON_LOG='/var/log/plexrequests'
 
[ -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

Ctrl+X, Y and Enter to save the Plex Requests init.d script

Make the Plex Requests init.d executable

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

Tell system to use the Plex Requests init.d script on boot

sudo update-rc.d plexrequests defaults

Finally start the Plex Requests service and access it on its default port 3000 after the service finishes starting.

Note: it does take some time for the service to start

sudo service plexrequests start

You have now successfully installed Plex Requests on Ubuntu 14.x.