Mongod 4.4 on RPi4 aarch64 (Arch) (for Unifi)

This topic is just to let people know that it is relatively straight-forward to get Mongod 4.4 running on Raspberry Pi 4 and aarch64 (Arch Linux). I am using the database the Unifi Controller at home. I would have posted this information into an older topic but it was already closed:

I was initially on a 32-bit system so first replaced it with aarch64 (Arch). I then built gcc-8.3.0 using the script here:

I renamed the binaries to gcc-8 and g+±8 and put them in /usr/local/bin.

Next I followed the native build instructions as posted by Andrew. During the build I ran into two issues. The first was an out of memory situation, and I had to increase the amount of swap space (1GB was not enough in my Pi with 4GB RAM). The second was a kernel panic due to high disk I/O. I used “vm.dirty_background_ratio = 5” and “vm.dirty_ratio = 10” to get things proceeding. It took well overnight with files (23G) on a USB hard drive. My well-enclosed RPi runs very hot so the CPU was probably throttling most of the time.

I downloaded Unifi from the AUR repositories, and removed “mongod” from the dependencies in PKGBUILD to get it to install. Once this was done I updated /usr/lib/unifi/bin/mongod to reflect the actual location of the mongod binary. For other newbies like me I might add that Unifi wants to start its own mongod instance. I first fired up one of my own but as soon as I also started the Unifi service it issued a shutdown command to the database.

Thank you Andrew for the information you posted in the previous thread.

1 Like