# Using PowerShell to fix Ubiquiti Unifi requirement for MongoDB 3.6 on Ubuntu 18

Use PowerShell on Ubuntu 18 to patch UniFi .deb packages that reject MongoDB 3.6, reducing the manual steps needed after upgrades.

blog

11 Mar 2019 de

![Using PowerShell to fix Ubiquiti Unifi requirement for MongoDB 3.6 on Ubuntu 18](/wp-content/uploads/2019/03/img_5c86bcf499692.png)

[Bilder ansehen (2)](#pf-content-image-1-0)

I've been using **Ubiquiti Unifi** for some years now, for both home and work usage. It's great hardware at a great price, and the best thing for a software maniac like me is that it's continuously updated. Some time ago I upgraded **Ubuntu to 18.04**, and things went a bit sideways. You see **Unifi** started to add to their DEB packages that Mongo 3.6 is not supported and therefore blocking any installation. The idea is, it works perfectly fine on **MongoDB 3.6** but migration between 3.4 to 3.6 is just not straightforward. Long story short when I upgraded Ubuntu I was suddenly greeted with not working **Unifi**. I've fixed that, and blogged about it how you can do so using manual steps – [Ubuntu 18.04 – Fixing Unifi .deb package to run with 3.6](https://evotec.xyz/ubuntu-18-04-fixing-unifi-deb-package-to-run-with-3-6-mongodb/)MongoDB. The thing is with each new version out I have to do multiple steps to fix every single package from **Unifi** (you see where I'm going right?). While a few years ago I would be stuck to use bash or some other workaround which would be a pain for me, this is **2019**, and **PowerShell Core** works excellent on Linux systems! I know that installing PowerShell Core for hardcore Linux fans may not be as fun as it is for me, but you do get a lot of benefits from it.

### 💡 Installing PowerShell Core on Ubuntu

If you don't have PowerShell available on your **Ubuntu** machine you can easily install this using **Microsoft** recommended steps. Those are below. If you have a different version of the system and you want to give PowerShell Core a try you can find instructions on **[Installing PowerShell Core on Linux](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6)** on Microsoft website.

```powershell
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell
```

### 💡 Starting PowerShell Core on Ubuntu and Installing PSUnifi

If you already have **PowerShell** installed, you can simply start **PowerShell Core**

```powershell
# Start PowerShell
pwsh
```

As with most of my scripts, this one is available as **PowerShell** module and can be installed from **PowerShellGallery**.

```powershell
Install-Module PSUnifi

# For updates in case there will be updates to my module
# Update-Module PSUnifi
```

**Full sources** are available on **[GitHub](https://github.com/EvotecIT/PSUnifi)**.

### 💡 Using Repair-UnifiPackage to remove MongoDB dependencies from package

Usage is straightforward. Just type command and give the **URL** parameter to a deb package. It will **download** the package to a temporary directory, **unpack** it,** fix dependencie**s, **pack** it and **save** in temporary location for installation purposes.

```powershell
Repair-UnifiPackage -Url 'https://dl.ubnt.com/unifi/5.10.20-b06c46ec1d/unifi_sysvinit_all.deb'
```

[!\[Repair-UnifiPackage\](/wp-content/uploads/2019/03/img_5c86bb6b60e91.png)](/wp-content/uploads/2019/03/img_5c86bb6b60e91.png)

You get **a fixed** package that no longer requires **MongoDB 3.4** and can be installed with **MongoDB 3.6**. What's left is installing **the Unifi** package in the system. You then simply take the path where fixed unifi package is located and follow with the installation. Keep in mind the paths are random in the temp folder. They change on each run.

```powershell
dpkg -i /tmp/cmjsbmswargce/unifi-package-fixed.db
```

[!\[dpkg -i unifi\](/wp-content/uploads/2019/03/img_5c86bcf499692.png)](/wp-content/uploads/2019/03/img_5c86bcf499692.png)

And voila! We've got upgraded **Unifi instance**. As you can notice above I've downloaded 5.10.20 stable candidate first but decided it's better to go with **Stable version** instead.

## Zugehörige Projekte

Projekte, die zu Tags, Kategorien und Inhalt dieses Beitrags passen.

[Alle Projekte](/de/projekte/)

Projekte werden abgeglichen...

[Zurück zum Blog](/blog)

## Ähnliche Beiträge

- [Ubuntu 18.04 – Fixing Unifi .deb package to run with 3.6 mongodb](/de/blog/ubuntu-18-04-fixing-unifi-deb-package-to-run-with-3-6-mongodb/)
- [Track Ubiquiti Unifi Stock, and get notified of changes](/de/blog/simplify-notifications-about-ubiquiti-unifi-stock/)
- [Image Manipulation, Image Resize, Image Combine and more with PowerShell](/de/blog/image-manipulation-image-resize-image-combine-and-more-with-powershell/)

<!-- PowerForge markdown artifact sha256:359F579061EDFD8B056FC22153E9BA1A2AE1EF236BDCDEFAD110A575651CD8EA -->
