First, I’ll go over the manual method.
Go to the Ubiquiti downloads page
Select Unifi on the top navigation bar
Underneath the software section find:
UniFi Network Controller 5.13.29 for Debian/Ubuntu Linux and UniFi Cloud Key
Click the download button and accept the license terms.
Then click the copy URL button to copy the URL to your clipboard.
Next, ssh to your VM and become the root user.
Copy and Paste this command to edit the PATH variable to include folders that the installer requires to run
That command prevents this error from occurring:
Preconfiguring packages ... dpkg: warning: 'ldconfig' not found in PATH or not executable. dpkg: warning: 'start-stop-daemon' not found in PATH or not executable. dpkg: error: 2 expected programs not found in PATH or not executable. Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin. E: Sub-process /usr/bin/dpkg returned an error code (2)
If I recall correctly the PATH variable was changed between the move from sysvinit to systemd architecture. The unifi.deb installer package expects to be run on a sysvinit system. However, it will run fine on the systemd system as long as this change is made.
Now download the file using wget.
Then, once the file has finished downloading using the dpkg package manager with the install flag to install the debian package.
dpkg -i unifi_sysvinit_all.deb
This takes several minutes and will cause your Unifi controller to become unavailable as it restarts the unifi service.
Note that if you’re using a sysvinit version of Debian that the export command will not be necessary.
Also to check the status of the service will be using a slightly different command.
On Debian version up to and including Debian 7. Everything after is systemd.
However, you can try several if you’re not sure
First is the absolute path in a sysvinit system
You can also use the service command
service unifi status
service unifi start
service unifi stop
And on systemd systems you can use systemctl command
systemctl unifi status
systemctl unifi start
systemctl unifi stop
Here is the Ubiquiti official version where you have the package installed via apt:
When performing the steps in the official guide switch the order of steps 1 and 2.