Monday, 23 November 2015

Sickrage & Couchpotato

I've split these instructions into their own section just to make it easier to understand. We're going to go through the installation of Sickrage and Couchpotato on Ubuntu 14.04 using command line only to reduce the resources needed on the machine.

Let's get started with the installation of  Sickrage:


sudo apt-get install git-core python python-cheetah
cd ~


sudo git clone https://github.com/SickRage/SickRage.git /opt/sickrage
sudo cp /opt/sickrage/runscripts/init.ubuntu /etc/init.d/sickrage
sudo chmod +x /etc/init.d/sickrage

sudo chown username:username -R /opt/sickrage




Time to edit a config file:

sudo nano /etc/default/sickrage

Now paste this lot in changing user to the name of the user you are installing it to



# COPY THIS FILE TO /etc/default/sickrage
SR_HOME=/opt/sickrage
SR_DATA=/opt/sickrage/
SR_USER=username

Set some permission

sudo chmod +x /etc/default/sickrage

Now time to get it running on boot

sudo update-rc.d sickrage defaults

And you can start it with the following command and then connect to http://machine:8081 to finish off setting it up.

sudo chmod 0777 /var/run/sickrage

sudo service sickrage start


And now it's time for Couchpotato:

sudo git clone https://github.com/RuudBurger/CouchPotatoServer.git /opt/CouchPotato

Set the owner of the file, replacing username with your username

sudo chown -R username:username /opt/CouchPotato

Edit a config file

sudo nano /etc/default/couchpotato

Then paste this lot in replacing username again

CP_HOME=/opt/CouchPotato
CP_USER=username
CP_PIDFILE=/home/username/.couchpotato.pid
CP_DATA=/opt/CouchPotato

Now we set permissions and get it to run on startup

sudo cp /opt/CouchPotato/init/ubuntu /etc/init.d/couchpotato
sudo chmod +x /etc/init.d/couchpotato
cd /etc/init.d/
sudo update-rc.d couchpotato defaults

And finally start it with sudo service couchpotato start

Now connect to it with a browser at http://machinename:5050 to finish the setup.






Thursday, 12 November 2015

SabNZB setup on Ubuntu

To be honest, this is really very easy. we start by opening a terminal onto the machine we are going to install the package onto and type:

sudo apt-get install sabnzbdplus


Now we edit one of the config files:

sudo nano /etc/default/sabnzbdplus


USER=root
# The Host one can be 0.0.0.0 if you only have one IP address
HOST=0.0.0.0
# Change this to another port if 8080 is already in use.
PORT=8082


Then we make it executable:

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


Then we restart the service

sudo service sabnzbdplus restart

Once this has finished point your browser to http://ipaddress:8082 and finish setting it up, you will need a usenet provider, I use newsdemon myself.

Deluge Torrent Client on Ubuntu

In my efforts to simplify my instructions, I've decided to rewrite my instructions for the installation of the Deluge client on Ubuntu.

It is quite straightforward and all this tasks are carried out via an ssh connection.

So let's get started with:

sudo apt-get update
sudo apt-get install deluge-console deluged deluge-web

Now we make deluge run on startup, create a file with:

sudo nano /etc/default/deluge-daemon

And then enter this text:


####################
# Configuration for /etc/init.d/deluge-daemon

# The init.d script will only run if this variable non-empty.
DELUGED_USER="username"             # !!!CHANGE THIS!!!!

# Should we run at startup?
RUN_AT_STARTUP="YES"
#####################

Save the file and then it's time to create another one with:

sudo nano /etc/init.d/deluge-daemon

Paste the following text into the file


####################################################

#!/bin/sh
### BEGIN INIT INFO
# Provides:          deluge-daemon
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Should-Start:      $network
# Should-Stop:       $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Daemonized version of deluge and webui.
# Description:       Starts the deluge daemon with the user specified in
#                    /etc/default/deluge-daemon.
### END INIT INFO

