skip to Main Content

I am trying to install mongodb on my Raspberry PI 4 model B running Debian 11.3.

First i tried to install it using apt-get by running the command sudo apt-get install mongodb but it result with the following error: E: Package ‘mongodb’ has no installation candidate.
After reading mongodb docs i found that it’s a known issue and it’s because the mobogdb package provided by Debian is not maintained by MonboDB Inc.

The second way i tried was from MongoDB docs https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/
Those are the steps from the tutorial:

  1. Import the MongoDB public GPG Key using the command wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
  2. Add the MongoDB repository to apt soruces list file using the command echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
  3. Run the command sudo apt-get update
    and got:
    Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
    Ign:2 https://repo.mongodb.org/apt/debian focal/mongodb-org/4.4 InRelease
    Ign:3 http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 InRelease
    Get:4 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]
    Hit:5 https://deb.nodesource.com/node_16.x bullseye InRelease
    Err:6 https://repo.mongodb.org/apt/debian focal/mongodb-org/4.4 Release
      404  Not Found [IP: 13.226.2.64 443]
    Hit:7 http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 Release
    Reading package lists... Done
    N: Ignoring file 'mongodb-org-4.0.lis' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
    E: The repository 'https://repo.mongodb.org/apt/debian focal/mongodb-org/4.4 Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    N: Skipping acquire of configured file 'main/binary-armhf/Packages' as repository 'http://repo.mongodb.org/apt/debian buster/mongodb-org/5.0 InRelease' doesn't support architecture 'armhf'
  1. Finally – Install mongodb with sudo apt-get install -y mongodb-org.

After complete all these steps i’ve got the error: Unable to locate package mongodb-org.

I have seen that this issue has been raised here before but i have not found a solution there.
MongoDB 4.4 / Raspberry Pi 4

I would like to get any assistent or referrences that could help me solving this issue.

3

Answers


  1. At the first, you need to install Docker engine on Raspberry Pi 4.
    Following commands:

    sudo apt update
    sudo apt upgrade   
    sudo reboot
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo bash get-docker.sh
    sudo usermod -aG docker $(whoami)
    sudo reboot
    docker version
    

    To create MongoDB container plz give me your O/S version name running on your Pi 4 and then I update this answer…
    anyway you can run this command:

    docker run -d -p 27017:27017 -v ~/data:/data/db --name mongo mongo:bionic
    

    try this command for arm64:

    docker run -d -p 27017:27017 -v ~/data:/data/db --name mongo arm64v8/mongo
    

    plz check this link:
    https://www.mongodb.com/docs/manual/administration/production-notes/?&_ga=2.245956420.1199726907.1655734879-88534791.1655618178#arm64

    Login or Signup to reply.
  2. I installed MongoDB on Raspberry Pi OS 64-bit (Raspberry Pi 4 model B) by this tutorial: https://linuxhint.com/install-mongodb-raspberry-pi/ and it worked for me.

    If you have original SD card, there is probably preinstalled 32-bit Raspberry Pi OS. But MongoDB doesn’t have 32bit packages for ARM architecture, so you need to install 64-bit operating system. I used "Raspberry Pi OS (64-bit)" (https://www.raspberrypi.com/software/operating-systems/) which should be based on Debian 11. But MongoDB doesn’t have Debian packeges for ARM 64 architecture, so I used Ubuntu package…

    In terminal:

    # update packages
    $ sudo apt update && sudo apt upgrade -y
    
    # add GPG key for MongoDB
    $ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    
    # add MongoDB repository
    $ 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
    
    # update source list
    $ sudo apt update
    
    # install MongoDB
    $ sudo apt install mongodb-org
    
    Login or Signup to reply.
  3. You can find cross-compilation instructions and unofficial MongoDB binaries on Github here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search