For a while I have been looking for a solution to installing Zoneminder on my Synology ds1812+. Synology has a Surveillance Station application, they only give you 1 free license and every additional camera is $50. To install Zoneminder you first have to run Debian in a bottstrap on the NAS. This is how I did it.

What you will need

A machine running Debian. I used a VMWare VM.
A Synology NAS with an i386 or amd64 processor. Other processors will work, but you will have to modify these instructions for your processor. See this page to find out what processor your NAS has.

1. Bootstrap with Optware.

This is already laid out on Synology’s site. Follow these instructions and install Optware on your device.

2. Create the Debian environment on a PC

On your PC or VM, install Debian. Get it here.

Once installed, update it.

Create a folder on the NAS for the environment.

Create the folder for the environment on the PC (or VM).

Install debootstrap.

Run the frist step for debootstrap. This can take quite a while.

The architecture is i386, but you could also use amd64 if you have an Atom processor. See here for the other archetecture types.
Wrap it all up in a tar.

Now copy that tar to /volume1/debian on your NAS somehow. I mounted the remote folder, but you can use the GUI or whatever method you want. Just get it to the NAS.
Now on the NAS, extract those files to the chroottarget folder.

Run the second stage. This will take a while.

2. Configure the environment

Copy the /etc/resolv.conf file so you can resolve hostnames.

Set the hostname

Bind the proc directory.

Enter the Debian Chroot (run this command every time you want to get into Debian)

3. Setup apt

4. Install Zoneminder

This is where I have problems. The package installs, but doesn’t run. I think it is because Apache and MySQL are already running on the main system so it conflicts with the ones the package tries to install. If anybody knows how to fix this please let me know.

As part of my quest to learn Linux I decided to replace my download machine which was running Windows 7 with Ubuntu Server 12.04.

I started with a fresh Ubuntu Server install on my VMWare ESXi server. I only made the drive 20GB because that’s all I really need for the OS. I made a second drive 250GB persistent and added it to the VM. This is where I store all of the pending and unorganized downloads.

Once the machine was loaded, I had to mount the 250GB persistent VM drive and my 10TB DroboFS share.

I won’t cover how to set up SABnzbd, SickBeard or CouchPotato because you can find those tutorials all over the place and they are all pretty much the same. The only thing I will cover is how to install them and make them automatically start on boot.

First I need to get the filesystem  and folders set up.

Mounting the storage drive

I had originally intended to use LVM for the mass storage device but it caused problems with taking snapshots in ESXi. Instead I decided to go with just a regualr EXT3 drive. You lose the ability to easly grow the drive (although it can still be done) or add it to the OS drive, but for this situation it doesn’t really matter.

Anyway, this is what I had to do.

First, find the drive.

fdisk (fixed disk) is a tool for partitioning a drive. The -l flag lists the drives.

I know my drive is 250GB so I can see it is /dev/sdb. I will refer to this throughout the rest of the tutorial.

Now we need to partition the drive.

  1. Press m for menu.
  2. Press n for new partition.
  3. Press p to create a primary partition.
  4. Press 1 to make it the first partition.
  5.  Press enter to accept the default start cylinder.
  6.  Press enter to accept the default end cylinder.
  7. Now set the type. Press t for type.
  8. Press l to the list the format types.
  9. Look for LVM. Press 8e to select the LVM type.
  10. Now write the changes by pressing w.
  11. Check to make sure the partition was created.

Now list the drives again.

Now I see /dev/sdb1.

Now I need to mount the drive so I can write files to it.

Now we check to make sure it is mounted correctly.

 Mounting the DroboFS (NAS)

Now I need to mount my Media folder on the NAS. This is where all of my finished movies and TV shows are. I created a generic user/pass for it to make things easy.

First, make sure you have Samba and smbfs installed. More than likely it already is, but lets just make sure.

Now we need to mount it.

Mounting the NAS was a problem because I wasn’t able to write files to it. After about an hour I finally figured out what I was doing wrong. Even though I was mounting it with a user that had read/write, I wasn’t able to write any changes unless I was sudo. file_mode=0777 mounts the NAS under chmod 777 which allows read, write, execute (same for dir_mode).

I have my Media folder unprotected, but if you have your’s password protected you can use username=<username>,password=<password>.

The rw at the end means read/write. Probably not necessary since I set chmod to 777.

Make some shortcuts that we will need later.

This will create shortcuts for your new downloads (and those that are still downloading) and the location of your archived movies, music and TV shows. Make sure you set these directories to the correct respective path.

