Skip to content

Instantly share code, notes, and snippets.

@mptrs
Created December 6, 2012 08:45
Show Gist options
  • Save mptrs/4222886 to your computer and use it in GitHub Desktop.
Save mptrs/4222886 to your computer and use it in GitHub Desktop.
Install spotweb on Synology
# HowTo install Spotweb on Synology
# (source: http://dl.dropbox.com/u/5653370/syn_howto/HowTo%20-%20install%20Spotweb.txt)
#################################
#
# Spotweb: https://github.com/spotweb/spotweb
# Spotweb is a webbased usenet binary resource indexer based
# on the protocol and development done by Spotnet
# (http://github.com/spotnet).
#
# Thanks to:
# Mar2zz - http://mar2zz.tweakblogs.net/blog/6724/spotweb-als-provider.html
# hpower - http://pchulpforum.info/showthread.php?tid=37
# Nakebod,
# Nightspirit - http://gathering.tweakers.net/forum/list_messages/1448575#spotweb_downloaden
# SpotWeb - https://github.com/spotweb/spotweb/wiki
# https://github.com/spotweb/spotweb/wiki/Spotweb-installeren-op-Ubuntu
#
# Author: J. van Emden (Brickman)
# Latest version: http://synology.brickman.nl
#
# Version:
# 2012-05-06:
# - DB settings moved to dbsettings.inc.php
# - Usage of ownsettings.php has become obsolete
# - Installer is used
#
# 2012-04-15:
# - Forgot the install nano
# - Some cosmetic change of the HowTo
#
# 2012-01-04:
# - Extra comments by retrieval of spots
#
# 2011-12-01:
# - Direct url to "Settings" page added
#
# 2011-11-30:
# - PEAR removed from the HowTo as it is not needed anymore
# - PHP Extension modules rechecked and changed to the correct ones
# - Changed the .htaccess file on dropbox
# - Added a description how a usenet server can be added
# - Changed the names of some apache configuration files,
# as the couldn't be downloaded from dropbox
#
# 2011-11-28:
# - Spotweb moved some settings from ownsettings.php to the database
#
# 2011-11-26:
# - New script added that does the logging of the updating
#
# 2011-11-21:
# - Forgot to create the '/volume1/@appstore/apache_conf' directory
# - Added some extra comments
#
# 2011-10-23:
# - Created a directory for script storage
# - Changed the paths in the crontab
#
# 2011-10-10:
# - Removed "pear install --alldeps Net_NNTP" after include_path
#
# 2011-07-01:
# - Added 'mcrypt' to PHP extensions list (required for phpMyAdmin)
# - Pear config contains now the correct php config file
#
# 2011-06-25:
# - Initial release
#
#################################
##############################################################
##############################################################
## ##
## This installation requires a bootstrapped Synology, ##
## more info can be found on: ##
## http://bit.ly/l2Hx5a ##
## ##
##############################################################
##############################################################
# Connect to your Synology DiskStation using SSH, and login
# as root (password is the same as admin!)
# If you have not installed Sick Beard or CouchPotato,
# install git on your system
ipkg install git
# Install nano editor (text editor which is easier in use than vi)
ipkg install nano
# Go to your DSM:
# Control Panel -> Web Services -> Web Applications ->
# Check "Enable Web Station" and "Enable MySQL"
# Control Panel -> Web Services -> PHP Settings:
# Under "Select PHP extension": Make sure that
# the following items are checked: gd, mysql, openssl, zip, zlib
# Press the Ok button
##################################################
## Retreive an clone of Spotweb ##
##################################################
# Go to the website directory
cd /volume1/web
git clone git://github.com/spotweb/spotweb.git /volume1/web/spotweb
# Enter the spotweb directory
cd spotweb
##################################################
## MySQL configuration ##
##################################################
# If you did not change the root password this can be done with the following:
/usr/syno/mysql/bin/mysqladmin -u root password NEWPASSWORD
# Start the mysql CLI application (login with the created password)
/usr/syno/mysql/bin/mysql -p
# Connected to mysql (when connected one sees: mysql>)
# Create the spotweb database
CREATE DATABASE spotweb;
# Create a localuser called spotweb (replace password by a new password)
CREATE USER 'spotweb'@'localhost' IDENTIFIED BY 'password';
# Grant the spotweb user access to the spotweb database
# (replace password by the new password)
GRANT ALL PRIVILEGES ON spotweb.* TO spotweb @'localhost' IDENTIFIED BY 'password';
# Exit mysql interface
quit
##################################################
## Configure your Spotweb installation ##
##################################################
# Go to http://<nas_ip>/spotweb/install.php
# and check if everything is OK.
# If continue to setup Spotweb at the bottom
# On this page enter the password created in the previous step
# for the database connection. Afterwards press the verify button.
# The upcomming page ask for the usenet server details. If your provider
# is not listed use the custom entry, now it is possible to enter the address
# of your usenet provider.
# Finally you can select your usage style, "single-user" or "shared" are the best option.
# They require login before the spotweb information can be accessed.
# Arrived at the final page, you can copy the settings for the dbsettings.inc.php file
# and return to your SSH session.
# Create a new directory for the DB settings file
mkdir -p /volume1/web/.spotweb
# Paste the DB settings in the dbsettings.inc.php file
nano /volume1/web/.spotweb/dbsettings.inc.php
# Create a link to correct location (handy for reinstallation)
ln -s ../.spotweb/dbsettings.inc.php dbsettings.inc.php
# Your Spotweb is now ready to use!
##################################################
## Create the spotweb database ##
##################################################
# Settings conserning the retrieval of full spots can be changed under "Retrieve"
# Retrieve full spots will be slower and consume more storage
# With the usenet server set, you can retrieve the spots (takes a very long time, Coffee?
# and continue the rest of the HowTo ;))
/usr/bin/php retrieve.php
# While you are retrieving the spots, one can start a duplicate session
# to do the final configurations in apache
##################################################
## Apache configuration ##
##################################################
# To enable the Newznab function of Spotweb one has the following options:
# 1) Modifiy the httpd.conf file (is modified after a firmware update!)
# 2) Use a .htaccess file (is a bit slower)
##############
## Option 1 ##
##############
# 1) Edit the apache config
nano /usr/syno/apache/conf/httpd.conf-user
# 1) Add the following lines after the following entry: <Directory "/var/services/web"> ...... </Directory>
# Include external config
Include /volume1/@appstore/.apache_conf/apache.conf
# 1) Create a directory to store the configuration files (saves you some work after an upgrade of DSM)
mkdir /volume1/@appstore/.apache_conf
# 1) Retrieve configuration file
wget -O /volume1/@appstore/.apache_conf/apache.conf http://dl.dropbox.com/u/5653370/syn_files/apache_conf/apache.conf
# 1) Retrieve spotweb configuration file
wget -O /volume1/@appstore/.apache_conf/spotweb.conf http://dl.dropbox.com/u/5653370/syn_files/apache_conf/spotweb.conf
# 1) Restart apache
/usr/syno/etc.defaults/rc.d/S97apache-user.sh restart
##############
## Option 2 ##
##############
# 2) Download the .htaccess file
wget -O /volume1/web/spotweb/.htaccess http://dl.dropbox.com/u/5653370/syn_files/spotweb/htaccess.txt
# Check is the change is working, go to http://<nas_ip>/spotweb/api?t=c
# The result should look like http://dl.dropbox.com/u/5653370/spotweb/api.xml
# Add spotweb to the search providers of CouchPotato, Sick Beard, Headphones etc as Newznab provider
##################################################
## Download scripts ##
##################################################
# Create a script dir
mkdir /volume1/@appstore/scripts
# Download the update file for spotweb
wget -O /volume1/@appstore/scripts/spotweb_upd.sh http://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_upd.sh && chmod a+x /volume1/@appstore/scripts/spotweb_upd.sh
wget -O /volume1/@appstore/scripts/spotweb_retr.sh http://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_retr.sh && chmod a+x /volume1/@appstore/scripts/spotweb_retr.sh
wget -O /volume1/@appstore/scripts/spotweb_cron_upd.sh http://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_cron_upd.sh && chmod a+x /volume1/@appstore/scripts/spotweb_cron_upd.sh
wget -O /volume1/@appstore/scripts/spotweb_cron_retr.sh http://dl.dropbox.com/u/5653370/syn_files/spotweb/spotweb_cron_retr.sh && chmod a+x /volume1/@appstore/scripts/spotweb_cron_retr.sh
##################################################
## Cronjob configuration ##
##################################################
# Update spotweb every six hour
# add the following line to the file /etc/crontab (open the file with nano /etc/crontab or your favorite editor and make shure that there is one TAB after each item)
#minute hour mday month wday who command
15 */6 * * * root /bin/sh /volume1/@appstore/scripts/spotweb_cron_upd.sh > /dev/null
# To retrieve new spots every two hours
# add the following line to the file /etc/crontab (open the file with nano /etc/crontab or your favorite editor and make shure that there is one TAB after each item)
#minute hour mday month wday who command
0 */2 * * * root /bin/sh /volume1/@appstore/scripts/spotweb_cron_retr.sh > /dev/null
# When the retrieve is finished, restart the cron deamon
/usr/syno/etc/rc.d/S04crond.sh stop && /usr/syno/etc/rc.d/S04crond.sh start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment