How to install UniFi Controller on Linux: A step-by-step guide

Installing the UniFi Network Application (previously UniFi Controller) on a Linux system is a great way to manage your UniFi network with greater flexibility and control.

However, it can be challenging to get the installation right. This guide will walk you through the installation steps in a Linux environment.

Let's dive in!

Before we dive in, please don't host your UniFi Controller on linux if you work with clients. Sooner or later this will cause issues! It's fine for home users, but definitely not recommended for businesses. You can try UniHosted for free.

Preparing for Installation

Requirements

Before starting, ensure you have backed up the UniFi Network Database and that the user has sudo permissions. For more information on adding a user to the sudo list, see this Debian article.

UniFi Network APT Steps

  1. Install required packages:

    bash
    sudo apt-get update && sudo apt-get install ca-certificates apt-transport-https
    
  2. Add a new source list:

    bash
    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
    
  3. Add the GPG Keys:

    • Method A (recommended):
      bash
      sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
      
    • Method B:
      bash
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
      
  4. Install MongoDB for a new UniFi Network Server:

    bash
    wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
    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: This step may not be required depending on your Linux distro. Refer to the MongoDB installation guide for Ubuntu or Debian.

  5. Install and upgrade the UniFi Network application:

    bash
    sudo apt-get update && sudo apt-get install unifi -y
    
  6. Access the UniFi Network application:

    • Open a browser and navigate to the local or public IP address of your computer. If it is not launching, start the service:
    bash
    sudo service unifi start
    

Other Helpful Commands

  • Stop the UniFi service:
    bash
    sudo service unifi stop
    
  • Restart the UniFi service:
    bash
    sudo service unifi restart
    
  • Check the status of the UniFi service:
    bash
    sudo service unifi status
    

Post-Installation Tips

  • Firewall Settings: Ensure traffic is allowed on port 8443, used by the UniFi Controller.
  • Regular Updates: Keep your UniFi Controller software updated for the latest features and security enhancements.
  • Backup Your Configuration: Regularly back up your UniFi Controller configuration to prevent data loss.

Final Thoughts

Installing the UniFi Controller on a Linux server provides a robust and flexible way to manage your UniFi network. For a more streamlined solution, consider our cloud-hosted UniFi Controller services at UniHosted.

Our cloud solution eliminates the need for local hardware and software management, providing an efficient, secure, and scalable way to control your UniFi networks.