Friday, 18 April 2014

Your very own cloud server

If you've followed the instructions I've written for setting up your own newsgroup indexer, then setting up a cloud server is really very simple.

Get a terminal opened up on the server and su to root, and then type in the following:

mkdir /var/www/cloud
mkdir /var/www/cloud/www
chmod -R -v 0777 /var/www/cloud

Then we need to create the config file:

nano /etc/apache2/sites-available/cloud

Paste the following into the empty file:

<VirtualHost *:8081>
ServerAdmin webmaster@localhost
ServerName localhost

DocumentRoot /var/www/cloud/www
ErrorLog /var/log/apache2/error.log
LogLevel warn

You don't have to use port 8081 but I've decided to for no particular reason.

Save the file and then we need to get the server to listen to the relevant port by editing the ports.conf file with:

nano /etc/apache2/ports.conf

Add a line with:

Listen 8081

Save the file and then run the following:

a2ensite cloud
a2enmod rewrite
service apache2 restart

Then we need to change to the folder for the cloud server with:

cd /var/www/cloud/www

And then run:


Nowe we can configure the server by running


Just follow the instructions, it's really that easy,

My Debian Server, the beginning

I'm going to rebuild my home server using Debian, this is a rolling release and never needs to be re-installed unless you completely break it. I've decided to use the XFCE desktop too as I may want to use it occasionally and it's also lightweight and I can use it with a VNC connection.

I'm going to run samba and nfs sharing  on it along with an ssh an vnc server, then it will also run Newznab, SabNZB, Sickbeard and OwnCloud.

It will have 3 x 3TB external USB drives connected, one for data, one for a backup of data and one to synchronise data from another server so I can be a remote backup. I will also be backing up my data to a remote server just in case things really go wrong.

Let's just start with the basics and get the OS installed

It's not a hard install process and I'm not going to document it that much, but I will document the changes I make to it. I'm not going for seperate partitions for my data as this will all be stored on the external drives.

On the software selection screen I'm going to pick Debian Desktop Environment, File Server, SSH Server and Standard System Utilities. Anything else can be installed later and I will need SQL and Apache amongst other things.

Once the install is completed, all other configuration will be done by ssh or a web browser, you need to be logged on as root to do this.

You need to edit the sources.list file to get some codecs and utilities installed as follows:

nano /etc/apt/sources.list

Add contrb non-free to the end of the lines as shown below.

deb wheezy main contrib non-free
deb-src wheezy main

deb wheezy/updates main contrib non-free
deb-src wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb wheezy-updates main contrib non-free
deb-src wheezy-updates main

Then do an apt-get update followed by apt-get upgrade, then install the following, mc or Midnight Commander is a marvelous utility for navigating the file system from a terminal session. Tight VNC Server is going on to make it easy to control the server remotely and we will also be installing webmin which is another really useful tool.

apt-get install nfs-common
apt-get install nfs-server
apt-get install mc
apt-get install rsync
apt-get install tightvncserver

and now for webmin:

apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
cd /tmp
dpkg -i webmin_1.580_all.deb

You should then be able to access webmin from a browser from the url https://servername:10000

Thursday, 17 April 2014

Ubuntu 14.04 LTS

I used to hate Ubunt but I have now got quite used to the Unity desktop and it's way of working, I still love PCLinuxOS for it's rock solid stability and will use it on one of my servers. Now in a short while the latest Long Term Release of Ubuntu will be with us 14.04, it's called Trusty Tahr or some silly name, I've been using the beta for a while and it seems quite stable to be honest. Let's see how it fares once it's released.

Wednesday, 16 April 2014

Newznab Server on Debian

I've put this together with help from a few other websites, it's pretty much the same as an Ubuntu install but with a few slight differences.

All the following stuff is done via ssh terminal and you can copy and paste the commands in to make life easier.

If you are doing this on a fresh install of Debian, you need to edit the sources.list file with:

nano /etc/apt/sources.list

Add contrb non-free to the end of the lines as shown below.

deb wheezy main contrib non-free
deb-src wheezy main

deb wheezy/updates main contrib non-free
deb-src wheezy/updates main

