UniFi Video - How to Update the NVR via SSH


This article describes how to set up and update a UVC-NVR if updating via the UniFi Video user interface is not working, which is the case if the NVR is on a very old version. The NVR has the singularity that when reset back to factory defaults, it will go back to the original firmware, sometimes going back to versions that are more than five years old. Because of this, depending on the version it goes back to, different upgrade processes must be followed. This article provides a script that will allow any NVR to be brought to the most current version possible.

The article is applicable for airVision-C, UVC-NVR, and UVC-NVR-2TB. Accessing the NVR via SSH will be needed during this article. To learn how to SSH into a device please take a look at this article:Intro to Networking - How to Establish a Connection Using SSH. It will also be necessary to enable SSH access to NVR if it isn't currently enabled; see this article for instructions: UniFi Video - How to Enable SSH on the UVC-NVR.

Table of Contents

  1. Introduction
  2. How to Perform UVC-NVR Setup
  3. Related Articles


Back to Top

When setting up an NVR for the first time, or after performing a factory reset, the NVR operating system should be updated, credentials secured, and the video software installed from scratch (rather than upgrading). The steps in the following section will guide you through that process.

ATTENTION: Download any critical recordings and create a backup if the UniFi Video version supports that feature. See this article for options: UniFi Video - Backup Options and Best Practices. Each script gives a brief description of what users should expect, and the warning must be accepted before the script can continue.

How to Perform UVC-NVR Setup

Back to Top

1. SSH into the NVR using a CLI application (such as Command Prompt or Terminal, for example). Follow this article to learn how to make an SSH connection. Since the NVR has been reset to defaults (or is new) the username to be used for the SSH session will be root, and the default password will be ubnt. The IP address requested is the NVR's IP. There are several ways to find out the NVR's IP address which will vary, one way is to use WiFiman.

2. Use one of the following commands (depending on the NVR device in question) to clean any old versions of UniFi Video or airVision that may be part of the original firmware. Hover and click on the Click to copy pop-up and then paste the command on the CLI application, hitting enter to run the commands. Only one of these should be successful, nothing will happen if the incorrect command is used.

apt-get purge airvision
apt-get purge airvision2
apt-get purge unifi-video

3. Issue the following commands hitting enter. 

User Tip:Steps 3-8 have several lines of commands that must be copied and pasted together, then executed by hitting enter. Make sure it did execute, if it seems like it didn't, hit enter again.
rm -rf /etc/apt/sources.list.d/*airvision* /etc/apt/sources.list.d/*video* /etc/apt/sources.list.d/*mfi*;
apt-get autoclean -y;
rm /etc/apt/sources.list;
rm /etc/apt/sources.list.d/security.list;
wget -qO - https://www.ubnt.com/downloads/unifi-video/apt-3.x/unifi-video.gpg.key | sudo apt-key add -;
echo 'deb [arch=amd64] http://www.ubnt.com/downloads/unifi-video/apt-3.x wheezy ubiquiti' > /etc/apt/sources.list.d/unifi-video.list;
echo 'deb http://archive.debian.org/debian/ wheezy main contrib non-free' >> /etc/apt/sources.list;
echo 'deb http://archive.debian.org/debian-security/ wheezy/updates main' >> /etc/apt/sources.list.d/security.list;
dpkg --configure -a;
apt-get update -o Acquire::Check-Valid-Until=false --force-yes;
apt-get upgrade -y -o Acquire::Check-Valid-Until=false -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes;

4. Issue the following commands, hitting enter. If asked if you'd like to restart services during package upgrades without being asked, select 'yes'.

echo 'deb http://archive.debian.org/debian/ jessie-backports main' >> /etc/apt/sources.list.d/openjdk.list;
echo 'deb http://archive.debian.org/debian/ jessie main' >> /etc/apt/sources.list.d/openjdk.list;
apt-get update -o Acquire::Check-Valid-Until=false;
apt-get install -y -t jessie-backports openjdk-8-jre-headless --force-yes;

5. Issue the following command and hit enter:

apt-get install -y nano --force-yes;

6. Issue the following commands and hit enter:

rm /etc/apt/sources.list.d/openjdk.list;
apt-get install -y unifi-video

7. Issue the following command and hit enter:

apt-get install -f -y -o Acquire::Check-Valid-Until=false;

8. Issue the following commands and hit enter:

apt-get autoremove;
apt-get clean;
apt-get update -o Acquire::Check-Valid-Until=false;
hn=$(cat /etc/hostname)
if [[ $hn == "airVisionNVR" ]]; then
  /usr/sbin/nvr-systool hostname UniFi-Video-a

9. Exit the SSH session by typing out the following command and hitting enter:


Related Articles

Back to Top

Intro to Networking - How to Establish a Connection Using SSH

UniFi Video - How to Enable SSH on the UVC-NVR

UniFi Video - How to Reset a UniFi Video Installation for Linux / UVC-NVR

Was this article helpful?
89 out of 171 found this helpful