Installing SABnzbd

First lets organize our folders. TV Shows and Movies refers to the location of your TV Shows and movies. For me it is in the Media folder.

This puts shortcuts to the folders in our home folder.

Now to install SABnzbd. You can install from apt-get, but the version in there is out of date. Instead lets add another repo to pull from, then install it from apt.

Enter your username where it says USER=.

Now you can reboot if you want to test that it automatically starts.

You may not be able to access the web interface the first time because it defaults to only allow access from the localhost. Here is how to fix it:

Search for host (use CTRL+W to search). Change localhost to 0.0.0.0. Exit and restart sabnzbd.

Note: DO NOT USE SUDO TO START ANY OF THESE SERVICES! Only start these services as the local user.

Installing SickBeard

We will install SickBeard and CouchPotato with git. First make sure it is installed.

Now lets download the source code.

When it is finished it should look like this:

You can put it in your home folder if you want (mv sickbeard ../.sickbeard) which is where most people put it, but I like to put it in my /usr/share folder. Just remember where you put it.

Now we need to make it start on boot. This startup script and the one for CouchPotato are by daemox over at ainer.org.

Enter the following code in the file:

Change USER=”ChangeMe” to your username.

Make the file executable so it will actually run.

Again, you can now reboot if you want to test it, or you can go on to installing CouchPotato.

Installing CouchPotato

The installation of CouchPotato is the same as SickBeard. We are going to install from the source on GitHub and create an autorun.

Now make the auto run file.

Paste this code:

Again, change USER=”ChangeMe” to your username.

Make the file executable.

Wrapup

Ok, now you have SABnzbd, SickBeard, and CouchPotato setup. I also have a second hard drive and my NAS mounted.

At work I use Firefox (we can’t use Chrome for some reason) but they have an error on the default install. When you try to search from the address bar it give some funky error message. This is how I fixed it:

  1. Open a new tab.
  2. In the address bar type about:config. Press enter.
  3. In the Search field enter keyword.URL.
  4. Put in your search settings. I use Google so I put the following:

Your search term will be appended to the end of the URL and the page will load. You can put any search engine you want in there, you just have to figure out what the proper formatting is for the URL.

First install bind.

These may already be installed. If so, great.

Now we need to configure bind.

Add a zone for your domain. My domain is the4tress.net. Change this to reflect your domain.

Edit your options file

Add your DNS servers. This is usually provided by your ISP. I use Google’s DNS servers.

Now we need to make the zone files

Now we need to configure the zones. Again, change this to reflect your domain name.

Add the following lines

Save and exit.

Now we need to create the reverse DNS server file.

Add the following lines:

Restart bind9.

Now make sure everything is working correctly.

Your result should look like this:

In my home lab I created a Windows Server 2008 R2 domain so I could study for the MCITP. I was able to set up Active Directory, DHCP, DNS, Remote Desktop Gateway, Web Server, Windows Deployment Server and Windows Server Update Services. Everything is working perfectly, but now I need to learn more about Linux for some jobs I will be applying for soon. As a result, I am going to completely rebuild my whole home lab with a Linux solution instead of Windows Server. I will try to document everything here in case anybody wants to set up something similar.

Yesterday I created a new virtual machine on my ESXi server and installed Ubuntu Server 12.04 LTS. This morning I set up the DHCP server. It was pretty straight forward but there was some incorrect information online. I guess things changed from 11.10 to 12.04. Here is what I ended up doing:

First make sure you don’t have another DHCP server running. Usually this is your gateway (router). I had to disable it on my Asus RT-N16.

Install all updates

Find your ethernet adapters:

It will probably be eth0 or eth1 depending on your configuration. Find out which one you are using. I am using eth0 so I will always refer to this adapter from now on.

Set a static IP

Edit the file to look like this:

Restart your networking service:

You could also do this:

Install the DHCP server. This used to be dhcp3, but now it is isc-dhcp-server. I think Ubuntu 12.04 installs both dhcp3 and isc-dhcp-server when you install dhcp3, but this way is the new standard.

Edit the ISC settings

Put your adapter name in INTERFACES=”". It should look like this:

Save the file and exit.

Edit the DHCP settings:

The instructions in this file are pretty good so just read through there and edit your configs as needed. Here is what mine looks like:

Restart the ISC service:

That’s it! Now you have a DHCP server running. Renew the IP addresses on all of your machines and use ifconfig (or ipconfig if they are on Windows) to check your settings.