Updating and Installing Self-Hosted UniFi Network Servers (Linux)

This article was originally published on Ubiquiti Help Center and is reposted for archival purposes.

This article provides the steps to install and update the self-hosted UniFi Network Server to the current stable release on a Debian or Ubuntu system via APT (Advanced Package Tool). If you run into issues following the process described in this article, please take a look at the scripts provided here to install and update the UniFi Network Application.
Requirements

In order to update the UniFi Network Server via APT, it is necessary to create source files or edit lines in an existing sources.list file with Linux text editors: vi or nano. The repo structure should be permanent, but if there are any changes, they will be pointed out in the UniFi Network software version release posts, found in the Release section of the Community.

Before upgrading the UniFi Network Server, make sure that you have backed up the UniFi Network Database. You will need to make sure that the user has sudo permissions. For more information about adding a user to sudo list, see this Debian article.
Ubuntu or Debian-Based Scripts

Refer to this Community post.
UniFi Network APT Steps

Install required packages before you begin with the following command:

sudo apt-get update && sudo apt-get install ca-certificates apt-transport-https

Use the following command to add a new source list:

echo 'deb [ arch=amd64,arm64 ] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list

Add the GPG Keys.
Method A (Recommended): Install the following trusted key into /etc/apt/trusted.gpg.d:

sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg

Method B: Using apt-key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50

Install the correct version of MongoDB.
New UniFi Install: Run the following command:

echo "deb [trusted=yes] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update

Note: Depending on your Linux distribution, this step may not be necessary. If MongoDB is not included with your distro and isn’t available in its repository, refer to the MongoDB installation guide (Ubuntu | Debian).
Existing Install (UniFi Network v7.5 or Newer): Skip this step.
Existing Install (UniFi Network v7.4 or Prior): Refer to MongoDB’s Help Article for instructions on updating MongoDB to v.3.6 or later.

Install and upgrade the UniFi Network application with the following command:

sudo apt-get update && sudo apt-get install unifi -y

The UniFi Network application should now be accessible at the computer’s configured local or public IP address, by typing that IP address in a browser’s navigation bar (Chrome is recommended). If it is not launching, use the following command:
sudo service unifi start

When using the commands above, it is assumed you have sudo and wget installed. More information about sudo can be found here, and wget here.

Other Helpful Commands

To stop the UniFi service: sudo service unifi stop
To restart the UniFi service: sudo service unifi restart
To see the status of UniFi service: sudo service unifi status

Click here for possible suite names and code names.
Log Files Location

Log files are essential for any troubleshooting. Find them here:

/usr/lib/unifi/logs/server.log
/usr/lib/unifi/logs/mongod.log

If your application is running on a Unix/Linux based system, then you will require superuser (sudo) privileges to access these log files.

About the Author

Jim Lucas

Owner and proprietor of this establishment

Leave a Reply

Your email address will not be published. Required fields are marked *