# Author: Adolfo R. Brandes 
# Updated by: Jean-Philippe "Orax" Roemer

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Deluge Daemon"
NAME1="deluged"
NAME2="deluge"
DAEMON1=/usr/bin/deluged
DAEMON1_ARGS="-d"             # Consult `man deluged` for more options
DAEMON2=/usr/bin/deluge-web
DAEMON2_ARGS=""               # Consult `man deluge-web` for more options
PIDFILE1=/var/run/$NAME1.pid
PIDFILE2=/var/run/$NAME2.pid
UMASK=022                     # Change this to 0 if running deluged as its own user
PKGNAME=deluge-daemon
SCRIPTNAME=/etc/init.d/$PKGNAME

# Exit if the package is not installed
[ -x "$DAEMON1" -a -x "$DAEMON2" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$PKGNAME ] && . /etc/default/$PKGNAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

if [ -z "$RUN_AT_STARTUP" -o "$RUN_AT_STARTUP" != "YES" ]
then
   log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it."
   exit 0
fi

if [ -z "$DELUGED_USER" ]
then
    log_warning_msg "Not starting $PKGNAME, DELUGED_USER not set in /etc/default/$PKGNAME."
    exit 0
fi

#
# Function to verify if a pid is alive
#
is_alive()
{
   pid=`cat $1` > /dev/null 2>&1
   kill -0 $pid > /dev/null 2>&1
   return $?
}

#
# Function that starts the daemon/service
#
do_start()
{
   # Return
   #   0 if daemon has been started
   #   1 if daemon was already running
   #   2 if daemon could not be started

   is_alive $PIDFILE1
   RETVAL1="$?"

   if [ $RETVAL1 != 0 ]; then
       rm -f $PIDFILE1
       start-stop-daemon --start --background --quiet --pidfile $PIDFILE1 --make-pidfile \
       --exec $DAEMON1 --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON1_ARGS
       RETVAL1="$?"
   else
       is_alive $PIDFILE2
       RETVAL2="$?"
       [ "$RETVAL2" = "0" -a "$RETVAL1" = "0" ] && return 1
   fi

   is_alive $PIDFILE2
   RETVAL2="$?"

   if [ $RETVAL2 != 0 ]; then
        sleep 2
        rm -f $PIDFILE2
        start-stop-daemon --start --background --quiet --pidfile $PIDFILE2 --make-pidfile \
        --exec $DAEMON2 --chuid $DELUGED_USER --user $DELUGED_USER --umask $UMASK -- $DAEMON2_ARGS
        RETVAL2="$?"
   fi
   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
   # Return
   #   0 if daemon has been stopped
   #   1 if daemon was already stopped
   #   2 if daemon could not be stopped
   #   other if a failure occurred

   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE2
   RETVAL2="$?"
   start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $DELUGED_USER --pidfile $PIDFILE1
   RETVAL1="$?"
   [ "$RETVAL1" = "2" -o "$RETVAL2" = "2" ] && return 2

   rm -f $PIDFILE1 $PIDFILE2

   [ "$RETVAL1" = "0" -a "$RETVAL2" = "0" ] && return 0 || return 1
}

case "$1" in
  start)
   [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME1"
   do_start
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   esac
   ;;
  stop)
   [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME1"
   do_stop
   case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
   esac
   ;;
  restart|force-reload)
   log_daemon_msg "Restarting $DESC" "$NAME1"
   do_stop
   case "$?" in
     0|1)
      do_start
      case "$?" in
         0) log_end_msg 0 ;;
         1) log_end_msg 1 ;; # Old process is still running
         *) log_end_msg 1 ;; # Failed to start
      esac
      ;;
     *)
        # Failed to stop
      log_end_msg 1
      ;;
   esac
   ;;
  *)
   echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
   exit 3
   ;;

esac


#########################################

I don't understand it but as long as you can copy and paste you don't need to either.


Now we set the file permissions:


sudo chmod 755 /etc/init.d/deluge-daemon
sudo chmod 0777 -R -v ~/.config


And then we make it run on startup:

sudo update-rc.d deluge-daemon defaults



We can then start it with this command:

sudo invoke-rc.d deluge-daemon start


And stop it with this command:

sudo invoke-rc.d deluge-daemon stop


You should now be able to access it with http://machinename:8112


Wednesday, 11 November 2015

Newznab

