MongoDB 4.4 & Ubuntu 20.04 on Raspberry Pi 4

Latest MongoDB on Raspberry Pi 4

Have a Raspberry Pi 4 with 4GB or 8GB of RAM and want to run the popular noSQL database, MongoDB? Read on for installing and running the latest 64-bit versions of MongoDB and Ubuntu 20.04.

The short (TL;DR) instructions are to read and follow the official install guides for 64-bit Ubuntu Server 20.04 and MongoDB 4.4 for ARM 64. The longer detailed instructions follow…

Installing Ubuntu Server 20.04

While you can download the Ubuntu Server 20.04 image from and manually copy to an SD Card or SSD, it is way easier to use the official Raspberry Pi Imager app. It is available for Windows, macOS, Ubuntu Linux and Raspberry Pi OS on the download page.

The Imager App asks you choose an OS and destination. Included in the OS choices is the top-level Ubuntu and sub-level Ubuntu 20.04.1 LTS, 64-bit server for arm64 architectures. Select this option for the OS and select your destination SD Card or USB hard drive or USB SSD. Click the WRITE button and confirm write and verify. You now have the bootable media with Ubuntu for your R-Pi 4.

Boot your R-Pi as normal. Note the username and password is “ubuntu” The OS comes with ssh enabled but does NOT configure WiFi – and the normal addition of files (ssh and wpa_supplicant.conf) to the boot partition does not work.

There are several guides, if you Google, that show you how to enable & configure WiFi under Ubuntu 20.04. I used this one from “Huobur:” How to Setup WiFi on Raspberry Pi 4 with Ubuntu 20.04 LTS 64-bit ARM Server. I’ve copied and pasted the most relevant part below. If you do not need WiFi and just use an ethernet connection, you can skip the WiFi configuration section.

WiFi configuration

1. You need 3 pieces of info in order to setup your WiFi:

  • Raspberry Pi wireless card name on your system;
  • WiFi router name you are trying to login (SSID), and
  • WiFi login password

You should already know your WiFi login name and password, the only info we need is WiFi name.

To clearly illustrate how to setup, let’s assume that your WiFi login name is “MyWiFi” and your password is “MyPass”.

2. Find WiFi card name:

$ ls /sys/class/neteth0 lo wlan0
on my machine, it’s “wlan0”. To simplify our demo, assume that yours is “wlan0” as well.

3. Edit, using nano or vi, the network configuration file to add WiFi info:

$ sudo vi /etc/netplan/50-cloud-init.yaml
After adding your WiFi info such that it should look something like the following:

# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
                dhcp4: true
                optional: true
        version: 2
                optional: true
                        password: "MyPass"
                dhcp4: true

4. Make sure that the 3 pieces of info above is replaced with yours.

And also please make sure that you are a very careful person to input the above info with exact format as original file started, and all indents should be typed with spaces (4 spaces each level), NOT tabs, which is very important!

5. Save the file and reboot

you should have your WiFi setup when the machine is up and running again.

Installing MongoDB 4.4

You can install MongoDB as any user with “sudo” permissions. My instructions assume user, “ubuntu” You can follow the install instructions for MongoDB Community Version 4.4 under Ubuntu 20.04 in the latest MongoDb 4.4 manual. I show my installation for R-Pi 4 below.

These instructions use the official mongodb-org package, which is maintained and supported by MongoDB Inc.

1. Import the public key used by the package management system

ubuntu@ubuntu:~$ wget -qO - | sudo apt-key add -

2. Create a list file for MongoDB

ubuntu@ubuntu:~$ echo "deb [ arch=amd64,arm64 ] focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

3. Reload local package database

ubuntu@ubuntu:~$ sudo apt-get update

4. Install the MongoDB packages

ubuntu@ubuntu:~$ sudo apt-get install -y mongodb-org

5. Check install and run

ubuntu@ubuntu:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: inactive (dead)

ubuntu@ubuntu:~$ sudo service mongod start

ubuntu@ubuntu:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2020-10-20 21:05:40 UTC; 58s ago
Main PID: 5030 (mongod)
CGroup: /system.slice/mongod.service
└─5030 /usr/bin/mongod --config /etc/mongod.conf

6. Launch the mongo shell to confirm good install

ubuntu@ubuntu:~$ mongo
MongoDB shell version v4.4.1
connecting to: mongodb://
Implicit session: session { "id" : UUID("9bba35f3-7edc-4f28-8063-975f46ca8463") }
MongoDB server version: 4.4.1
Welcome to the MongoDB shell.
For interactive help, type "help"



You can quit the mongo shell with the command, “exit”. You can start MongoDB via “service” commands using “sudo”.

sudo service mongod start

sudo service mongod stop

LMK if you have questions or issues in the comments.

3 thoughts on “MongoDB 4.4 & Ubuntu 20.04 on Raspberry Pi 4”

    1. Absolutely 🙂 I have had 4 R-Pi using replication without issue. I do recommend the R-Pi 4 w/ 4 or 8 GB RAM, using USB-3 SSDs (boot + data) and ethernet – for best performance. I will also say that performance on Intel vs. ARM is better – all other things being equal 😉

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top