Newznab on Ubuntu 14.04.2 x64

This guide will help you install everything you need to get Newznab+ running on a fresh Ubuntu server. It will run through all the requirements for intalling: PHP, Apache2, phpmyadmin, Percona, unrar, Lame, Mediainfo, subversion, screen, tmux, Sphinxsearch, ffmpeg and of course Newznab+ itself.

It will then go on to help you get Newznab+ basically configured and background scripts running.


This assumes you know linux in general, and know how to use CLI.


This is a step-by-step guide. I am assuming that you are not tinkering with locations of installation et cetera. If you decide to install Newznab+ elsewhere or put unrar in your home directory, there will be other changes you will have to make.

Guide written by Stifler. Find me on synIRC #newznab

Version 0.1 - Initial Release

Version 0.2 - fixed typos; fixed incorrect character encoding; added install nano; fixed subversion install; added key_buffer change

Version 0.3 - sphinxsearch installation change;

Version 0.4 - removed references to tokudb

Step 1: Install Ubuntu 14.04.2

Download the iso image of Ubuntu Server 14.04.2 amd64.

On the start page (after you select your language) hit F4 and select “install a minimal system” (or if you are doing it in a VM, “Install a minimal virtual machine”) and hit Enter.

Hit Enter again to start the install.

During the install choose region, keyboard, hostname, user name, timezone, partitions, etc and go get a beverage.


When it comes to asking what software to install, select “OpenSSH server” only.

Step 2: Update Ubuntu

Login into your new server and run:

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

The Next step is optional, it will update the kernel to version 4.0.

cd /tmp/
sudo dpkg -i linux-headers-4.0.0-*.deb linux-image-4.0.0-*.deb
sudo reboot

At this point you have a basic Ubuntu x64 Linux kernel 4.0.0 with SSH. Which if you haven’t already, can start using for the rest of the process if you need to.

Step 3: Install the necessities for NN+

Install php5 and some additional modules for it. At time of writing version 5.5.9

sudo apt-get install -y php5 php5-dev php-pear php5-gd php5-mysql php5-curl

Install Percona. At time of writing version 5.6

sudo apt-key adv --keyserver --recv-keys 1C4CBDCDCD2EFD2A
    sudo gpg -a --export CD2EFD2A | sudo apt-key add -
sudo sh -c "echo \"deb trusty main \ndeb-src trusty main\" >> /etc/apt/sources.list"
sudo apt-get -y update
sudo apt-get install percona-server-server-5.6 percona-server-client-5.6


You will be asked to create a password for the DB server root user.

Install apache2

sudo apt-get install -y apache2

Install unrar

sudo apt-get install -y unrar

Install Lame

sudo apt-get install -y lame

Install MediaInfo

sudo apt-get install -y mediainfo

Install Subversion (SVN)

sudo apt-get install -y subversion

Install Screen and tmux

sudo apt-get install -y screen tmux

Install nano

sudo apt-get install -y nano

Install ffmpeg

You have two options, either follow this or better yet, do this:

Copy the script from here:

Create a new script file:

sudo nano ~/

Paste the script in and save the file. Then make it executable:

sudo chmod 777 ~/

And run it:

sudo ~/

Whichever way you choose, you will be spending a lot of time drinking the beverage of your choice waiting for ffmpeg…

Install phpmyadmin

sudo apt-get install -y phpmyadmin

Now let’s improve phpmyadmin security a bit:

sudo a2disconf phpmyadmin
sudo nano /etc/apache2/ports.conf

Add Listen 12322 directly under Listen 80. This is where we will make phpmyadmin available. Save the file. Now we will create the new site phpmyadmin:

sudo nano /etc/apache2/sites-available/phpmyadmin.conf

Add this to the new file:

<VirtualHost *:12322>
    ServerName phpmyadmin
    DocumentRoot /var/www/phpmyadmin

Save the file.

Create a symlink to phpmyadmin:

sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

Enable the site:

sudo a2ensite phpmyadmin
sudo service apache2 restart

You will now be able to access phpmyadmin at http://yourserver:12322/

Step 4: Modifying various settings to how we want.

Editing php configuration (php.ini)


There are two php.ini files, edit both of them and make the same changes to both files.

sudo nano /etc/php5/cli/php.ini


sudo nano /etc/php5/apache2/php.ini

Find these settings (under [PHP] section) and check/add/modify as necessary:

ADD: register_globals = Off
MODIFY: max_execution_time = 120
CONFIRM: memory_limit = -1

Next set date.timezone (under [Date] section)

Remove the ‘;’ from the start of the line. For example:

date.timezone = Europe/London


The timezone can be whatever, but it will need to be set the same as the database later.

Creating the NN+ Website

sudo nano /etc/apache2/sites-available/newznab.conf

Add this to the new file:

<VirtualHost *:80>
        <Directory /var/www/newznab/www/>
            Options FollowSymLinks
            AllowOverride All
            Order allow,deny
            allow from all
    DocumentRoot /var/www/newznab/www
    LogLevel warn
    ServerSignature Off