Apologies if I've gone through this before, but I really wanted to start having a tidy up of my instructions and also wanted to to follow them to put things back from scratch. This time, I'm going to build a newsgroup indexer with NewzNab.

Now that I've offloaded my cloud server to a Raspberry Pi, I'm going to go and re-install Newznab onto my old broken Toshiba laptop. The laptop works well enough until you give it a graphical display, looks like something is up with the display chip but it's not needed here. The OS I'm going to use is Ubuntu server as it just seems to work.

All this work is done via SSH from a Linux desktop, you can just copy and paste the commands into a terminal window. First thing we need to do is run updates:

sudo apt-get update
sudo apt-get upgrade

Now let's make the directory structure:

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

Now it's time to install php:

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


Now we make some changes to the php configuration file:

sudo 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 SQL server time with:

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

You will be asked to create a password for the SQL server, make sure it's a good strong one, then we edit another file.


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


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

max_execution_time = 120

and


memory_limit = -1  


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


Once you've saved that file create a new one with:

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

And paste the following into it:

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

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

Change the port if you want it to run on a different port.

One more change to the Apache configuration file before we go on:

sudo nano /etc/apache2/apache2.conf

Find this bit

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

And change it to this:

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


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, 

As I have a paid for version I'm going to use a slightly different approach, for this you need to install subversion with the following command:

sudo apt-get install subversion

Then to get Newznab you enter the following command:

sudo svn co svn://svn.newznab.com/nn/branches/nnplus /var/www/newznab

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

Now it's time to activate the changes:

sudo a2ensite newznab
sudo a2dissite 000-default
sudo a2enmod rewrite
sudo service apache2 restart

And now it's time to set permissions on the folders:


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/music
sudo chmod 777 /var/www/newznab/www/covers/tv
sudo chmod 777 /var/www/newznab/www
sudo chmod 777 /var/www/newznab/www/install
sudo chmod 777 /var/www/newznab/nzbfiles/
sudo chmod 777 /var/www/newznab/www/covers/anime


We need to install a few more applications:

sudo apt-add-repository ppa:kirillshkrogalev/ffmpeg-next
sudo apt-get update
sudo apt-get install unrar mediainfo lame ffmpeg


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:

/usr/bin/unrar
/usr/bin/mediainfo
/usr/bin/ffmpeg
/usr/bin/lame


And now point your browser to 

http://servername/install 

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.

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

Big thanks to the howtogeek website for help with these instructions, I've added a few bits and pieces to get to this stage.

Now that we have made it to this stage it's time to finish off the setting up and then we can add some newsgroups and get the server scanning these for updated files.

Go to the edit site option from your browser and fill in the information required, including the paths for the files we installed earlier such as unrar etc.
You also need to enter the newznab ID you got when you bought the software.
I want it to check and delete password protected releases.
And finally, I want to enable spotnab, just fill in the gaps with your information, it doesn't seem to want you to create any accounts.

Once you've done all that, you can save the settings and click on bulk add groups, in the group list box type *binaries* and in the active box select no. This will populate Newznab with the available binary groups but won't download anything from them initially.
Now click on "View Groups" and type in "Television" into the search box, click on go and it will display the name of all groups with the word "Television" in them. Click on "Activate" to activate the ones you want to scan and then we go back to the command line.

First we change to root with:

sudo -i

Then we change to the script directory with:

cd /var/www/newznab/misc/update_scripts

Then we run:

php update_binaries_threaded.php

This downloads all the updates from the active groups, followed by:

php update_binaries_releases.php

We should now have some files in newznab and we can think about adding some new groups, but we really need to get this process running on startup. So we can create a script in /usr/bin with the following command:

sudo nano /usr/bin/newznab

Paste the following text into it:


cd /var/www/newznab/misc/update_scripts

php update_binaries_threaded.php

php update_binaries_releases.php

Save it and run:

sudo chmod +x /usr/bin/newznab


So far the script looks like this:

cd /var/www/newznab/misc/update_scripts
php update_binaries_threaded.php
php update_binaries_releases.php

This means it's going to run once and then quit, so we need to make it loop back to the start once it's finished.



while :

do

cd /var/www/newznab/misc/update_scripts/