# wheezy-updates, previously known as 'volatile'
deb wheezy-updates main contrib non-free
deb-src wheezy-updates main

Add this entry to the bottom of the list:

deb jessie main non-free

Save it and then run:

apt-get update
apt-get install deb-multimedia-keyring
apt-get update
apt-get upgrade

Now let's get on with the rest.

mkdir /var/www
mkdir /var/www/newznab
chmod 0777 /var/www/newznab

Next we need to install php with the following:

apt-get install php5 php5-dev php-pear php5-gd php5-mysql php5-curl mc subversion

Now we make some changes to the php configuration file:

nano /etc/php5/cli/php.ini

Under the resource limits section we need to change the maximum execution time to 120:

max_execution_time = 120

Then under Module Settings we need to change the time zone settings, in my case I'm the UK so I'm going to change it to:

date,timezone = Europe/London

There are other options depending on where you live, you can find these here.

Now it's time to install SQL and Apache, so we enter the following command:

apt-get install mysql-server-5.5 mysql-client-5.5 libmysqlclient-dev apache2

During the install process, you will be asked to create a password for the database, if you are going to make this publicly available, you need to make it a good password.

Let's finish off the SQL installation with the following:

Once this has all finished, we then need to make some changes to the Apache config file:

nano /etc/php5/apache2/php.ini

We then need to change these settings

  • memory_limit =  -1
  • max_execution_time = 120 
  • date.timezone =  Europe/London
Now we need to create a configuration file for Newznab, so type the following to create an empty file:

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

And then paste the following into the file, you can use another port instead of 8080 if you want:

<VirtualHost *:8080>
ServerAdmin webmaster@localhost
ServerName localhost

DocumentRoot /var/www/newznab/www
ErrorLog /var/log/apache2/error.log
LogLevel warn

This will run Newznab on port 8080, I want to keep the default port 80 for other things.

We now need to get hold of Newznab itself, you can get it from here. Newznab classic works but there are some limitations, if you are serious just pay the money for a better product and you get free upgrades too.

Get the file downloaded and then we need to extract it and copy it to the right place, if you have decided to use a graphical desktop you can follow these pictures.

As I have a paid for version I'm going to use a slightly different approach, we installed subversion earlier do we get NewNab with.

svn co svn:// /var/www/newznab

At this point you will be asked for the root password for your system and the SVM login details that have been emailed to you by the Newznab team.

We now need to edit an Apache file to it listens to port 8080 for requests, enter the following command:

nano /etc/apache2/ports.conf

Under the line that says Listen 80 we add another line that says:

Listen 8080

Save that file and then one more change to the Apache configuration files before we go on:

nano /etc/apache2/apache2.conf

Find this bit

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

And change it to this:

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

Now let's get it all working.

a2ensite newznab
a2enmod rewrite
service apache2 restart

Now it's time to change some permissions with the following commands:

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

We just need to make sure that some files are also installed:

apt-get update
apt-get install unrar mediainfo ffmpeg lame

When you run the Newznab config and go in to edit the site you will need to put the paths in for these files, they normally are:


And now point your browser to 


And just follow the instructions and prompts to configure your very own Newznab server.

Once you have finished the comfiguration, run this following command to change permissions on one of the folders.

chmod 777 /var/www/newznab/nzbfiles/tmpunrar

Once that's all completed, go to the View Groups option and make some groups active.
Then it's back to the command line with

cd  /var/www/newznab/misc/update_scripts

Then run 

php update_binaries_threaded.php

after that it's

php update_releases.php 

That should start populating the indexer, it's up to you how you want to run this, you can it manually but I run a loop with a 10 minute pause each time it restarts.

I've made a file with 

nano /bin/newznabrun

Put this into it

while :

# Beginning Update
cd /var/www/newznab/misc/update_scripts/
php update_binaries_threaded.php
php update_releases.php

        echo "Press [CTRL+C] to stop.."
        sleep 360


Save the file and then run

chmod +x /bin/newznabrun 

You can then type newznabrun to get it going.

That's it all done, hope it all works for you.

I would like to thank the howtogeek website for helping with most of these instructions.