You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

树莓派3安装MongoDB 3.6遇Exec Format error错误求助

Fix "Cannot execute binary file: Exec Format error" when installing MongoDB 3.6 on Raspberry Pi 3 (ARMv7l) with Ubuntu 16.04.2 LTS

Hey there, that error is a classic case of architecture mismatch! The MongoDB 3.6 binaries you tried to install are built for x86/x86_64 processors (the kind you’d find in regular desktops/laptops), but your Raspberry Pi 3 uses an ARMv7l CPU—they speak completely different "binary languages," so the system can’t run the x86 code.

Here are two solid solutions to get MongoDB 3.6 up and running on your ARMv7l Ubuntu setup:

Option 1: Compile MongoDB 3.6 from Source

Since MongoDB doesn’t provide official pre-built packages for ARMv7l, compiling from source is the most reliable approach:

  1. First, install all dependencies needed for compiling:
    sudo apt-get update && sudo apt-get install -y build-essential git cmake libssl-dev libsasl2-dev
    
  2. Clone the MongoDB repo and check out the stable 3.6 release (we’ll use 3.6.23, the last maintained version in the 3.6 series):
    git clone https://github.com/mongodb/mongo.git
    cd mongo
    git checkout r3.6.23
    
  3. Set up the build directory and configure CMake:
    mkdir build && cd build
    cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
    
  4. Start compiling—fair warning: the Pi 3 isn’t the fastest, so this could take 1-2 hours. Use -j4 to leverage all 4 cores:
    make -j4
    
  5. Install the compiled binaries to your system:
    sudo make install
    
  6. Verify it worked:
    mongod --version
    

Option 2: Use Community-Built ARM Precompiled Packages

If you don’t want to wait for compilation, some community members have built ARM-compatible packages for Ubuntu 16.04:

  1. Add the ARM-specific MongoDB repo to your sources:
    echo "deb [arch=armhf] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
    

    Note: ARMhf is fully compatible with ARMv7l, so this works for your Pi 3.

  2. Import MongoDB’s GPG key to verify package integrity:
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
    
  3. Update your package list and install the specific 3.6.23 version:
    sudo apt-get update
    sudo apt-get install -y mongodb-org=3.6.23 mongodb-org-server=3.6.23 mongodb-org-shell=3.6.23 mongodb-org-mongos=3.6.23 mongodb-org-tools=3.6.23
    
  4. Start and enable the MongoDB service:
    sudo systemctl start mongod
    sudo systemctl enable mongod
    
  5. Check the version to confirm:
    mongod --version
    

Quick Heads-Up

  • Ubuntu 16.04.2 LTS is pretty old, and MongoDB 3.6 is no longer supported. If you can, consider upgrading to a newer Ubuntu LTS release (like 20.04) for better ARM support and ongoing security updates.
  • If you hit memory issues during compilation, boost your Pi’s swap space temporarily:
    sudo fallocate -l 2G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    

内容的提问来源于stack exchange,提问作者Srinivas

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 07:05:10