How to Host a UniFi Controller Self-Hosted

Published onby Iron

So, you want to host your own UniFi controller, huh? Good choice! Hosting your own controller gives you full control, better customization, and lower long-term costs. It’s a project for network enthusiasts, IT pros, and small business owners who want to avoid paying for a Cloud Key or a hosting service.

Let's dive in!

Table of Contents

What is a UniFi Controller?

A UniFi controller is a software tool that allows you to manage your UniFi devices, including access points (APs), switches, and cameras. It gives you a sleek, user-friendly dashboard to view network traffic, create VLANs, adopt devices, and more.

Most people buy UniFi hardware like the Cloud Key or Dream Machine to host the controller. But with a self-hosted option, you can run the controller on your PC, server, Raspberry Pi, or a cloud-based VPS.

Why Self-Host a UniFi Controller?

Here’s why people love self-hosting their UniFi controllers:

  • Save Money: No need to buy a Cloud Key or Dream Machine.
  • Full Control: Own your data, updates, and configurations.
  • Customization: Add scripts, change ports, and set it up your way.
  • Multi-Site Management: Manage multiple UniFi networks from one controller.

Cons to keep in mind:

  • Responsibility: You have to handle updates and security.
  • Hardware Cost: You’ll need a device (PC, server, or Raspberry Pi).
  • Learning Curve: If you're unfamiliar with Linux or VPS, it takes time.

What You Need to Get Started

To get started, you’ll need:

  1. Hardware: PC, server, VPS, or Raspberry Pi.
  2. Operating System: Linux (Ubuntu or Debian), macOS, or Windows.
  3. Software: Java and the UniFi controller software.
  4. Internet Access: If you want to access it remotely.

Hardware Options

Option Use Case Power Usage
Raspberry Pi 4 Great for home users Minimal (low cost)
Old Laptop/PC Home use/small offices Medium (higher cost)
Cloud VPS Remote & 24/7 access Zero at home, monthly VPS cost
Dedicated Server Large deployments High power/costs

Step 1: Install UniFi Controller

Depending on your operating system, the process differs slightly. Here’s a breakdown for Linux, Windows, and macOS.

Option 1: Install on Linux (Debian/Ubuntu)

If you have a Raspberry Pi, server, or VPS, Linux is the way to go. It’s lightweight, stable, and free.

  1. Update Your System

    sudo apt update && sudo apt upgrade -y
    
  2. Install Java

    sudo apt install openjdk-8-jre-headless -y
    
  3. Add Ubiquiti’s Repository

    echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/ubiquiti.list
    
  4. Install UniFi

    sudo apt update
    
    sudo apt install unifi -y
    
  5. Start the Controller

    sudo systemctl start unifi
    
  6. Enable on Boot

    sudo systemctl enable unifi
    
  7. Access the Controller Visit https://localhost:8443 in your web browser.

Option 2: Install on Windows

This is the easiest method, but it requires the Windows machine to be on 24/7.

  1. Download the UniFi Controller from the Ubiquiti website.
  2. Run the installer and follow the prompts.
  3. Launch the UniFi controller and visit https://localhost:8443.

Option 3: Install on macOS

  1. Download the macOS version of the UniFi controller.
  2. Install it like any other app.
  3. Open it and follow the setup wizard.

Step 2: Access and Configure the UniFi Controller

Once the controller is up, configure it.

  1. Access the Web Interface

  2. Follow the Setup Wizard

    • Create a username and password.
    • Configure network details.
    • Set up Wi-Fi networks if needed.
  3. Adopt UniFi Devices

    • Connect UniFi access points, switches, and cameras.
    • Use the “Adopt” button to bring devices under management.

Step 3: Secure Your Controller

If your controller is open to the web, securing it is crucial. Follow these tips:

  1. Enable 2-Factor Authentication (2FA)

    • Go to Account Settings > Security.
    • Enable 2FA with Google Authenticator or Authy.
  2. Limit IP Access

    • Set firewall rules to only allow trusted IPs.
  3. Disable Unused Ports

    sudo ufw allow 8443
    
    sudo ufw allow 8080
    
    sudo ufw enable
    
  4. Use SSL Certificates

    • Replace the self-signed SSL certificate with a Let’s Encrypt certificate.

Step 4: Adopting UniFi Devices

To add devices like APs and switches, follow these steps.

  1. Factory Reset Devices: Hold the reset button for 10 seconds.
  2. Discover Devices: Use the UniFi mobile app or controller.
  3. Adopt Devices: Click "Adopt" in the controller.

If a device is "Managed by Other", SSH into it and run:

set-inform http://<controller-ip>:8080/inform

Step 5: Backup and Updates

Don’t let your hard work go to waste. Back up your configuration and keep your system updated.

Automatic Backups

Set up daily backups:

sudo crontab -e

Add this line:

0 2 * * * tar -czf /backups/unifi-backup-$(date +\%Y\%m\%d).tar.gz /var/lib/unifi/

Update UniFi Controller

sudo apt update && sudo apt upgrade -y

Troubleshooting Tips

Problem Solution
Can’t Access Web UI Check if UniFi is running: "sudo systemctl status UniFi"
Adoption Failed SSH into device, run "set-inform"
Device Offline Reboot device, check firewall rules

Self-Hosted vs. Cloud-Hosted (Which is Better?)

Self-Hosted: Full control but requires you to manage updates, backups, and security.

Cloud-Hosted: Easier setup and maintenance. Services like UniHosted offer cloud-based UniFi controllers for a small fee. No hardware needed, and they handle updates, security, and uptime.

Recommendation: If you want no-hassle hosting, check out UniHosted.

Frequently Asked Questions (FAQ)

1. Can I run UniFi on a Raspberry Pi? Yes, Raspberry Pi 4 (4GB) is powerful enough.

2. Is self-hosting better than using a Cloud Key? Self-hosting gives more control and is cheaper, but requires maintenance.

3. What’s the best OS for self-hosting? Linux (Debian/Ubuntu) is the best option due to stability and performance.

4. Can I use a VPS to self-host? Yes, and it’s one of the best methods for remote access.

Final Thoughts

Running a self-hosted UniFi Controller is satisfying, especially for tech enthusiasts. You save money, get full control, and learn some cool IT skills.

But if you’re looking for simplicity and don’t want the headache of server management, cloud-hosted UniFi controllers from UniHosted are worth checking out. They handle updates, backups, and security for you.If you would like me to personally walk you through UniHosted, you can schedule a call with me here.

We host UniFi Controllers in the Cloud

Are you ready to take your UniFi Network to the next level? Deploy a UniFi Cloud Controller in minutes and manage your network from anywhere.

Deploy Now

Free tier available

Get the best support

Join 1660+ customers

No credit card required