Wirelessly attach wired cameras - Part 3

In part three, we will be completing our setup of the wirelessly extended G3 cameras. https://www.ubnt.com/unifi-video/unifi-video-camera-g3/

In part one, we flashed our $20 high dBi router to DD-WRT, in part two we made it a range extender (repeater bridge), and in this installment we are going to setup the Unifi DVR.

For this, we had an old PC that was collecting dust. Doesn't need to be anything fancy, doesn't need SSDs or anything like that. I happen to know many people around my community, so people tend to call me when computers are being thrown away to see if I want them. The answer is ALWAYS yes. I use them for projects like this, I fix them up and give them to people who need a computer, whatever the case may be, I usually have 2 or 3 spares ready to rock. Really, an old laptop, anything you can get your hands on will suffice. I would do a bit of testing if its new to you to ensure that drives won't fail on you too quickly. A new hard drive is not a big expense, and that's a critical part to ensure is stable when we talk about security camera footage.

Step One: The setup
If you aren't familiar with virtualization, particularly linux containers (LXC), I highly reccomend you do some research.

A great friend and colleague, Deviant Engineer, had me drinking the LXC KoolAid almost right away.

In the past I've installed Ubuntu and the LXC packages, and that works great. You will spend a lot of time in the command line, which to me, is not a huge deal, but for those that can't engineer (like you), a GUI is much easier. Now, I preface this because it is optional, you could just install Ubuntu, install the Unifi controller and call it a day, but, you'll probably want to do more stuff in the future and keeping them separate is best practice.

What I really recommend here is Proxmox. Download the ISO, install that to your machine. You now have something that you can spin up LXCs on or KVMs on.

A bit of setup, give your Proxmox a static IP, once complete visit that IP on port 8006, for example:

Once there, you should see a nice GUI like so:

As you can see, over time the number of machines you have will grow exponentially.

Now that proxmox is installed, lets SSH to it, and download the proper LXC template. Pick your poison - at the time of writing you can either get Ubuntu 16.04, 14.04, or Debian 7


root@tartarus:~# pveam available | grep -i ubuntu
system          ubuntu-12.04-standard_12.04-1_amd64.tar.gz
system          ubuntu-14.04-standard_14.04-1_amd64.tar.gz
system          ubuntu-16.04-standard_16.04-1_amd64.tar.gz
system          ubuntu-16.10-standard_16.10-1_amd64.tar.gz
system          ubuntu-17.04-standard_17.04-1_amd64.tar.gz
system          ubuntu-17.10-standard_17.10-1_amd64.tar.gz
system          ubuntu-18.04-standard_18.04-1_amd64.tar.gz

Note: I've defined Templates - you may have to do some tab completing to figure out what yours is named... pveam download <tab><tab> should list your available storage places.

root@tartarus:~# pveam download Templates ubuntu-16.04-standard_16.04-1_amd64.tar.gz
starting template download from: http://download.proxmox.com/images/system/ubuntu-16.04-standard_16.04-1_amd64.tar.gz
download finished

Now, lets jump back into proxmox Web UI and in the upper right, lets click "Create CT"

Give it an ID, I like to set the ID to what the static IP is going to be, but thats your preference. Give it a hostname, like nvr, set a password, and click next.

Select your template you just downloaded, next.

Give it enough disk that makes sense. Remember, we are using this as security camera recordings - don't be stingy. Next.

Give it a few cores, give it a minimum of 4GB of RAM. For spec, the Unifi NVR appliance is a 2TB drive, 4GB RAM, and and Intel D2550 (Dual Core 1.86Ghz).

Next, next, next.

Give it an IP that makes sense with your ID / the CIDR range, and your gateway.

Next, next, finish.

Once it does its thing, close out of the popup, and start the container.

You'll probably need to launch the console and jump in and allow root SSH if you want to use any terminal client. (edit /etc/ssh/sshd_config
find PermitRootLogin and change to PermitRootLogin yes, then systemctl restart sshd)

From this point on, all of the installation is going to be the same if you installed Ubuntu or Debian or if you installed inside of Proxmox.

Copy the link address of the download, for me 16.04...

wget https://dl.ubnt.com//firmwares/ufv/v3.9.6/unifi-video.Ubuntu16.04_amd64.v3.9.6.deb
root@nvr:~# dpkg -i unifi-video.Ubuntu16.04_amd64.v3.9.6.deb
Selecting previously unselected package unifi-video.
(Reading database ... 16228 files and directories currently installed.)
Preparing to unpack unifi-video.Ubuntu16.04_amd64.v3.9.6.deb ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Installed Version
unifi-video: /var/lib/dpkg/tmp.ci/preinst install
Unpacking unifi-video (3.9.6) ...
dpkg: dependency problems prevent configuration of unifi-video:
 unifi-video depends on mongodb-10gen (>= 2.4.10) | mongodb-org-server (>= 2.6.0) | mongodb-server (>= 2.4.9); however:
  Package mongodb-10gen is not installed.
  Package mongodb-org-server is not installed.
  Package mongodb-server is not installed.
 unifi-video depends on openjdk-8-jre-headless; however:
  Package openjdk-8-jre-headless is not installed.
 unifi-video depends on jsvc (>= 1.0.15); however:
  Package jsvc is not installed.

Oops, no matter, easy fix.

root@nvr:~# apt-get install -f

Answer yes.

Afterwards, try it again. You're good to go.

I could sit here and type all of the prerequisites out, but sorry, I'm lazy and thats how I do it.

systemctl enable unifi-video
systemctl start unifi-video
systemctl status unifi-video

Note: I had some issues at first with tmpfs being write-protected, a reboot of the LXC fixed that.

May 23 21:16:14 nvr systemd[1]: Starting LSB: Ubiquiti unifi-video...
May 23 21:16:14 nvr unifi-video[4778]:  * Starting Ubiquiti UniFi Video unifi-video
May 23 21:16:14 nvr unifi-video[4778]: mount: cannot remount tmpfs read-write, is write-protected
May 23 21:16:16 nvr unifi-video[4778]:    ...fail!

Time to log in! For those that don't know how to check what port a service is running on, netstat is your friend.

root@nvr:~# netstat -pantu
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0*               LISTEN      79/mongod
tcp        0      0    *               LISTEN      195/sshd
tcp        0      0  *               LISTEN      548/master
tcp        0      0     ESTABLISHED 446/2
tcp6       0      0 :::7080                 :::*                    LISTEN      416/unifi-video
tcp6       0      0 :::7443                 :::*                    LISTEN      416/unifi-video
tcp6       0      0 :::22                   :::*                    LISTEN      195/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      548/master


Follow the steps to setup an account, and if you've done everything correctly, and your cameras are on the network, you will be off and running with some wirelessly extended cameras!

comments powered by Disqus