{"id":331,"date":"2023-10-30T14:39:17","date_gmt":"2023-10-30T14:39:17","guid":{"rendered":"https:\/\/bene.webtopia.ch\/?p=331"},"modified":"2023-10-30T15:03:17","modified_gmt":"2023-10-30T15:03:17","slug":"updating-and-installing-self-hosted-unifi-network-servers-linux","status":"publish","type":"post","link":"https:\/\/bene.webtopia.ch\/?p=331","title":{"rendered":"Updating and Installing Self-Hosted UniFi Network Servers (Linux)"},"content":{"rendered":"<p>This article provides the steps to install and update the self-hosted UniFi Network Server to the current stable release on a Debian or Ubuntu system via APT (Advanced Package Tool). If you run into issues following the process described in this article, please take a look at the scripts provided <a href=\"https:\/\/community.ui.com\/questions\/ccbc7530-dd61-40a7-82ec-22b17f027776\">here<\/a> to install and update the UniFi Network Application.<\/p>\n<h2 id=\"0\">Requirements<\/h2>\n<p>In order to update the UniFi Network Server via APT, it is necessary to create source files or edit lines in an existing <strong>sources.list<\/strong> file with Linux text editors: <strong>vi<\/strong> or <strong>nano<\/strong>. The repo structure should be permanent, but if there are any changes, they will be pointed out in the UniFi Network software version release posts, found in the <a href=\"https:\/\/community.ui.com\/releases\" target=\"_blank\" rel=\"noopener\">Release<\/a> section of the Community.<\/p>\n<p>Before upgrading the UniFi Network Server, make sure that you have backed up the UniFi Network Database. You will need to make sure that the user has <strong>sudo permissions. <\/strong>For more information about adding a user to <strong>sudo list<\/strong>, see <a href=\"https:\/\/wiki.debian.org\/sudo\">this Debian article.<\/a><\/p>\n<h2 id=\"1\">UniFi Network APT Steps<\/h2>\n<p><em>See an example of what scripts the UI Community is using to install and update the UniFi Network Server on any Ubuntu or Debian-based system in<a href=\"https:\/\/community.ui.com\/questions\/ccbc7530-dd61-40a7-82ec-22b17f027776\"> this Community post<\/a>.<\/em><\/p>\n<ol>\n<li>Install required packages before you begin with the following command:\n<pre>sudo apt-get update &amp;&amp; sudo apt-get install ca-certificates apt-transport-https<\/pre>\n<\/li>\n<li>Use the following command to add a new source list:\n<pre>echo 'deb [ arch=amd64 ] https:\/\/www.ui.com\/downloads\/unifi\/debian stable ubiquiti' | sudo \r\ntee \/etc\/apt\/sources.list.d\/100-ubnt-unifi.list<\/pre>\n<\/li>\n<li>Add the GPG Keys.\n<ol>\n<li><strong>Method A &#8211; Recommended<\/strong>\n<ol>\n<li>Install the following trusted key into <code>\/etc\/apt\/trusted.gpg.d<\/code>\n<pre>sudo wget -O \/etc\/apt\/trusted.gpg.d\/unifi-repo.gpg https:\/\/dl.ui.com\/unifi\/unifi-repo.gpg<\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<li>&nbsp;<strong>Method B<\/strong>\n<ol>\n<li>Using apt-key:\n<pre>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50<\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<li>For a new UniFi Network Server, install MongoDB. For Ubuntu 22.04, run the commands below. If you&#8217;re updating the UniFi Network Server to version 7.5, ignore these commands and instead refer to MongoDB&#8217;s <a href=\"https:\/\/www.mongodb.com\/docs\/manual\/release-notes\/3.6-upgrade-standalone\/\">help article<\/a> to update your database to the <strong>required MongoDB version 3.6<\/strong>.\n<pre>wget -qO - https:\/\/www.mongodb.org\/static\/pgp\/server-3.6.asc | sudo apt-key add -\r\necho \"deb https:\/\/repo.mongodb.org\/apt\/ubuntu bionic\/mongodb-org\/3.6 multiverse\" | sudo tee \/etc\/apt\/\r\nsources.list.d\/mongodb-org-3.6.list\r\nsudo apt-get update<\/pre>\n<p><em>This step may not be required, depending on the Linux distro you have. If your distro does not come with MongoDB, and it&#8217;s not available in their repo, then please see the MongoDB installation guide (<a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/install-mongodb-on-ubuntu\/\" target=\"_blank\" rel=\"noopener noreferrer\">Ubuntu<\/a> | <a href=\"https:\/\/docs.mongodb.com\/v3.6\/tutorial\/install-mongodb-on-debian\/\" target=\"_blank\" rel=\"noopener noreferrer\">Debian<\/a>).&nbsp;<\/em><\/li>\n<li>Install and upgrade the UniFi Network application with the following command:\n<pre>sudo apt-get update &amp;&amp; sudo apt-get install unifi -y<\/pre>\n<\/li>\n<li>The UniFi Network application should now be accessible at the computer&#8217;s configured local or public IP address, by typing that IP address in a browser&#8217;s navigation bar (Chrome is recommended). If it is not launching, use the following command:<br \/>\nsudo service unifi start<\/li>\n<\/ol>\n<p><em>When using the commands above, it is assumed you have <code>sudo<\/code> and <code>wget<\/code> installed. More information about <code>sudo<\/code> can be found <a href=\"https:\/\/wiki.debian.org\/sudo\" target=\"_blank\" rel=\"noopener\">here<\/a>, and <code>wget<\/code><a href=\"https:\/\/wiki.debian.org\/wget\" target=\"_blank\" rel=\"noopener\"> here<\/a>.<\/em><\/p>\n<h2 id=\"2\">&nbsp;<\/h2>\n<h2 id=\"3\">Other Helpful Commands<\/h2>\n<ul>\n<li>To stop the UniFi service:&nbsp;<code>sudo service unifi stop<\/code><\/li>\n<li>To restart the UniFi service:&nbsp;<code>sudo service unifi restart<\/code><\/li>\n<li>To see the status of UniFi service:&nbsp;<code>sudo service unifi status<\/code><\/li>\n<\/ul>\n<div class=\"collapsible\">\n<div class=\"collapsible--header\">Click here for possible suite names and code names.<\/div>\n<\/div>\n<h2 id=\"4\">Log Files Location<\/h2>\n<p>Log files are essential for any troubleshooting. Find them here:<\/p>\n<ul>\n<li>\/usr\/lib\/unifi\/logs\/server.log<\/li>\n<li>\/usr\/lib\/unifi\/logs\/mongod.log<\/li>\n<\/ul>\n<p>If your application is running on a Unix\/Linux based system, then you will require superuser (sudo) privileges to access these log files.<\/p>\n<h2 id=\"5\">Notes and Tips<\/h2>\n<div class=\"collapsible\">\n<div class=\"collapsible--header rotate\">These notes have been added thanks to user collaboration. Click to expand.<\/div>\n<div class=\"collapsible--body active\">\n<ul>\n<li><a href=\"https:\/\/community.ui.com\/questions\/UniFi-Installation-Scripts-or-UniFi-Easy-Update-Script-or-UniFi-Lets-Encrypt-or-Ubuntu-16-04-18-04-\/ccbc7530-dd61-40a7-82ec-22b17f027776\" target=\"_blank\" rel=\"noopener\">This Community post<\/a> <span data-preserver-spaces=\"true\">shares some scripts to install and update the UniFi Network Application for any recent Ubuntu or Debian version.<\/span><\/li>\n<li>If you are installing in a VM or a headless server, you may encounter entropy issues. This could be anything from slow service start\/restart to complete service failure. The fix is to install <code>haveged<\/code>. This is an external link for a <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-setup-additional-entropy-for-cloud-servers-using-haveged\" target=\"_blank\" rel=\"noopener\">tutorial<\/a> on the subject.<\/li>\n<li>Since UniFi Network version 5.6.x the UniFi service does not run as root. This means that you cannot bind to privileged ports (&lt;1024). The application will fail to start if you try to use these ports.&nbsp;<\/li>\n<li>The following affects APT versions 1.5 onward (Ubuntu 17.10 and Debian Sid or newer). A recent version of the <a href=\"https:\/\/manpages.debian.org\/unstable\/apt\/apt-secure.8.en.html\" target=\"_blank\" rel=\"noopener\">apt-secure man page<\/a> stated: &#8222;<em>Since version 1.5 changes in the information contained in the Release file about the repository need to be confirmed before APT continues to apply updates from this repository&#8220;, <\/em>meaning that when performing an update from a major version to the next (for example 5.5.x to 5.6.x) the <code>apt-get update<\/code> will result in an error.\n<ul>\n<li>To fix this run the command the following way:&nbsp;<code>apt-get update --allow-releaseinfo-change<\/code><\/li>\n<li>If you receive an error stating the command <em>is not understood in combination with the other options,<\/em> users have reported that issuing the following two commands has fixed it: issue&nbsp;<code>apt clean<\/code> and hit enter, followed by&nbsp;<code>apt-get update<\/code>&nbsp;and enter.<\/li>\n<\/ul>\n<\/li>\n<li>The UniFi Network application, when installed on Debian and Ubuntu, will not have a GUI since it&#8217;s being run as a Service. Please use the service command for starting, stopping and restarting the UniFi Network application.<\/li>\n<li>If you see the following error on your DNS server, a user reports solving this by forcing the system to use 8.8.8.8 as DNS server, not his ISP.<\/li>\n<li>At the moment Ubiquiti does not support arm64, hence it is not available via the repo. A download and manual installation will be necessary for this.<\/li>\n<li>In the&nbsp;<strong>Add the GPG Keys, method B:&nbsp;<\/strong><a href=\"https:\/\/superuser.com\/questions\/64922\/how-to-work-around-blocked-outbound-hkp-port-for-apt-keys\" target=\"_blank\" rel=\"noopener\">Source: External Link<\/a>. For users behind restrictive firewalls the following command will allow them to import the GPG key:\n<div class=\"node--head\">\n<p dir=\"auto\"><code>apt-key adv --keyserver hkp:\/\/keyserver.ubuntu.com:80 --recv 06E85760C0A52C50<\/code><\/p>\n<\/div>\n<\/li>\n<li>Because of the Java 8 dependency, when using UniFi Network 5.7.X some additional steps might be needed. See <a href=\"https:\/\/community.ui.com\/questions\/UVC-NVR-and-JDK-1-8\/3a821d41-c788-4c30-898a-5d739315413c#answer\/054bee5d-f2ee-4b0e-998d-2f39d0191524\" target=\"_blank\" rel=\"noopener\">this Community post<\/a>&nbsp;for details.<a name=\"apt\"><\/a><\/li>\n<li>The command&nbsp;<code>apt-get<\/code> is&nbsp;<code>apt<\/code>&nbsp;in Ubuntu older than 16.04.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article provides the steps to install and update the self-hosted UniFi Network Server to the current stable release on a Debian or Ubuntu system via APT (Advanced Package Tool). If you run into issues following the process described in this article, please take a look at the scripts provided here to install and update [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[17],"tags":[],"class_list":["post-331","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=\/wp\/v2\/posts\/331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=331"}],"version-history":[{"count":3,"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=\/wp\/v2\/posts\/331\/revisions"}],"predecessor-version":[{"id":343,"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=\/wp\/v2\/posts\/331\/revisions\/343"}],"wp:attachment":[{"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bene.webtopia.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}