{"id":1707,"date":"2024-11-20T10:25:36","date_gmt":"2024-11-20T08:25:36","guid":{"rendered":"https:\/\/helia.ee\/koolitus\/?page_id=1707"},"modified":"2024-11-20T10:25:38","modified_gmt":"2024-11-20T08:25:38","slug":"how-to-update-your-unifi-controller-on-ubuntu","status":"publish","type":"page","link":"https:\/\/helia.ee\/koolitus\/?page_id=1707","title":{"rendered":"How to update your UniFi Controller on Ubuntu"},"content":{"rendered":"\n<p>Published onAugust 30, 2024by Iron&nbsp;(edited on&nbsp;November 20, 2024)<\/p>\n\n\n\n<p>Updating your&nbsp;<a href=\"https:\/\/www.ui.com\/download\/unifi\">UniFi Controller<\/a>&nbsp;on Ubuntu is one of those tasks that seems intimidating at first, but once you get the hang of it, it\u2019s pretty straightforward.<\/p>\n\n\n\n<p>Whether you\u2019re running a small home network or managing multiple sites, keeping your UniFi Controller up to date is crucial for ensuring security, stability, and access to the latest features.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-you-should-update-your-unifi-controller\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#why-you-should-update-your-unifi-controller\"><\/a>Why you should update your UniFi Controller<\/h2>\n\n\n\n<p>Before diving into the how, let\u2019s quickly chat about the why. Updating your UniFi Controller is important for a few key reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Security patches<\/strong>: Security vulnerabilities are an unfortunate reality of the tech world. Updates often include patches that protect your network from potential threats.<\/li>\n\n\n\n<li><strong>New features<\/strong>: Ubiquiti is constantly improving their software. Updates bring new features that can enhance how you manage your network.<\/li>\n\n\n\n<li><strong>Bug fixes<\/strong>: If you\u2019ve been experiencing glitches or issues, the latest update might have the fix you need.<\/li>\n<\/ul>\n\n\n\n<p>In short, regular updates keep your network secure, efficient, and running smoothly. Now, let\u2019s get into the nitty-gritty of updating your UniFi Controller on Ubuntu.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-1-prepare-your-system\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-1-prepare-your-system\"><\/a>Step 1: Prepare your system<\/h2>\n\n\n\n<p>Before we do anything, it\u2019s essential to make sure that your system is ready for the update. Here\u2019s what you need to do:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Backup your UniFi Controller<\/strong>: Always start with a backup. This is your safety net in case something goes wrong during the update process. You can back up your UniFi Controller data with the following command:<code>sudo mongodump --archive=\/var\/backups\/unifi_backup.archive <\/code>This command will create a backup file that you can restore if necessary. Store it somewhere safe\u2014better to be safe than sorry!<\/li>\n\n\n\n<li><strong>Check your current version<\/strong>: It\u2019s helpful to know what version you\u2019re currently running. You can find this by logging into your UniFi Controller dashboard and checking the version number in the lower-left corner.<\/li>\n\n\n\n<li><strong>SSH into your Ubuntu server<\/strong>: You\u2019ll need to access your server via SSH. Open your terminal and connect to your server using:<code>ssh username@your-server-ip <\/code>Replace &#8220;username&#8221; with your actual username and &#8220;your-server-ip&#8221; with the IP address of your server.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2-stop-the-unifi-service\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-2-stop-the-unifi-service\"><\/a>Step 2: Stop the UniFi service<\/h2>\n\n\n\n<p>Before starting the update, it\u2019s a good idea to stop the UniFi service. This helps to prevent any conflicts during the update process. Run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl stop unifi\n<\/code><\/pre>\n\n\n\n<p>This command will stop the UniFi service gracefully. You can check the status to confirm it\u2019s stopped by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status unifi\n<\/code><\/pre>\n\n\n\n<p>Make sure it says &#8220;inactive&#8221; before proceeding to the next step.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-3-add-the-ubiquiti-repository-if-not-already-added\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-3-add-the-ubiquiti-repository-if-not-already-added\"><\/a>Step 3: Add the Ubiquiti repository (if not already added)<\/h2>\n\n\n\n<p>If you\u2019ve updated your UniFi Controller before, you might have already added the Ubiquiti repository. If not, you\u2019ll need to add it now to ensure you\u2019re installing the latest version. Here\u2019s how:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Add the repository<\/strong>:<code>echo 'deb https:\/\/www.ui.com\/downloads\/unifi\/debian stable ubiquiti' | sudo tee \/etc\/apt\/sources.list.d\/100-ubnt.list<\/code><\/li>\n\n\n\n<li><strong>Add the GPG key<\/strong>:<code>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv C0A52C50<\/code><\/li>\n<\/ol>\n\n\n\n<p>This step ensures that your system can trust the packages you\u2019re about to install.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-4-update-the-package-list\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-4-update-the-package-list\"><\/a>Step 4: Update the package list<\/h2>\n\n\n\n<p>Now that the repository is set up, you need to update your package list to ensure you have the latest packages available. Run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\n<\/code><\/pre>\n\n\n\n<p>This command will fetch the latest package lists from the repository, making sure that you\u2019re about to install the latest version of UniFi.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-5-upgrade-the-unifi-controller\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-5-upgrade-the-unifi-controller\"><\/a>Step 5: Upgrade the UniFi Controller<\/h2>\n\n\n\n<p>With everything in place, it\u2019s time to update the UniFi Controller. Simply run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get upgrade unifi -y\n<\/code><\/pre>\n\n\n\n<p>This command will automatically upgrade your UniFi Controller to the latest version available in the repository. Depending on your internet speed and the size of the update, this might take a few minutes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-6-start-the-unifi-service\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-6-start-the-unifi-service\"><\/a>Step 6: Start the UniFi service<\/h2>\n\n\n\n<p>Once the update is complete, you\u2019ll need to start the UniFi service again. Run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start unifi\n<\/code><\/pre>\n\n\n\n<p>After starting the service, you can check its status again to ensure it\u2019s running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status unifi\n<\/code><\/pre>\n\n\n\n<p>It should say &#8220;active (running)&#8221; if everything went well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-7-verify-the-update\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#step-7-verify-the-update\"><\/a>Step 7: Verify the update<\/h2>\n\n\n\n<p>The final step is to verify that the update was successful. Log into your UniFi Controller dashboard and check the version number. It should now reflect the latest version.<\/p>\n\n\n\n<p>If everything is running smoothly, congratulations\u2014you\u2019ve successfully updated your UniFi Controller!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"troubleshooting-common-issues\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#troubleshooting-common-issues\"><\/a>Troubleshooting common issues<\/h2>\n\n\n\n<p>Sometimes things don\u2019t go exactly as planned. Here are a few common issues you might encounter during the update process and how to fix them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The controller won\u2019t start<\/strong>: If your UniFi Controller doesn\u2019t start after the update, check the logs for any errors. You can view the logs by running:<code>sudo journalctl -u unifi.service <\/code>Look for any errors that might indicate what went wrong.<\/li>\n\n\n\n<li><strong>Can\u2019t access the web UI<\/strong>: If you\u2019re unable to access the UniFi web interface after the update, ensure that the firewall isn\u2019t blocking port 8443, which is used by UniFi.<\/li>\n\n\n\n<li><strong>MongoDB issues<\/strong>: Sometimes MongoDB might not start correctly after an update. If this happens, try restarting MongoDB:<code>sudo systemctl restart mongodb <\/code>Then try starting the UniFi service again.<\/li>\n\n\n\n<li><strong>Roll back to a previous version<\/strong>: If all else fails and you need to roll back to the previous version, you can restore your backup with the following command:<code>sudo mongorestore --archive=\/var\/backups\/unifi_backup.archive <\/code>This will restore your UniFi Controller to the state it was in before the update.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"automating-updates-optional\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#automating-updates-optional\"><\/a>Automating updates (Optional)<\/h2>\n\n\n\n<p>If you prefer not to manually update your UniFi Controller every time there\u2019s a new release, you can automate the process. Here\u2019s a basic way to set it up:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create a bash script<\/strong>: Write a script that includes all the commands we\u2019ve just gone through. Save it to your server.<\/li>\n\n\n\n<li><strong>Set up a cron job<\/strong>: Use cron to schedule the script to run at regular intervals, for example, once a month. Here\u2019s how you can set up a cron job:<code>crontab -e <\/code>Add the following line to run the script at 2 AM on the first day of every month:<code>0 2 1 * * \/path\/to\/your\/script.sh <\/code>This will automate the update process and keep your\u00a0<a href=\"https:\/\/www.ui.com\/download\/unifi\">UniFi Controller<\/a>\u00a0up to date without any manual intervention.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"final-thoughts\"><a href=\"https:\/\/www.unihosted.com\/blog\/how-to-update-your-unifi-controller-on-ubuntu#final-thoughts\"><\/a>Final thoughts<\/h2>\n\n\n\n<p>Updating your UniFi Controller on Ubuntu doesn\u2019t have to be a chore. With this step-by-step guide, you can easily keep your network secure and running smoothly. Regular updates are essential to maintaining a reliable and safe environment, especially if you\u2019re managing multiple sites or handling sensitive data.<\/p>\n\n\n\n<p>And if you\u2019re tired of managing these updates yourself, consider using a hosting service like&nbsp;<a href=\"https:\/\/www.unihosted.com\/\">UniHosted<\/a>. We handle updates, backups, and monitoring for you, so you can focus on what really matters\u2014running your network efficiently.If you would like me to personally walk you through UniHosted, you can schedule a call with me&nbsp;<a href=\"https:\/\/calendly.com\/unihosted\/unihosted-interview\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Published onAugust 30, 2024by Iron&nbsp;(edited on&nbsp;November 20, 2024) Updating your&nbsp;UniFi Controller&nbsp;on Ubuntu is one of those tasks that seems intimidating at first, but once you get the hang of it, it\u2019s pretty straightforward. Whether you\u2019re running a small home network or managing multiple sites, keeping your UniFi Controller up to date is crucial for ensuring [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1703,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-1707","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1707"}],"version-history":[{"count":1,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1707\/revisions"}],"predecessor-version":[{"id":1708,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1707\/revisions\/1708"}],"up":[{"embeddable":true,"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=\/wp\/v2\/pages\/1703"}],"wp:attachment":[{"href":"https:\/\/helia.ee\/koolitus\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}