News:

Welcome to TFT!

Main Menu

How to run Unifi Controller as a Service in Windows

Started by Adventech, October 10, 2012, 09:32:40 AM

Previous topic - Next topic

Adventech

#5
*** UPDATED Sept 3 2023 ***

PROBLEM:
Ubiquiti UniFi Controller as a Service in Windows?
Ubiquiti UniFi Controller as a Service in Windows 2016 / 2019 / 2022?
Ubiquiti UniFi Controller as a Service in windows and connect to Cloud Access?
Self-Hosted UniFi Network Server as a Windows Service (Advanced)

SOLUTION:
Setting up a new UniFi Network application as a service in Windows.

Requirements:
The latest versions of the UniFi Network application (7.5 +) requires Java 17.
https://adoptium.net/download
The latest versions of the UniFi Network application (7.3 +) requires Java 11.
https://adoptium.net/download/
Previous versions (7.2 -) use Java 8.
Install only the x64 Java release and only one version of Java.

1. If a previous UniFi Network application is running on the system, download a backup file and then close the launcher.

2. Download the latest UniFi Network application from the Download page and run the setup.

3. You will be prompted to install Java 11. Select the following options and download the x64 .msi file for Windows:

Package Type: JRE
Version: 11 / 17

If the JAVA_HOME variable is not set correctly, the service installation will not be successful.
If you are experiencing issues with the Java 11 installer or the variable, then remove the other/older Java versions that are present on the system.
4. Run the install, and set the Set JAVA_HOME variable to Will be installed on local hard drive.

CLI: Open an administrative Windows Command Prompt (CMD) window.

5. Change the directory to the location of UniFi installation.
cd "%UserProfile%\Ubiquiti UniFi\"
6. Once in the root of the UniFi folder, run the following command to install the service:
java -jar lib\ace.jar installsvc
7. Wait for the installation to complete, indicated by the Complete Installation log message.

8. Start the service with the command below:
java -jar lib\ace.jar startsvc
9. Open a browser and navigate to the application's IP address or https://localhost:8443.

Upgrading an existing UniFi Network application as a service
1. Download a backup file of the UniFi Network application.

CLI: Open an administrative Windows Command Prompt (CMD) window.

2. Change the directory to the location of UniFi installation.
cd "%UserProfile%\Ubiquiti UniFi\"
3. Once in the root of the UniFi folder, issue the following to uninstall the service:
java -jar lib\ace.jar uninstallsvc
4. Wait for the service uninstall process to complete.

5. Follow step 2 to 9 from the section above.

SOURCES:
Ubiuiti Help Site - Updated on Sept 4, 2023
https://help.ui.com/hc/en-us/articles/4416276882327-How-to-Set-Up-UniFi
Adventech Group, Inc.
Bringing Integrity to Information Technology
https://adventech.net

Adventech

*** UPDATED 2023 ***

PROBLEM:
Ubiquiti UniFi Controller as a Service in Windows?
Ubiquiti UniFi Controller as a Service in Windows 2016?
Ubiquiti UniFi Controller as a Service in windows and connect to Cloud Access?
Self-Hosted UniFi Network Server as a Windows Service (Advanced)

SOLUTION:
Setting up a new UniFi Network application as a service in Windows.

Requirements:
The latest versions of the UniFi Network application (7.3) requires Java 11.
Previous versions (7.2) use Java 8.
Install only the x64 Java release and only one version of Java.

1. If a previous UniFi Network application is running on the system, download a backup file and then close the launcher.

2. Download the latest UniFi Network application from the Download page and run the setup.

3. You will be prompted to install Java 11. Select the following options and download the x64 .msi file for Windows:

Package Type: JRE
Version: 11

If the JAVA_HOME variable is not set correctly, the service installation will not be successful.
If you are experiencing issues with the Java 11 installer or the variable, then remove the other/older Java versions that are present on the system.
4. Run the install, and set the Set JAVA_HOME variable to Will be installed on local hard drive.

CLI: Open an administrative Windows Command Prompt (CMD) window.

5. Change the directory to the location of UniFi installation.
cd "%UserProfile%\Ubiquiti UniFi\"
6. Once in the root of the UniFi folder, run the following command to install the service:
java -jar lib\ace.jar installsvc
7. Wait for the installation to complete, indicated by the Complete Installation log message.

8. Start the service with the command below:
java -jar lib\ace.jar startsvc
9. Open a browser and navigate to the application's IP address or https://localhost:8443.

Upgrading an existing UniFi Network application as a service
1. Download a backup file of the UniFi Network application.

CLI: Open an administrative Windows Command Prompt (CMD) window.

2. Change the directory to the location of UniFi installation.
cd "%UserProfile%\Ubiquiti UniFi\"
3. Once in the root of the UniFi folder, issue the following to uninstall the service:
java -jar lib\ace.jar uninstallsvc
4. Wait for the service uninstall process to complete.

5. Follow step 2 to 9 from the section above.

SOURCES:
Ubiuiti Help Site - Updated on May 15, 2023
https://help.ui.com/hc/en-us/articles/205144550-Self-Hosted-UniFi-Network-Server-as-a-Windows-Service-Advanced-
Adventech Group, Inc.
Bringing Integrity to Information Technology
https://adventech.net

Adventech

*** UPDATED 2019 ***

PROBLEM:

Ubiquiti UniFi Controller as a Service in Windows?
Ubiquiti UniFi Controller as a Service in Windows 2016?
Ubiquiti UniFi Controller as a Service in windows and connect to Cloud Access?

