Category Archives: Raspberry Pi

Compile MongoDB Embedded 4.2.1 on Raspberry Pi 4

Recently, I'm planning a new tiny project which can run on a Raspberry Pi 4. Well, actually, it can run anywhere, but given that I already bought a Raspberry Pi 4, why not have some fun on that♪(´ε` )

After considerations, a NoSQL database will be used for this project. And I opt for MongoDB. Although there is a MongoDB on Raspbian repo, the version of that is too old -- it's MongoDB 2.4, whereas the newest version is 4.2.1.

Therefore, to ensure that there won't be too many changes because of the updates of MongoDB in the future, let's use the latest version of MongoDB~ And of course, there will be a long time to compile MongoDB on Raspberry Pi. ( ;´Д`)

At the time of writing, the release version of Raspbian on my Raspberry Pi 4 is

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

To prepare the compile environment is not really time-consuming, but it will take several hours to do the actual compiling. Anyway, you can faff around while compiling. (*^3^)

  1. apt install dependencies
  2. pip3 install dependencies
  3. Compile Mongo C Driver
  4. Compile and Install MongoDB
Continue reading Compile MongoDB Embedded 4.2.1 on Raspberry Pi 4

在树莓派 4 上编译安装 MongoDB Embedded 4.2.1

最近想了一个可以跑在树莓派上的新坑,其实也可以跑在别的地方啦,不过既然都买了新的 Raspberry Pi 4 的话,就拿着折腾一下吧(◐‿◑)。

然后这个新坑我计划需要用到 NoSQL 数据库,最后决定选择 MongoDB。 Raspbian 上虽然有自带的 MongoDB,但是已经相当久远了,还停留在 MongoDB 2.4 版本。

emmmmm,为了确保这个项目以后不会经常因为 MongoDB 的版本更新做改动,那就尽量用最新的 MongoDB 版本吧。于是就要在 Raspberry Pi 上开始漫长的编译啦( ;´Д`)

在写这篇 post 时,我的 Raspbian 系统版本如下

$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

前期准备工作的时间并不算长,但是编译的时间大概就得好几个小时了∑(゚Д゚)不过编译的时候正好摸鱼hhhhhhh

  1. apt 安装依赖
  2. pip3 安装依赖
  3. 编译安装 Mongo C Driver
  4. 编译安装 MongoDB

简单来说就是以上 4 步啦~

Continue reading 在树莓派 4 上编译安装 MongoDB Embedded 4.2.1