{"id":793,"date":"2022-06-12T18:49:46","date_gmt":"2022-06-12T18:49:46","guid":{"rendered":"https:\/\/james-batchelor.com\/?p=793"},"modified":"2022-06-13T08:02:59","modified_gmt":"2022-06-13T08:02:59","slug":"add-unifi-controller-to-centos-7","status":"publish","type":"post","link":"https:\/\/james-batchelor.com\/index.php\/2022\/06\/12\/add-unifi-controller-to-centos-7\/","title":{"rendered":"Add Unifi Controller to CentOS 7"},"content":{"rendered":"\n<p>I&#8217;m in the process of testing a Unifi AP (Nano), and need a controller to set it up. As its a temporary setup I choose the old faithful CentOS 7&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-12-174145.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2411\" height=\"1190\" src=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-12-174145.png\" alt=\"\" class=\"wp-image-795\"\/><\/a><\/figure>\n\n\n\n<!--more-->\n\n\n\n<p>There are many excellent guides for setting up a Unifi Controller on CentOS 7, three that helped me:<\/p>\n\n\n\n<p><a href=\"https:\/\/community.spiceworks.com\/how_to\/128121-installing-unifi-controller-on-centos\">https:\/\/community.spiceworks.com\/how_to\/128121-installing-unifi-controller-on-centos<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/nivethan.dev\/devlog\/setting-up-unifi-controller-on-centos-7.html\">https:\/\/nivethan.dev\/devlog\/setting-up-unifi-controller-on-centos-7.html<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/binhminhitc.com\/networks-solutions\/how-to-installing-unifi-controller-on-centos\/\">https:\/\/binhminhitc.com\/networks-solutions\/how-to-installing-unifi-controller-on-centos\/<\/a><\/p>\n\n\n\n<p>However since these were penned there are a few changes in the setup that need to be worked around:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Workarounds<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">UniFi.unix.zip Download Link<\/h3>\n\n\n\n<p>Unifi have stopped advertising the Unix files on the downloads, instead opting to show only the .deb Debian package. To get a file suitable for CentOS&#8230;<\/p>\n\n\n\n<p>Navigate to <a href=\"https:\/\/www.ui.com\/download\/unifi\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.ui.com\/download\/unifi\/<\/a> and choose the download for Unifi Network Application for Debian:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1456\" height=\"319\" src=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/image.png\" alt=\"\" class=\"wp-image-796\"\/><\/a><\/figure>\n\n\n\n<p>Clicking download icon gives the following link&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1593\" height=\"470\" src=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/image-1.png\" alt=\"\" class=\"wp-image-797\"\/><\/a><\/figure>\n\n\n\n<p>Make note of the version number (here 7.1.66) and edit into the the following link:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.ubnt.com\/downloads\/unifi\/7.1.66\/UniFi.unix.zip\">https:\/\/www.ubnt.com\/downloads\/unifi\/7.1.66\/UniFi.unix.zip<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">MongoDB<\/h3>\n\n\n\n<p>MongoDB is no longer included in the default CentOS or EPEL repositories, so its own repository needs to be added to your system for prerequisites<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Source: <a rel=\"noreferrer noopener\" href=\"https:\/\/www.mongodb.com\/docs\/manual\/tutorial\/install-mongodb-on-red-hat\/#install-mongodb-community-edition\" target=\"_blank\">https:\/\/www.mongodb.com\/docs\/manual\/tutorial\/install-mongodb-on-red-hat\/#install-mongodb-community-edition<\/a><\/p><\/blockquote>\n\n\n\n<p>Create a new file at \/etc\/yum.repos.d\/mongodb-org-5.0.repo<\/p>\n\n\n\n<p>Insert the following into the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mongodb-org-5.0]name=MongoDB Repositorybaseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/5.0\/x86_64\/gpgcheck=1enabled=1gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-5.0.asc<\/code><\/pre>\n\n\n\n<p>Installation is now via: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install -y mongodb-org<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"> Installation Guide<\/h2>\n\n\n\n<p>Disable SELinux, reboot for changes to take effect<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed -i \/etc\/selinux\/config -r -e 's\/^SELINUX=.*\/SELINUX=disabled\/g'\nreboot<\/code><\/pre>\n\n\n\n<p>Create file to include MongoDB repositories<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/yum.repos.d\/mongodb-org-5.0.repo<\/code><\/pre>\n\n\n\n<p>Add the following to the new file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> &#91;mongodb-org-5.0]name=MongoDB Repositorybaseurl=https:\/\/repo.mongodb.org\/yum\/redhat\/$releasever\/mongodb-org\/5.0\/x86_64\/gpgcheck=1enabled=1gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-5.0.asc <\/code><\/pre>\n\n\n\n<p>Install prerequisites<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install -y mongodb-org java-1.8.0-openjdk unzip wget<\/code><\/pre>\n\n\n\n<p>Download Unifi Controller<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/www.ubnt.com\/downloads\/unifi\/7.1.66\/UniFi.unix.zip<\/code><\/pre>\n\n\n\n<p>Unzip files to \/opt directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip -q UniFi.unix.zip -d \/opt<\/code><\/pre>\n\n\n\n<p>Create data folder within Unifi directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir \/opt\/UniFi\/data<\/code><\/pre>\n\n\n\n<p>Add new user to run service<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>useradd -r ubnt<\/code><\/pre>\n\n\n\n<p>Assign ubnt ownership of Unifi directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chown -R ubnt:ubnt \/opt\/UniFi<\/code><\/pre>\n\n\n\n<p>Create firewall rules to allow access to Controller<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/firewalld\/zones\/public.xml<\/code><\/pre>\n\n\n\n<p>Add the following to the file&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  &lt;port protocol=\"tcp\" port=\"8081\"\/&gt;\n  &lt;port protocol=\"tcp\" port=\"8080\"\/&gt;\n  &lt;port protocol=\"tcp\" port=\"8443\"\/&gt;\n  &lt;port protocol=\"tcp\" port=\"8880\"\/&gt;\n  &lt;port protocol=\"tcp\" port=\"8843\"\/&gt;\n  &lt;port protocol=\"tcp\" port=\"27117\"\/&gt;\n  &lt;port protocol=\"udp\" port=\"3478\"\/&gt;<\/code><\/pre>\n\n\n\n<p>Reload firewall for changes to take<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>firewall-cmd --reload<\/code><\/pre>\n\n\n\n<p>Enable MongoDB to start with the system, start it for first time and check its running<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable mongod\nsystemctl start mongod\nsystemctl status mongod<\/code><\/pre>\n\n\n\n<p>Create the service for Unfi Controller<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/systemd\/system\/unifi.service<\/code><\/pre>\n\n\n\n<p>Enter the following in the new file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=UniFi AP Web Controller\nAfter=syslog.target network.target\n\n&#91;Service]\nType=simple\nUser=ubnt\nWorkingDirectory=\/opt\/UniFi\nExecStart=\/usr\/bin\/java -jar \/opt\/UniFi\/lib\/ace.jar start \nExecStop=\/usr\/bin\/java -jar \/opt\/UniFi\/lib\/ace.jar stop\nSuccessExitStatus=143\n\n&#91;Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<p>Enable Controller to start with system<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl enable unifi<\/code><\/pre>\n\n\n\n<p>Start the Unifi Controller<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start unifi<\/code><\/pre>\n\n\n\n<p>Controller should now be available for setup by browsing to <br>https:\/\/{IP ADDRESS}:8443\/<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Unifi Testing<\/h2>\n\n\n\n<p>I need the Unifi Controller in order to test the Nano HD AP, why? This is the only Unifi AP in stock in the UK at the moment, all other more preferred AP&#8217;s like the Pro, LR and HD are unobtainium along with the Cloud Key. Therefore in desperation its time to test if these will make a worthy substitute.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/20220610_131523.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"2169\" height=\"1627\" src=\"https:\/\/james-batchelor.com\/wp-content\/uploads\/2022\/06\/20220610_131523.jpg\" alt=\"\" class=\"wp-image-802\"\/><\/a><\/figure>\n\n\n\n<p>Its early days at present, but should testing go well and I choose to adopt Unifi as my home Wifi solution, I&#8217;d be deploying a slim VM running Rocky 8 to manage the infrastructure. <\/p>\n\n\n\n<p>So far for testing; the AP is positioned a foot away from a Draytek 2927ac, at moderate distances the Unifi Nano is showing a 10db advantage over the Draytek on 2.4Ghz range, but curiously a 10db disadvantage on the 5Ghz range. And while devices report a better signal strength on the Unifi, bandwidth speed tests yield poor results.<\/p>\n\n\n\n<p>I would hope that the Pro&#8217;s performance would be an improvement on the Nano, but for now that is entirely speculation since getting hands on one is impossible without paying scalper prices.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m in the process of testing a Unifi AP (Nano), and need a controller to set it up. As its a temporary setup I choose the old faithful CentOS 7&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[280,212],"tags":[264,341,265,342,344,345,339,340,343,337],"class_list":["post-793","post","type-post","status-publish","format-standard","hentry","category-cent-os","category-network","tag-cent-os","tag-cent-os-7","tag-centos","tag-centos7","tag-cloud-key","tag-ubiquiti","tag-unifi","tag-unifi-controller","tag-unifi-hd-nano","tag-vm"],"_links":{"self":[{"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/posts\/793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/comments?post=793"}],"version-history":[{"count":8,"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/posts\/793\/revisions"}],"predecessor-version":[{"id":805,"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/posts\/793\/revisions\/805"}],"wp:attachment":[{"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/media?parent=793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/categories?post=793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/james-batchelor.com\/index.php\/wp-json\/wp\/v2\/tags?post=793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}