Script to install
Self-Hosting a UniFi Network Server - Ubiquiti Inc.
UniFi Installation Scripts | UniFi Easy Update Script | UniFi Let's Encrypt | UniFi Easy Encrypt | Ubuntu 16.04/18.04/20.04/21.04/22.04/23.04/23.10/24.04 | Debian 9/10/11/12/13/14
Link for the above post is bellow:
For a new UniFi Network Server, install MongoDB. For Ubuntu 22.04, run the commands below. If you're updating the UniFi Network Server to version 7.5, ignore these commands and instead refer to MongoDB's help article (or use this community script) to update your database to the required MongoDB version 3.6.