How-To Move Unifi Controller or Use a Custom Install Path and Database Path

posted in: Sage Advice | 0

For a Windows install

There are 2.5 (yes, a half option) options here. Pay attention, as the steps have subtle differences! Most of these steps are performed at a command prompt

1. Use a SymLink (for the entire installation)

  1. Install the software (defaults to the running user profile folder – C:\Users\<username>\Ubiquiti Unifi
  2. Create a service: Ubiquiti-Run-As-A-Service
  3. Stop the service: command prompt –> net stop UniFi <enter>
  4. Move (do not copy) the installation directory to where you want it “installed”
  5. Return to the default installation parent path: cd C:\Users\<username>
  6. Create a symlink: mklink /D “Ubiquiti UniFi” “<new location full path>”
    • Example mklink /D “Ubiquiti UniFi” “C:\Program Files\Ubiquiti UniFi”
  7. Start the service: command prompt –> net start UniFi

1.5  Use a SymLink (for the database only)

  1. Install the software (defaults to the running user profile folder – C:\Users\<username>\Ubiquiti Unifi)
  2. Create a service: Ubiquiti-Run-As-A-Service
  3. Stop the service: command prompt –> net stop UniFi <enter>
  4. Move (do not copy) the DATABASE folder to where you want it located
    • Example: move C:\Users\<username>\Ubiquiti Unifi\data\db to E:\UbiquitiDB
  5. Ensure that the \db folder no longer exists at the default location
  6. Return to the default DATABASE parent path: cd C:\Users\<username>\Ubiquiti UniFi\data\
  7. Create a symlink: mklink /D “db” “<new DATABASE location full path>”
    • Example mklink /D “db” “E:\UbiquitiDB”
  8. Start the service: command prompt –> net start UniFi


2.  Modify the Registry (for the entire installation)

  1. Install the software (defaults to the running user profile folder – C:\Users\<username>\Ubiquiti Unifi)
  2. Create a service: Ubiquiti-Run-As-A-Service
  3. Stop the service: command prompt –> net stop UniFi <enter>
  4. Move (do not copy) the installation directory to where you want it “installed”
  5. Open Regedit and modify these two locations:
    • HKLM\SYSTEM\CurrentControlSet\Services\UniFi
      1. Modify the “ImagePath” Value to point to the NEW location
      2. Example: “C:\Program Files\Ubiquiti UniFi\bin\UniFi” //RS//UniFi
    • HKLM\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\UniFi
      1. Go into EACH of the Keys (folders/subfolders) and locate anything that points to the original install location
      2. You will want to modify each entry to point to the new location
      3. At the time of this writing, you will need to modify the following:
        • HKLM\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\UniFi\Parameters\Java\Classpath
        • HKLM\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\UniFi\Parameters\Log\Path
        • HKLM\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\UniFi\Parameters\Start\WorkingPath
        • HKLM\SOFTWARE\WOW6432Node\Apache Software Foundation\Procrun 2.0\UniFi\Parameters\Stop\WorkingPath
  6. Start the service: command prompt –> net start UniFi
     

Benefits of Option 1

  • It will survive updates
  • Does not require modification of the registry

Benefits of Option 1.5

  • It will survive updates but will maintain the default installation path if policy dictates you do not install software on a different disk
  • Does not require modification of the registry

Benefits of Option 2

  • You are not beholden to a specific User account (install location) or a hard drive that isn’t large enough to handle the database

Considerations

  • Option 2 will not work for an in-place upgrade – In order to work around that, simply perform the first 3 steps in Option 2, then MOVE the Unifi installation folder back to the default path. Once that is complete, run the installer. Afterwards, perform the remaining steps and update as necessary.

You can use any or all of these options in multiple combinations to achieve whatever your need is. You can modify the registry to have the installation user-independent and ALSO create a symlink to have the database on a different disk/location.

Leave a Reply