Setting up Newznab

on April 30 | in Technology | by | with No Comments

So just to get everyone started here’s a simple how-to with some quick tips on building your own personal usenet indexing service.


Requirements:
  1. Usenet account (I suggest an unlimited account from astraweb as they allow compressed headers which saves time down the road)
  2. Basic linux terminal knowledge
  3. Ability to install Ubuntu / running Ubuntu

Summary:
  1. Install OS
  2. Obtain required packages
  3. Configure packages
  4. Install Newznab
  5. Configure Apache site
  6. Configure Newznab
  7. Start indexing



Install OS:

First off lets start with the server.  Although it’s possible to run this on a lamp stack in windows I highly suggest taking the time to either set up a dedicated nix box or at least a virtualbox VM running a variant of nix.  Not only is it much more resource efficient but also provides for threaded updating which shaves hours off the updating process.

My preference is Ubuntu Server as it’s both easy to setup and provides an excellent repository which allows easy installation of the required components.
The version I chose was Ubuntu Server 12.04.1 x86_64 (64 bit requirement) available from Ubuntu
The installation requires about 5 GB all said and done and the server itself should be able to run using less that 30 GB if properly configured.  A 40 GB drive should work perfectly for us. Just follow the installation through and then boot into our new Ubuntu box.
It is worth noting that Ubuntu server is a CLI (command line) interface without a GUI by default.  This helps with resource requirements but may cause issues for those unfamiliar with terminal commands.
Obtain required packages:
Once logged in we need too upgrade and install the required packages by running the following commands:

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo reboot

after the reboot:

sudo apt-get install -y ssh php5 php5-dev php-pear php5-gd php5-mysql php5-curl mysql-server-5.5 mysql-client-5.5 libmysqlclient-dev apache2 unrar ffmpeg mediainfo unzip

During this step you need to enter a mysql database password, I suggest making this very secure if you plan on having this application open to the internet. (record this for future reference)
Configure Packages:
First lets edit the php configuration file (/etc/php5/cli/php.ini)

vi /etc/php5/cli/php.ini

 First change the max execution time to 120 seconds (to search type /max_execution_time)

max_execution_time = 120

Second change the date.timezone setting to your local timezone. Also remove the semicolon from the beginning of the line to uncomment it. If you don’t know the format check out this site for some example timezone settings php timezones. (to search /date.timezone)

date.timezone = America/Chicago

 Now that the php is set we need to modify apache php config as well.  (/etc/php5/apache2/php)

vi /etc/php5/apache2/php

First change the memory limit (to search type /memory_limit)

 memory_limit =  -1

Second change the max execution time again (to search type  /max_execution_time)

max_execution_time = 120

Third set the timezone (to search type /date.timezone)

date.timezone = America/Chicago

Now we have our packages configured

Installing Newznab:
First we create our directory for the files (/var/www/newznab)

mkdir /var/www/newznab

Second download newznab (http://www.newznab.com/download.html)

cd /var/www/newznab

wget http://www.newznab.com/newznab-0.2.3.zip

Now we extract the archive (newznab-0.2.3.zip)

unzip newznab-0.2.3.zip

At this point all of our files are in place so we can properly own the files. If any of these directories do not exist then please create them using (sudo mkdir path-listed)

sudo chmod 777 /var/www/newznab/www/lib/smarty/templates_c
sudo chmod 777 /var/www/newznab/www/covers/movies
sudo chmod 777 /var/www/newznab/www/covers/anime
sudo chmod 777 /var/www/newznab/www/covers/music
sudo chmod 777 /var/www/newznab/www
sudo chmod 777 /var/www/newznab/www/install
sudo chmod 777 /var/www/newznab/nzbfiles/

Configure Apache Site:
Now that these are set up we just need to configure Apache site
First we create the Apache website configuration (/etc/apache2/sites-available/newznab)

vi /etc/apache2/sites-available/newznab

and we paste in

<VirtualHost *:80>

ServerAdmin webmaster@localhost

ServerName localhost

DocumentRoot /var/www/newznab/www

ErrorLog /var/log/apache2/error.log

LogLevel warn

</VirtualHost>

now we enable some Apache modules and restart the service

sudo a2dissite default

sudo a2ensite newznab

sudo a2enmod rewrite

sudo service apache2 restart

at this point your site is technically live!

Configure Newznab:
Let’s get the server’s ip address for reference (ifconfig)

ifconfig |grep “inet addr:”

Since we’re using Ubuntu Server the following steps must be done from a computer with a browser, as long as its on the same network it will work just the same.
Now we go to http://”server ip here”/install to complete the configuration

on box with GUI: http://localhost/install

on remote box: http://”ip address here”/install

You will be presented with a preflight checklist which should be fine. Click Next.

Now enter the MySQL info from earlier

Hostname: localhost

Username: root

Password: password we set during install

Database: newznab

Enter your usenet server information (get astraweb here)

Server:  news.astraweb.com

Port: 119 or 443

SSL: (check only if using 443)

If it doesn’t connect properly try restarting mysql

sudo service mysql restart

Now set up an admin user account for yourself

Give the path to where you would like to store the nzb’s

/var/www/newznab/nzbfiles/

Then log in!
To clean up I suggest removing the /install directory under the host so on our server lets run the following command

 rm -rf /var/www/newznab/www/install

Start Indexing:
The site has tons of options but for now lets focus on a basic few.
First, under the Admin > Site Edit let set some basics.
If you’re using astraweb, enable compression and set the max messages to some number 100k – 300k (experiment for best results)
Also make sure you apply for API keys for IMDB and Rotten Tomatoes as well as Amazon if you hope to get art working with the releases.

Now save and lets add a few groups and you’re ready for indexing (add group linux for a start)

To start the index, on the server navigate to /var/www/newznab/misc/update_scripts/ and execute

php update_binaries.php

If this is successful you will see the server respond with articles and once finished we run

php update_release.php

this will build those files into release groups.

Adjust retention and backfill after your initial population as it will take some time.

Pin It

Comments are closed.

« »

Scroll to top