echo "Optimising Database"
php optimise_db.php

echo "Updating TV Schedule"
php update_tvschedule.php

echo "Updating Binaries"
php update_binaries_threaded.php

echo "Updating Releases"
php update_releases.php


echo "Resting"

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

This will now continue until you press Control + C, the only thing is that you need to manually start it from the command line when you want to run it.


If you want it to run on startup, add it to the /etc/rc.local file as follows

sudo nano /etc/rc.local

Add a line before exit at the bottom that says

/usr/bin/newznab &

Save the file and then make it executable with:

sudo chmod +x /etc/rc.local

Finally, test it by running sudo /etc/rc.local

The only problem with this method is that there's no easy way to break the cycle.

I'm open to suggestions for better options, in the meantime, have fun with it.

By the way, you will need to have an account with a usenet provider, I tend to stick with Newsdemon as they are quite reliable,



Saturday, 7 November 2015

Raspberry Pi Cloud Server

I've decided to use a Raspberry Pi as a cloud server, I'm going to install Raspbian on it, setup a couple of hard drives as an lvm and install owncloud. There were a few issues with lvm with the drives not mounting at boot time, I've come up with a workaround. But more of that later.

We'll start by writing the image to an SD card first, you can get the image from here. I'm using Linux here so your method of writing the image to an SD card will be different depending on your OS.

In Linux you use the dd command, in this case the SD card is appearing as /dev/sdg when I connect it to my deskstop, you can find out by type dmesg after connecting it.

Once you've identified the correct device use the following command, the version of raspbian may be different than the one I've shown and please make sure you are using the correct device or you may write the image to an Ipod which is what I did originally.

sudo dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/sdg

Once it's finished writing, put the card into the Raspberry Pi and give it some electric.

You should be able to look at the connected devices on your router to find out it's IP address. Once you have login to it with ssh pi@192.168.0.251 or whatever IP address it shows, the password is raspberry.

One you login, enter the command sudo raspi-config for the configuration utility.




You should get the screen shown above, go down to advanced options and select update, once that's completed select Expand Filesystem so that it fills the card. Then, I'm going to boot options and I'm going to select the top option to boot to a text console and require a login. Next we go to Internationalisation Options and select your country. Then we go back to advanced options and select hostname, I'm changing mine to Andromeda because I can. And then finally back to Advanced Options to make sure that ssh starts on boot. Once you've done all that, go to finish to write the changes and reboot.

Once it's rebooted, log back in and now it's time to add another user with the command:

sudo adduser username 

Followed by:

sudo adduser username sudo

If this is the same as the username on your desktop it means you won't have to enter your username everytime you want to connect and you can run commands as root with that user. Logout as pi and log back in as your user.

Now, it's time to update it and setup the external hard drives, 

sudo apt-get update
sudo apt-get upgrade

Then we install lvm so we can pool some hard drives together.

sudo apt-get install lvm2

Now plug in your external drives, I've got a 1Tb drive and a 512Mb drive showing up as /dev/sda and /dev/sdb.

We need to partition them now with the command:

sudo fdisk /dev/sda 

Use whatever device your drive is showing as.

To delete any existing partitions we type "d", then "n" to create a new one, then "p" for primary, press enter on the next 3 screens to accept the defaults and then type "t" followed by "8e" to identify the drive as an lvm partition. Finally type "w" to write the information to the drive and quit, we then need to do the same for the other drive or drives.

Now we prepare the partitions with:

sudo pvcreate /dev/sda1 /dev/sdb1

Now we create a "Volume Group" with the command:

sudo vgcreate owncloud /dev/sda1 /dev/sdb1

Now we give all the drive space to the volume with:

sudo lvcreate -l 100%FREE -n owncloudlv owncloud

This creates a device called /dev/owncloud/owncloudlv

Next it's time to create the filesystem with the command:

sudo mkfs.ext4 /dev/owncloud/owncloudlv

Now we can create the mount point for the volume, as this is going to be used as storage for my cloud server, I'm going to mount it at /var/www. So first we create the mount point with:

sudo mkdir /var/www

Then we mount it with 

sudo mount /dev/owncloud/owncloudlv /var/www

