Saturday, December 18, 2021

How to update Ubiquiti UniFi controller on CentOS 7.

Note: This needs to be done after hours as devices may lose connectivity for about 10 seconds to re-provision.

  1. Get URL for latest stable UniFi Controller: https://www.ui.com/download/ Then click on UniFi. Then look for software category. Then click on UniFi Network Application Debian file. Then click Download link. Accept EULA. Then review download link location.
  2. SSH into server and log in as root.
  3. Stop the UniFi controller service
    # service unifi stop
  4. Download the Unix version of the UniFi controller replacing the version number in the URL from Step 1:
    # wget https://dl.ui.com/unifi/6.xx.xx/UniFi.unix.zip
  5. Unzip the downloaded file:
    # unzip UniFi.unix.zip
  6. Move existing UniFi controller to a backup folder:
    # mv /opt/UniFi/ /opt/UniFi_bak
  7. Move new UniFi controller files to final location:
    # mv UniFi/ /opt
  8. Copy existing database (with all info about your UniFi devices) files to final location:
    # cp -rf /opt/UniFi_bak/data/ /opt/UniFi/data/
  9. Change ownership of files to match what your controller runs as:
    # chown -R ubnt. /opt/UniFi
  10. Start new UniFi controller software:
    # service unifi start
    (wait for database to be upgraded in background, may take a few minutes before you are able to log in)

Optional prune database to optimize performance issues:

https://help.ubnt.com/hc/en-us/articles/204911424-UniFi-How-to-Remove-Prune-Older-Data-and-Adjust-Mongo-Database-Size#3.%20How%20to%20Prune%20Linux