How to Install Mongodb on a Raspberry Pi 3

This site contains affiliate links to products. We may receive a commission for purchases made through these links.

The Raspberry Pi is an amazing piece of software that was launched in 2012. Since then, the brand has been working on upgrades and has now come up with newer models of the software.

x
What to Do with a Raspberry Pi 4

Now, the newer versions of the Raspberry Pi feature built-in Wi-Fi and can be used as prototyping computers for the Internet of Things (IoT) or in home automation appliances, among other things.

Currently, the recent versions of the Raspberry Pi run on a 64-bit operating system. This means that the software is now able to support and run software with 64-bit versions, which is an enhancement in its functionality.

Because of its advancement, the Raspberry Pi 3 or Pi 4 can now run databases such as the MongoDB, which is a NoSQL database that stores data in document form by using a schema that’s semi-structured in nature.

In this guide, you’ll learn the installation process of MongoDB on the Raspberry Pi 3. Read on to get more informed on the matter.

Required Items

  • R-Pi 3
  • Micro SD Memory Card (16 GB or higher)
  • SD Card reader
  • A computer
  • And software for editing text

Now that you have all of what you need, you should first get started with installing Ubuntu.

How to Install Ubuntu

On the host computer, first download and then install the Imager for the Raspberry Pi. After installing the Raspberry Pi Imager, the next thing to do is to run it and select the Ubuntu 20.4.1 LTS 64-Bit Server for the R-Pi 3.

When selecting the servers, ensure that you don’t accidentally choose the 32-bit model of the Ubuntu software. Once you’ve chosen the right version, proceed to inserting the must-have memory card. Next you’ll access the window for the Raspberry Pi Imager and select the inserted and now visible Micro SD Card.

On the same window, there is a ‘write’ tab, which you will click and have some patience while the image is being written on the Micro SD Card. Note that this process will consume some time, which is why there was an emphasis on patience.

Once the process is done, close the Imager and then eject the memory card from the host computer. After doing that, you’ll then have to re-insert the memory card back to your computer.

Here’s why you are doing that – the Ubuntu image for the R-Pi 3 configures the network at boot-time with the help of Cloud-init. Cloud-init is a multi-distribution industry approved method for cross-platform cloud instance initialization.

It means that your Micro SD memory card now contains the YAML file termed as the network-config. The YAML file needs to be opened by a text editor, which can be any that you are accustomed to.

In the text editor, you’ll edit the file in the following way:

  • Go to the ‘wifis’ section of the text
  • Now, proceed down to the access points where you’ll find ‘YOUR-WIFI-SSD’
  • Change the ‘YOUR-WIFI-SSD’ to your Wi-Fi’s name
  • Moving forward, replace the ‘YOUR-WIFI-PASSWORD’ text with your Wi-Fi password

Once through, you’ll have successfully edited the file’s indentation so that it matches your Wi-Fi configuration. Next you’ll eject the Micro SD Card from the host computer before removing it, which is the safest way to do it.

Now, insert the SD Card into the Raspberry Pi then turn it on. And because it’s the first time, starting up will eat up some minutes. Once fully on, it will still take the Raspberry Pi 3 a few minutes to connect. At this time, you’ll be closely monitoring your network.

After the Pi connects, you have to SSH to the Raspberry Pi 3 in the following manner:

  • SSH – ubuntu@raspberry-pi-pi-address>
  • Password – ubuntu

Immediately after that process, a new window pops up where you can change the password in your preferences. After setting your password of liking, you’ll then update the Raspberry Pi 3 operating system with the following codes:

  • Sudo apt upgrade
  • Sudo apt upgrade

The next thing that follows is to install MongoDB on the Raspberry Pi 3.

How to Install Mongodb on a Raspberry Pi 3

Installing the MongoDB on Raspberry Pi 3

Note that the following instructions are obtained from Install MongoDB Community Edition on Ubuntu.

So, here’s how to install MongoDB on Raspberry Pi 3:

Step 1 – Installing the MongoDB GPG 4.4 key using the following command list:

wget -qO – https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add –

Step 2 – Add a location source for the packages of the MongoDB:

echo “deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

Step 3 – Downloading package details for the packages in MongoDB:

sudo apt-get update

Step 4 – Installing MongoDB database:

sudo apt-get install -y mongodb-org

Start MongoDB

After successfully installing MongoDB on your Raspberry Pi 3, the next step is launching it. And because the Ubuntu 20.04 version used here relies on Systemd for running background services, you need to set it up so for background running.

This can be achieved using the command list below:

sudo systemctl start mongod

The command will start running the MongoDB right away and if not, you’ll get something like – ‘Failed to start mongod.service: Unit mongod.service not found.’ Not to worry, if you experience such type in the following directives:

sudo systemctl daemon-reload

And after doing that, you can ascertain if the MongoDB has launched successfully by using the following command list:

sudo systemctl status mongod

Parting words

So, there you have it! The above instructions are the correct steps on how to install MongoDB on Raspberry Pi 3. At first, the process might be a bit intimidating. And even if you’ve done it before, it might still be uneasy when you decide to do it again after sometime.

Therefore, this guide paid utmost attention to the basics first and followed by showing you step-by-step installation steps. The steps are relatively few and properly explained, meaning that you are in the right hands when reading this piece.

Hopefully this guide will make it easy for you to be able to install MongoDB on Raspberry Pi.

Special offer for our visitors

Get your Soldering Iron Guide For DIYERS

We will never send you spam. By signing up for this you agree with our privacy policy and to receive regular updates via email in regards to industry news and promotions