Normally at this point we can add the UUID of the device to fstab to get the drive starting up at boot time, but there appears to be an issue with the OS here in that the lvm service won't start automatically. I've come up with a not very elegant workaround which is to use the rc.local file to start the service and mount the drive when it boots. So we edit the file with:

sudo nano /etc/rc.local

And at the end of the file above  "exit" we need to add the following:

## Stuff to make the lvm run on startup
service lvm2 start
sleep 10
/sbin/vgchange -a y
sleep 10
mount /dev/owncloud/owncloudlv /mnt/www
sleep 10
service apache2 restart

## End of stuff

The apache2 line will just give an error at the moment until Apache is installed, it needs to be restarted after mounting the drive. I don't know if the sleep options are really needed but they are there to give the drives time to spin up.

We now make sure that the file is executable with:

sudo chmod +x /etc/rc.local

Give it a reboot to make sure it all works

Now it's time to install owncloud

We begin by installing php:

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

Then we change the config file:

sudo 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

Make sure you remove the ";" from the start of the line.

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


Let's install mysql, during the process you will be asked to make a password, if you are going to give access outside of your local network this needs to be a strong one.

sudo apt-get install mysql-server-5.5

Just a few more applications now with:

sudo apt-get install mysql-client-5.5 libmysqlclient-dev apache2 libapache2-mod-php5

And then we need to edit the config file with:

sudo 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 it's time to install and configure the ownCloud server, let's make the directory structure first.

sudo mkdir /var/www/owncloud

Next we make sure ssl is installed and configured correctly:

sudo apt-get install openssl

sudo a2enmod ssl
sudo a2enmod php5
sudo a2enmod rewrite
sudo mkdir -p /etc/apache2/ssl

sudo openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/owncloud.pem -keyout /etc/apache2/ssl/owncloud.key

Time now to edit the apache config file.

sudo nano /etc/apache2/sites-enabled/owncloud.conf

Paste all this into the file,  replacing the IP address in the file with your the IP address of your server:



<VirtualHost 192.168.0.251:80>
#### Redirect to port 443 ###
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
#### End of Redirection configuration ###
DocumentRoot /var/www/owncloud/
<Directory /var/www/owncloud>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>
</VirtualHost>
<VirtualHost 192.168.0.251:443>
####Configuration for SSL #####
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
#### End of SSL Configuration ####
DocumentRoot /var/www/owncloud/
<Directory /var/www/owncloud>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>
</VirtualHost>

Now let's download the ownCloud setup file

sudo -i
cd /var/www/owncloud
sudo wget https://download.owncloud.com/download/community/setup-owncloud.php

Time to set some permissions with:

sudo chmod 0777 -R -v /var/www

and 

sudo chown www-data:www-data -R /var/www

And now we configure owncloud itself by connecting with a web browser to:

https://192.168.0.251/setup-owncloud.php

Replace the IP address with the one for your server.

If you get any error messages just go back and rerun the permissions again.

Once this is all done, forward on port 443 from your router to the raspberry pi so you can get access from the outside world.

That's it, you will get some certificate error messages from your browser and the ownCloud clients.


We've not quite finished with the little machine, one last thing I want to do is to have this update noip with my ip address.

Back to the command line with:
cd ~/
mkdir noip
cd noip
wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
tar vzxf noip-duc-linux.tar.gz
cd noip-2.1.9-1/

Check the name of the folder first to make sure that it's not a different version.
sudo make
sudo make install

Now we want to make this run on startup, we do this with:

sudo nano /etc/init.d/noip

Paste the following onto it

#! /bin/sh
# /etc/init.d/noip 

### BEGIN INIT INFO
# Provides:          noip
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting noip"
    # run application you want to start
    /usr/local/bin/noip2
    ;;
  stop)
    echo "Stopping noip"
    # kill application you want to stop
    killall noip2
    ;;
  *)
    echo "Usage: /etc/init.d/noip {start|stop}"
    exit 1
    ;;
esac

exit 0



Then, make it executable and run on startup with the following commands:

sudo chmod 755 /etc/init.d/noip

sudo update-rc.d noip defaults


Now reboot, and that's it all nice and working.