Save the file.

Now to enable the new site, disable the default site and enable modrewrite.

sudo service apache2 stop
sudo a2dissite 000-default.conf
sudo a2ensite newznab
sudo a2enmod rewrite
sudo service apache2 start

Editing Percona configuration (mysql.cnf)

sudo nano /etc/mysql/my.cnf

Find these settings (under [mysqld] section) and check/add/modify as necessary:

CONFIRM: max_allowed_packet = 16M
ADD: group_concat_max_len = 8192
ADD: default_time_zone='Europe/London'
    ADD: sql_mode = ''
MODIFY: key_buffer = 16M to key_buffer_size = 16M

Save the file.


key_buffer is deprecated, and now becomes key_buffer_size


sql_mode removing only_full_group_by which became default in mysql 5.7


BEFORE you restart mysql import the timezones from Ubuntu into Percona database.

Run the following:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql


This will ask for your database password.

Now restart the database service:

sudo service mysql restart


The timezone can be whatever, but it will need to be set the same as PHP. See the PHP section prior.

Step 5: The one you have been waiting for! Installing Newznab.

cd /var/www
sudo mkdir newznab
sudo chmod 777 newznab
sudo svn co svn:// /var/www/newznab


You will need your username and password from newznab to access the svn. When you run this command first time, it will ask you for the password of the user you are logged in with. Ignore that and just hit Enter, it will then ask for your svn username.

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/

Once you have completed all that you should now be able to login at http://yourserver/

Step 6: Make Newznab+ do what you want it to do.

Here we are going to setup some basics to get Newznab+ running. There are many more things can can and will need to be done. This is not going to cover everything, but you will be running after this.

Configuration from the home page.

Login to your server http://yourserver/

Click on "Go to step one: Pre flight check"
Confirm that the preflight checklist is all **OK**. If not, you will need to fix those problems first.
Click on "Go to step two: Set up the database"
Enter your database username ``root`` and your password. Leave the other settings as is.
Click on "Setup Database"
Click on "Step three: Setup news server connection"
Enter your details for your news server.
Click on "Test Connection"
Click on "Step four: Cache Settings"
Leave Caching Type on "None"
Click on "Save configuration file"
Click on "Step five: Setup admin user"
Enter the details you want for the administrator of Newznab+
Click on "Create Admin User"
Click on "Step Seven: Set NZB File Path"
Leave the location as ``/var/www/newznab/nzbfiles/``
Click on "Set NZB File Path"

Done! Click on the link to the admin page. Leave the browser open.

Configure Sphinx

Log into your Newznab server shell.

First generate a config for sphinxsearch.:

cd /var/www/newznab/misc/sphinx
sudo ./nnindexer.php generate

Next we need create the indexes.:

sudo ./nnindexer.php daemon
sudo ./nnindexer.php index full all
sudo ./nnindexer.php index delta all
sudo ./nnindexer.php daemon --stop
sudo ./nnindexer.php daemon

Configure Site Settings

Back in your browser at the Admin Home. Click on the “hide this welcome message” so you can see the Status Alerts. There will probably be a couple of them.


Most obvious and important is the one that is telling you that your Newznab ID is missing.

Now click on Edit Site and we will set a couple of basic items up.

Scroll to the bottom of Main Site Settings, HTML Layout, Tags and you will see newznab ID:. Paste your ID in there.

Scroll down to 3rd Party Application Paths and change the following:

Unrar Path to    : /usr/bin/unrar
Mediainfo Path to: /usr/bin/mediainfo
ffmpeg Path to   : /usr/local/bin/ffmpeg
Lame Path to     : /usr/bin/lame

Now scroll down further to Password Settings and change Check For Passworded Releases: to Deep (requires unrar)

Now scroll further to Sphinx Settings and change Use Sphinx to Yes. Then change Index ReleaseFiles to Yes.

Now scroll all the way to the bottom and hit Save Site Settings.

Configure Groups

Under the Admin Functions click on View in View Add BulkAdd Groups. Click on Activate for a couple of the groups you want to index.

You will probably want to add more groups later and you can do that by clicking on Add or BulkAdd under Admin Functions, View Add BulkAdd Groups.

Step 7: Running the scripts.

To run the scripts we need to do it in either screen or tmux. The choice is yours, if you dont know either then I suggest screen first for its simplicity. I’ll use screen for this guide.

Go back to your shell login and change to ‘’nix_scripts’’ directory. We will create our own script based on the default and modify it:

cd /var/www/newznab/misc/update_scripts/nix_scripts
sudo cp
sudo chmod 744
sudo nano

Now modify the export NEWZNAB_PATH to:

export NEWZNAB_PATH="/var/www/newznab/misc/update_scripts"

Save the file and start screen.:

screen -S newznab

Run the script.:

sudo ./

You should now see the script start to run. To exit the screen and leave the script running press [CTRL]-[a] and then [d].

At anytime you wish to go back into the screen to see what is happening run:

screen -r newznab