-
Star
(190)
You must be signed in to star a gist -
Fork
(46)
You must be signed in to fork a gist
-
-
Save davecoutts/5ccb403c3d90fcf9c8c4b1ea7616948d to your computer and use it in GitHub Desktop.
# Install Ubiquiti Unifi Controller on Ubuntu 20.04. | |
# As tested on a fresh install of ubuntu-20.04.1-live-server, August 22nd 2020. | |
# Thanks to https://gist.github.com/tmuncks for posting the updated install steps. | |
sudo apt update | |
sudo apt install --yes apt-transport-https | |
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list | |
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg | |
sudo apt update | |
sudo apt install --yes openjdk-8-jre-headless unifi | |
sudo apt clean | |
sudo systemctl status --no-pager --full mongodb.service unifi.service | |
# Now log into https://unifi_controller_hostname:8443/ | |
## ------------------------------------------------------------------------------------------------------------------------ | |
## Previous install steps from when unifi still required mongodb-server <= 3.4. | |
## unifi has since been updated to work with mongodb-server 3.6. Which is available from the Ubuntu 20.04 main repository. | |
## ------------------------------------------------------------------------------------------------------------------------ | |
# | |
# sudo apt install --yes ca-certificates apt-transport-https | |
# echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list | |
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50 | |
# wget -qO - https://www.mongodb.org/static/pgp/server-3.4.asc | sudo apt-key add - | |
# echo 'deb https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list | |
# sudo apt-mark hold openjdk-11-* | |
# sudo apt update | |
# # mongodb 3.4 dependency | |
# wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb -P /tmp | |
# sudo apt install --yes /tmp/libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb | |
# rm /tmp/libssl1.0.0_1.0.2n-1ubuntu5.3_amd64.deb | |
# sudo apt install --yes mongodb-org | |
# sudo apt install --yes unifi |
Thanks for this - got me pointed in the right direction with install - had to edit JRE path before unifi service successfully launched - see here:
This is still required using Ubuntu 20.04-2.
This also works on my configuration of 18.04. Thanks so much!
5.4.0-77-generic #86~18.04.1-Ubuntu
On a Raspberry Pi 4 (arm64), I needed to modify one line:
echo 'deb [arch=armhf] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
Works perfectly. Tried on Ubuntu 20.04.02
Does not work (anymore) as it currently fails a mongodb dependency check unfortunately.
I'm working with Ubuntu 21.04, that is probably the problem. Manually installed Mongo but unifi keeps nagging about it missing no matter what I do.
Does not work (anymore) as it currently fails a mongodb dependency check unfortunately.
I'm working with Ubuntu 21.04, that is probably the problem. Manually installed Mongo but unifi keeps nagging about it missing no matter what I do.
I did this on Ubuntu Server 21.04 on arm64 RPi4b, works fine, mongodb 3.6.3 gets installed:
1. Add Unifi source list:
echo 'deb [arch=armhf] https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list
2. Add Unifi GPG keys:
sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
3. Add MongoDB GPG keys:
wget -qO - https://www.mongodb.org/static/pgp/server-3.6.asc | sudo apt-key add -
4. Add MongoDB source list:
echo "deb https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt update
5. Add Ubuntu Server 18.04 sources:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig
sudo vi /etc/apt/sources.list
# Ubuntu Server 18.04 sources
deb http://ports.ubuntu.com/ubuntu-ports bionic main restricted
deb http://ports.ubuntu.com/ubuntu-ports bionic-updates main restricted
deb http://ports.ubuntu.com/ubuntu-ports bionic universe
deb http://ports.ubuntu.com/ubuntu-ports bionic-updates universe
deb http://ports.ubuntu.com/ubuntu-ports bionic multiverse
deb http://ports.ubuntu.com/ubuntu-ports bionic-updates multiverse
deb http://ports.ubuntu.com/ubuntu-ports bionic-backports main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports bionic-security main restricted
deb http://ports.ubuntu.com/ubuntu-ports bionic-security universe
deb http://ports.ubuntu.com/ubuntu-ports bionic-security multiverse
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
sudo apt update
6. Install Unifi Controller:
sudo apt install -f unifi
I used the pre-installed Raspberry Pi image for Ubuntu 21.04, maybe there is a difference there? Otherwise I cannot explain why it did not work out for me. I've moved to the LinuxServer docker container with Unifi.
I used the pre-installed Raspberry Pi image for Ubuntu 21.04, maybe there is a difference there? Otherwise I cannot explain why it did not work out for me. I've moved to the LinuxServer docker container with Unifi.
Not sure what went wrong, but I used this image for installation: ubuntu-21.04-preinstalled-server-arm64+raspi.img.xz
Then did what's above, twice already, no problem at all. :)
For me, this is all that was needed on a clean 20.04 install:
sudo apt-get update sudo apt-get install --yes ca-certificates apt-transport-https wget echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg sudo apt update sudo apt install --yes openjdk-8-jre-headless unifi
Jupp thanks man. This worked flawlessly.
I have followed these steps but can seem to access the Unifi console. When I check the unifi.service status bellow is the output.
● unifi.service - unifi
Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-10-01 23:04:39 CDT; 3min 13s ago
Process: 1001 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS)
Main PID: 1196 (jsvc)
Tasks: 37 (limit: 43313)
Memory: 313.0M
CGroup: /system.slice/unifi.service
├─1196 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-amd64 -cp /usr/share/java/commo>
├─1199 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-amd64 -cp /usr/share/java/commo>
└─1200 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-amd64 -cp /usr/share/java/commo>
Oct 01 23:03:36 dvr1 systemd[1]: Starting unifi...
Oct 01 23:03:36 dvr1 unifi.init[1001]: * Starting Ubiquiti UniFi Controller unifi
Oct 01 23:04:39 dvr1 unifi.init[1001]: ...fail!
Oct 01 23:04:39 dvr1 systemd[1]: Started unifi.
lines 1-16/16 (END)
The third line up from the bottom is the one that has me worried. I have tried looking online for a solution, but have come up empty handed.
Also, when I check the open ports with sudo lsof -nP -iTCP -sTCP:LISTEN
I don't see where the port 8443 is listening and open. I do not have UFW active. I have not had an issue with getting portainer and cockpit running. Those ports are shown listening when I ran the above command.
I have followed these steps but can seem to access the Unifi console. When I check the unifi.service status bellow is the output. ● unifi.service - unifi Loaded: loaded (/lib/systemd/system/unifi.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2021-10-01 23:04:39 CDT; 3min 13s ago Process: 1001 ExecStart=/usr/lib/unifi/bin/unifi.init start (code=exited, status=0/SUCCESS) Main PID: 1196 (jsvc) Tasks: 37 (limit: 43313) Memory: 313.0M CGroup: /system.slice/unifi.service ├─1196 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-amd64 -cp /usr/share/java/commo> ├─1199 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-amd64 -cp /usr/share/java/commo> └─1200 unifi -cwd /usr/lib/unifi -home /usr/lib/jvm/java-8-openjdk-amd64 -cp /usr/share/java/commo>
Oct 01 23:03:36 dvr1 systemd[1]: Starting unifi... Oct 01 23:03:36 dvr1 unifi.init[1001]: * Starting Ubiquiti UniFi Controller unifi Oct 01 23:04:39 dvr1 unifi.init[1001]: ...fail! Oct 01 23:04:39 dvr1 systemd[1]: Started unifi. lines 1-16/16 (END)
The third line up from the bottom is the one that has me worried. I have tried looking online for a solution, but have come up empty handed. Also, when I check the open ports with
sudo lsof -nP -iTCP -sTCP:LISTEN
I don't see where the port 8443 is listening and open. I do not have UFW active. I have not had an issue with getting portainer and cockpit running. Those ports are shown listening when I ran the above command.
Same problem here. After enforcing some debugging in /etc/init.d/unifi
I get a lot of Java-Output and this line:
[...] main ERROR Unable to create file logs/server.log java.io.IOException: Could not create directory /logs
Any ideas anybody? The logging paths semm to be set up correctly. Why is it trying to create that directory? /var/log/unifi
is present and writable by the user in question. Some more debugging data:
OS: Ubuntu Server 20.04.3 LTS (focal)
+-- DUMPING PARSED COMMAND LINE ARGUMENTS --------------
| Detach: True
| Show Version: No
| Show Help: No
| Check Only: Disabled
| Stop: False
| Wait: 0
| Run as service: No
| Install service: No
| Remove service: No
| JVM Name: "null"
| Java Home: "/usr/lib/jvm/java-8-openjdk-amd64"
| PID File: "/var/run/unifi.pid"
| User Name: "unifi"
| Extra Options: 8
| "-Djava.class.path=/usr/share/java/commons-daemon.jar:/usr/lib/unifi/lib/ace.jar"
| "-Dunifi.datadir=/var/lib/unifi"
| "-Dunifi.logdir=/var/log/unifi"
| "-Dunifi.rundir=/var/run/unifi"
| "-Dunifi.core.enabled=false"
| "-Xmx1024M"
| "-Djava.awt.headless=true"
| "-Dfile.encoding=UTF-8"
| Class Invoked: "com.ubnt.ace.Launcher"
| Class Arguments: 1
| "start"
+-------------------------------------------------------
Thank you!
I got the Unifi application running. I uninstalled the Unifi application. Then I ran the script found HERE.
Be sure you are running the latest script. You have to scroll down and copy the link from further down in the post. Below is the command you need to run. Refer to the post linked above for the most current information.
apt-get update; apt-get install ca-certificates wget -y
wget https://get.glennr.nl/unifi/install/unifi-6.4.54.sh
bash unifi-6.4.54.sh
Oct 01 23:03:36 dvr1 systemd[1]: Starting unifi... Oct 01 23:03:36 dvr1 unifi.init[1001]: * Starting Ubiquiti UniFi Controller unifi Oct 01 23:04:39 dvr1 unifi.init[1001]: ...fail! Oct 01 23:04:39 dvr1 systemd[1]: Started unifi. lines 1-16/16 (END)
Same problem here. After enforcing some debugging in
/etc/init.d/unifi
I get a lot of Java-Output and this line:
Also had the same problem . I ran the first Java process shown when looking at the systemd status and had the following output:
¡ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Dapple.awt.UIElement=true -Dunifi.core.enabled=false -Xmx1024M -XX:+ExitOnOutOfMemoryError -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/usr/lib/unifi/logs/hs_err_pid%p.log -jar /usr/lib/unifi/lib/ace.jar start
WARN Unable to load properties from '/usr/lib/unifi/data/system.properties' - /usr/lib/unifi/data/system.properties (Permission denied)
Port 8080 not available
Turns out I had something running on port 8080 and apparently this needs it as well. I moved the other service and restarted unifi with sudo service unifi restart
and I'm up and running now. Installed through the UniFi apt repo.
I followed this and found I also had to install openjdk-8-jdk to get it running. Thanks for putting this together - it helped greatly.
Hi, thank you for your feedback. It turned out to be my own fault, because I had set the parameter unifi.https.port=443
without granting the permission to bind to a privileged port. The IOExceptions are still there but unifi works fine anyway ...
How do you get MongoDB 3.6.x installed on Ubuntu 20.x? MongoDB < 4.x is EOL. Is it just a matter of adding the 3.6 repo?
Hi @USMA56795
If you run apt install --dry-run mongodb-server
it will simulate installing mongodb-server and show you the version that would have been installed.
You should find that mongodb-server version 3.6.9 is the current default version for Ubuntu 20.04.3 LTS.
Equally you can check package versions and dependencies with the apt-cache
command, as per the examples below.
You will see that the current unifi package has a mongodb-server version dependency of >= 2.4.10 << 4.0.0
uni01:~$ lsb_release -d
Description: Ubuntu 20.04.3 LTS
uni01:~$ apt-cache policy mongodb-server
mongodb-server:
Installed: 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3
Candidate: 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3
Version table:
*** 1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3 500
500 http://gb.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages
500 http://gb.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages
100 /var/lib/dpkg/status
1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5 500
500 http://gb.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
uni01:~$ apt-cache show unifi
Package: unifi
Version: 6.4.54-16067-1
Architecture: all
Depends: binutils, coreutils, adduser, libcap2, curl,
mongodb-server (>= 2.4.10) | mongodb-10gen (>= 2.4.14) | mongodb-org-server (>= 2.6.0),
mongodb-server (<< 1:4.0.0) | mongodb-10gen (<< 4.0.0) | mongodb-org-server (<< 4.0.0),
java8-runtime-headless | java11-runtime-headless, jsvc (>=1.0.8), logrotate
Pre-Depends: debconf (>= 0.5) | debconf-2.0
Conflicts: unifi-controller
Provides: unifi-controller
Replaces: unifi-controller
Installed-Size: 225095
Thanks so much for the detailed reply @davecoutts. This is exactly the help I needed.
Thanks for this! Also- how can I tell which version (unifi version) installed via CLI? (I cant access the webui yet since I need to wait for a pause in production)
Running either of the commands below on the server unifi is installed on should give you the version information.
Version reported by the installed unifi package meta data.
uni01:~$ dpkg -s unifi | grep -i version
Version: 6.4.54-16067-1
Version reported by the running unifi web server API interface.
uni01:~$ curl -ks https://localhost:8443/status | python3 -m json.tool
{
"meta": {
"rc": "ok",
"up": true,
"server_version": "6.4.54",
"uuid": "53023d6c-06fd-4ef3-86a5-fad7dafcf280"
},
"data": []
}
thank you it works.
Any help in linking digital ocean with unifi
For those wanting to allow all the ports used by the controller from UI's Documentation, the below adds every port except for the ports used by AP-EDU broadcasting. you might also want to ad an explicit ssh-over-tcp rule with sudo ufw allow 22/tcp
.
sudo ufw enable
sudo ufw allow 3478/udp
sudo ufw allow 5514/udp
sudo ufw allow 8080/tcp
sudo ufw allow 8443/tcp
sudo ufw allow 8880/tcp
sudo ufw allow 8843/tcp
sudo ufw allow 6789/tcp
sudo ufw allow 27117/tcp
sudo ufw allow 10001/udp
sudo ufw allow 1900/udp
sudo service unifi restart
For me, this is all that was needed on a clean 20.04 install:
sudo apt-get update sudo apt-get install --yes ca-certificates apt-transport-https wget echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list sudo wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg sudo apt update sudo apt install --yes openjdk-8-jre-headless unifi
Jupp thanks man. This worked flawlessly.
@RocketLR Thanks for these simple instructions. It worked perfectly for me as well. Cheers! 👍
Yes, thank you for this! I love Debian, but I wasted over an hour fighting with Debian 11 and mongodb versions and other apt problems; I lost. This just works, I installed at Unifi version 7.1.66. I spun up an Ubuntu 20.04 Linux container in Proxmox, updated and (since I was logged in as root, removed sudo, and I like to type Y so):
apt-get install ca-certificates apt-transport-https wget
echo 'deb https://www.ui.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/100-ubnt-unifi.list
wget -O /etc/apt/trusted.gpg.d/unifi-repo.gpg https://dl.ui.com/unifi/unifi-repo.gpg
apt update
apt install openjdk-8-jre-headless unifi
Thanks Dave and everyone.
@lamixer you are welcome.
I feel your dependency hell pain.
The software stack versions for unifi are starting to become a problem with newer operating systems.
The issues I have found are,
- mongodb has been dropped from the stable Debian and Ubuntu repositories.
- unifi requires mongodb 3.x, which requires libssl1.1, which Ubuntu 22.04 depreciated in favor of libssl3.
- Debian stable has dropped openjdk 8. unifi dependencies states it can use openjdk 11. Yet unifi fails to run without modifying the openjdk 11 installation.
I do hope Ubiquity is planning to update unifi to make it easier to install on current Linux operating systems.
If you would like to try Debian again I found that the following install steps worked on Debian 10 and 11.
# unifi 7 Debian 10 & 11 installation.
#
# https://gist.github.com/davecoutts
#
# mongodb installed from www.mongodb.org
sudo apt update
sudo apt install --yes gnupg wget haveged
# unifi repository
wget -qO- https://dl.ui.com/unifi/unifi-repo.gpg \
| sudo tee /usr/share/keyrings/unifi-archive-keyring.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/unifi-archive-keyring.gpg] \
https://www.ui.com/downloads/unifi/debian stable ubiquiti" \
| sudo tee /etc/apt/sources.list.d/100-ubnt-unifi.list > /dev/null
# mongodb-org repository
wget -qO- https://www.mongodb.org/static/pgp/server-3.6.asc \
| sudo gpg --dearmor -o /usr/share/keyrings/mongodb-org-server-3.6-archive-keyring.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/mongodb-org-server-3.6-archive-keyring.gpg] \
https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/3.6 multiverse" \
| sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list > /dev/null
# set JAVA_HOME environment variable for the unifi service
sudo mkdir /etc/systemd/system/unifi.service.d
printf "[Service]\nEnvironment=\"JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64\"\n" \
| sudo tee /etc/systemd/system/unifi.service.d/10-override.conf > /dev/null
# Install openjdk 11
sudo apt update
sudo apt install --yes openjdk-11-jre-headless
# Workaround issue where jsvc expects to find libjvm.so at lib/amd64/server/libjvm.so
sudo ln -s /usr/lib/jvm/java-11-openjdk-amd64/lib/ /usr/lib/jvm/java-11-openjdk-amd64/lib/amd64
# Install and enable mongodb 3.6
sudo apt install --yes mongodb-org-server
sudo systemctl enable mongod.service
sudo systemctl start mongod.service
# Install unifi
sudo apt install --yes unifi
sudo apt clean
# Post installation checks
systemctl status --no-pager --full mongod.service unifi.service
wget --no-check-certificate -qO- https://localhost:8443/status | python3 -m json.tool
sudo journalctl --no-pager --unit unifi.service
sudo cat /usr/lib/unifi/logs/server.log
sudo cat /usr/lib/unifi/logs/mongod.log
All - thank you for all the comments and discussion here.
With this post and some extra work, I was able to get Unifi working on Ubuntu Jammy on a Raspberry Pi arm64. Especially thanks to @dbosk for pointing to the armhf Unifi repo.
I wrote up a description and ansible role for those wanting a script and explainer of what worked for me.
what is default admin username and password of mongodb ?
Off the back of @ficematt using https://glennr.nl/s/unifi-network-controller make the process alot easier 👍
Just wanna thanks for your guide. Had some problems installing on Ubuntu 21.04 and switch to my Raspberry4 with Raspberry PI OS lite. Had to install ufw and open port 8443/tcp. Don't know if the last step was really necessary but it worked. Maybe I was too stupid and mixed up the IP. Now everything works like charm.