Hello,
I want to setup a mongo DB inside a Khadas VIM3 board, with Ubuntu 20.04. I want to implement MongoDB as the database for my C++ program.
Khadas boards have arm64 architecture
These are the steps I followed:
Installation of drivers
According to mongo’s official manual for mongo C++, I started installing drivers for C, then for cxx.
- I started by installing libmongoc driver
apt-get --no-install-recommends install libmongoc-dev
apt-get --no-install-recommends install cmake
I see this warning, judged it not critical (I am no expert, please don’t value my judgement ):
/sbin/ldconfig.real: /lib/ is not a symbolic link
sudo apt-get --no-install-recommends install libssl-dev
sudo apt-get --no-install-recommends install libsas12-dev
mkdir downloads/installers
cd downloads/installers
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.24.4/mongo-c-driver-1.24.4.tar.gz
tar xzf mongo-c-driver-1.24.4.tar.gz
cd mongo-c-driver-1.24.4
mkdir cmake-build
cd cmake-build
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
- My g++ is based in c++14, so I chose polyfill MNMLSTC, adding " -DBSONCXX_POLY_USE_MNMLSTC=1 " cmake option
I installed libmongocxx driver
- Executing “apt-cache policy libmongoc-dev”, I get “Installed: 1.16.1-1build2”. Given compatibility table, I go for mongocxx-3.5.x
curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.5.1/mongo-cxx-driver-r3.5.1.tar.gz
tar -xzf mongo-cxx-driver-r3.5.1.tar.gz
cd mongo-cxx-driver-r3.5.1/build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBSONCXX_POLY_USE_MNMLSTC=1
As I’m using MNMLSTC
sudo cmake --build . --target EP_mnmlstc_core
Polyfill successfully installed, let’s build and install cxx driver:
cmake --build .
sudo cmake --build . --target install
I have all the logs from this, stored using ubuntu’s “script” command. I can provide them if necessary.
Thank you for taking your time to read and maybe help me, you are wonderful. Let’s keep going.
Installation of MongoDB 4.4
Following https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-ubuntu/
´´´
sudo apt-get install gnupg curl
echo “deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-4.4.gpg ] MongoDB Repositories focal/mongodb-org/4.4 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org=4.4.24 mongodb-org-server=4.4.24 mongodb-org-shell=4.4.24 mongodb-org-mongos=4.4.24 mongodb-org-tools=4.4.24
echo “mongodb-org hold” | sudo dpkg --set-selections
echo “mongodb-org-server hold” | sudo dpkg --set-selections
echo “mongodb-org-shell hold” | sudo dpkg --set-selections
echo “mongodb-org-mongos hold” | sudo dpkg --set-selections
echo “mongodb-org-tools hold” | sudo dpkg --set-selections
´´´
No errors returned (appart from “/sbin/ldconfig.real: /lib/ is not a symbolic link” )
My system uses systemctl, so:
´´´
khadas@Khadas:~$ sudo systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: signal) since Thu 2023-09-14 09:50:34 UTC; 13s ago
Process: 8600 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=killed, signal=ILL)
Main PID: 8600 (code=killed, signal=ILL)
Sep 14 09:50:34 Khadas systemd[1]: Started MongoDB Database Server.
Sep 14 09:50:34 Khadas systemd[1]: mongod.service: Main process exited, code=killed, status=4/ILL
Sep 14 09:50:34 Khadas systemd[1]: mongod.service: Failed with result ‘signal’.
´´´
Configuration tweaks
I checked “ulimit -a”. It seems fine, but this is not a performance issue.
I see there’s no log file created, so I modify /etc/mongod.conf to raise log verbose. Still no log file created.
If you reached this point, I admire your effort. Thank you
May you have a great day.
Gabriel