SOLUTION:

1.) Close any instances of the UniFi software on the computer. If you just installed the UniFi controller, make sure to open it once by using the icon on the desktop or within the start menu. Once it says "UniFi Controller (a.b.c) started." you can close the controller program. This is needed to generate some required files for the service to work.

2.) Uninstall any current versions of Java x86 or Java x64. Install Java 64bit, version 8 here:
https://www.java.com/en/download/manual.jsp

3.) Remove the Java environmental path if you previously had it from an old install of UniFi as a Service.

4.) Open the command prompt as an Administrator. For example, on Windows 10, right click on the Start Menu and choose "Command Prompt (Admin)".

5.) Change directory to the location of UniFi in your computer using the following command (exactly as it is here, no substituting needed):

cd "%UserProfile%\Ubiquiti UniFi\"

6.) Once in the root of the UniFi folder, issue the following (this installs the UniFi Controller service):

java -jar lib\ace.jar installsvc

** UPDATE ** Windows 2016, you will need to the entire path for java.exe
"C:\Program Files\Java\jre1.8.0_211\bin\java.exe" -jar lib\ace.jar installsvc

7.) Once you're at a new command prompt line, after it says "Complete Installation...", issue the following:

net start unifi

8.) Close the command prompt window either by entering the "exit" command, or clicking the X.

9.) There is no longer a controller applet, like that other window that popped up. To access the controller you need to open your browser and go to https://localhost:8443. Alternatively you can use the desired interface IP, or FQDN that is mapped to that host (in place of "localhost").

Note: You will need to use Oracle Java JRE 8, which you can download HERE. For the UniFi cloud service (unifi.ubnt.com) to work, you need to use x64 Java only (so choose Windows x64 Offline). You can use either x86 or x64 Java for UniFi, but if you use x86 you cannot use the unifi.ubnt.com cloud tie in.

When upgrading the service, first perform step 2 and 3, then run "net stop unifi" (without quotes) to stop the old the service. After the update is complete, run "net start unifi" (without quotes) to start the service for the updated controller instance.
Adventech Group, Inc.
Bringing Integrity to Information Technology
https://adventech.net

Adventech

#2
*** UPDATED ***

PROBLEM:

Ubiquiti UniFi Controller as a Service in Windows?
Ubiquiti UniFi Controller as a Service in windows and connect to Cloud Access?

SOLUTION:

1.) Close any instances of the UniFi software on the computer. If you just installed the UniFi controller, make sure to open it once by using the icon on the desktop or within the start menu. Once it says "UniFi Controller (a.b.c) started." you can close the controller program. This is needed to generate some required files for the service to work.

2.) Uninstall any current versions of Java x86 or Java x64. Install Java 64bit, version 8 here:
https://www.java.com/en/download/manual.jsp

3.) Remove the Java environmental path if you previously had it from an old install of UniFi as a Service.

4.) Open the command prompt as an Administrator. For example, on Windows 10, right click on the Start Menu and choose "Command Prompt (Admin)".

5.) Change directory to the location of UniFi in your computer using the following command (exactly as it is here, no substituting needed):

cd "%UserProfile%\Ubiquiti UniFi\"

6.) Once in the root of the UniFi folder, issue the following (this installs the UniFi Controller service):

java -jar lib\ace.jar installsvc

7.) Once you're at a new command prompt line, after it says "Complete Installation...", issue the following:

net start unifi

8.) Close the command prompt window either by entering the "exit" command, or clicking the X.

9.) There is no longer a controller applet, like that other window that popped up. To access the controller you need to open your browser and go to https://localhost:8443. Alternatively you can use the desired interface IP, or FQDN that is mapped to that host (in place of "localhost").

Note: You will need to use Oracle Java JRE 8, which you can download HERE. For the UniFi cloud service (unifi.ubnt.com) to work, you need to use x64 Java only (so choose Windows x64 Offline). You can use either x86 or x64 Java for UniFi, but if you use x86 you cannot use the unifi.ubnt.com cloud tie in.

When upgrading the service, first perform step 2 and 3, then run "net stop unifi" (without quotes) to stop the old the service. After the update is complete, run "net start unifi" (without quotes) to start the service for the updated controller instance.
Adventech Group, Inc.
Bringing Integrity to Information Technology
https://adventech.net

Adventech

#1
PROBLEM:
How to run Unifi Controller as a Service in Windows 2008 R2 x64?

SOLUTION:
1.) Must be running version 2.2.0 or Higher.
2.) Make sure UniFi is not running by shutting down the application.
3.) locate your java installation directory. On 64-bit, at "C:\Program Files (x86)\Java\jre6\bin" or on 32-bit at "C:\Program Files\Java\jre6\bin"
4.) Add the directory above to the PATH varible in (Computer > Properties > Advanced system settings > Environment Variables).
5.) Run a command prompt (as an Administrator)
6.) cd <unifi_base>. Usually "C:\Users\<USERNAME>\Ubiquiti UniFi"
7.) java -jar lib\ace.jar installsvc
8.) net start Unifi
9.) Create Shortcut to the UniFi website (https://ipaddress:8443/)
10.) Change Icon on Shortcut to (%USERPROFILE%\Ubiquiti UniFi\unifi.ico)

NOTE: I attached the ICO for the UniFi Controller just incase.
Adventech Group, Inc.
Bringing Integrity to Information Technology
https://adventech.net