(**) Translated with www.DeepL.com/Translator
Update: Warning: this documentation is outdated.
Update 2021/01/28: This procedure also works for Raspberry PI4 with 64-bit RaspiOS.
The package mongodb-3.6.x Debian for arm64 does not exist in official repositories, the latest known version is 3.2 on the Debian stretch version. I will therefore present the procedure for compiling the project from Mongodb sources, as well as the method of making Debian packages for this release.
The second way to get MongoDb-3.6 on your Rock64 is described in the chapter “You don’t want to compile”
You want to compile
Prerequisites
Python 2.7 (already installed in the debian distribution)
Source recovery
Mongodb-3.6 sources are available herehttps://fastdl.mongodb.org/src/mongodb-src-r3.6.10.tar.gz
Mongodb-server (mongod) - arm64
Compilation
Connect “root” to the rock64 unit
apt install build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev libffi-dev
#Recover the sources
wget https://fastdl.mongodb.org/src/mongodb-src-r3.6.10.tar.gz
# Extracting sources
tar xfz mongodb-src-r3.6.10.tar.gz
# Enter the source directory
cd mongodb-src-r3.6.10
pip2 install -r buildscripts/requirements.txt
python2 buildscripts/scons.py core --ssl --use-s390x-crc32=off
Attention, the compilation procedure takes several hours!!!!!
Creating the Debian package
To be able to install mongodb-server on a unit, we will create a Debian package, which will be installable on any rock64 with a debian-strech distribution. The Mongodb project is delivered with the files necessary for Debian packaging.
cd /root/mongodb-src-r3.6.10
mkdir mongodb-org-server-3.6.10-arm64
cd mongodb-org-server-3.6.10-arm64
mkdir -p etc/init.d lib/systemd/system usr/bin usr/share/doc/mongodb-server-core usr/share/man/man1/ var/run/mongodb DEBIAN
cp ../mongod ../mongos usr/bin/.
chmod 755 usr/bin/*
gzip -c ../debian/mongod.1 > usr/share/man/man/man1/mongod.1.gz
gzip -c ../debian/mongos.1 > usr/share/man/man/man1/mongos.1.gz
cp ../debian/copyright usr/share/doc/mongodb-server-core/.
gzip -c ../debian/changelog > usr/share/doc/mongodb-server-core/changelog.Debian.gz
cp ../debian/init.d /etc/init.d/mongodb
cp ../debian/mongod.conf etc/.
cp ../debian/mongod.service lib/systemd/system/.
cp ../debian/mongodb-org-server.postinst DEBIAN/postinst
echo "systemctl stop mongod" > DEBIAN/prerm
echo "exit 0" >> DEBIAN/prerm
chmod 755 DEBIAN/postinst DEBIAN/prerm
We need a control file
vi DEBIAN/control
Add this content:
Package: mongodb-org-server
Version: 3.6.10
Source: https://fastdl.mongodb.org/src/mongodb-src-r3.6.10.tar.gz
Section: database
Priority: optional
Architecture: arm64
Maintainer: Ernie Hershey[ernie.hershey@mongodb.com](mailto:ernie.hershey@mongodb.com)
Build-Depends: adduser,lsb-base
Homepage: http://www.mongodb.org
Description: mongodb server
Save and exit: ESC :wq**
To create the package:
cd ...
dpkg-deb --build mongodb-org-server-3.6.10-arm64
Mongodb-client (mongo,…) - arm64
Compilation
cd /root/mongodb-src-r3.6.10
mkdir mongodb-org-client-3.6.10-arm64
cd mongodb-org- client -3.6.6.10-arm64
mkdir -p usr/bin usr/share/share/doc/mongodb-client usr/share/man/man/man1/ DEBIAN
cp ../mongo usr/bin/.
chmod 755 usr/bin/*
gzip -c ../debian/mongo.1 > usr/share/man/man/man1/mongo.1.gz
cp ../debian/copyright usr/share/doc/mongodb-client/.
gzip -c ../debian/changelog > usr/share/doc/mongodb-client/changelog.Debian.gz
We need a control file
vi DEBIAN/control
Add this content:
Package: mongodb-org-client
Version: 3.6.10
Source: https://fastdl.mongodb.org/src/mongodb-src-r3.6.10.tar.gz
Section: database
Priority: optional
Architecture: arm64
Maintainer: Ernie Hershey[ernie.hershey@mongodb.com](mailto:ernie.hershey@mongodb.com)
Build-Depends:
Homepage: http://www.mongodb.org
Description: client mongodb
Save and exit: ESC :wq**
To create the package:
cd ...
dpkg-deb --build mongodb-org- client -3.6.6.10-arm64
You don’t want to compile
If you don’t want to compile, you can still download (with the wget tool ["apt install wget" if not installed on your system]) the packages I created following the procedures described above :
Client : https://git.mytinydc.com/Mytinydc/mongodb-arm64-debian/raw/master/mongodb-org-client-3.6.10-arm64.deb (MD5SUM : 0fb4749de59e82e82acc88fedcae6093c28)
Server: https://git.mytinydc.com/Mytinydc/mongodb-arm64-debian/raw/master/mongodb-org-server-3.6.10-arm64.deb (MD5SUM : 8c94369a4e12e37538c02354c7be3e76)
cd /root
wget[url of the package, choice proposed above]
To check the integrity of the packages, use the command :
md5sum[name of the downloaded package]
then compare the value obtained with the indicated “MD5SUM” value of the packet to be checked.
Sources that allowed me to build these packages_:
https://fastdl.mongodb.org/src/mongodb-src-r3.6.10.tar.gz
Package installation
Once the packages have been created by you or downloaded from this site, you will use the command :
dpkg -i[Package name.deb]
Packages you have created:
cd[directory where the.deb files are available]
dpkg -i mongodb-org-server-3.6.10-arm64.deb
dpkg -i mongodb-org-client-3.6.10-arm64.deb
**Packages downloaded: **
cd[directory for downloading.deb files]
dpkg -i dl-mongodb-org-server-3.6.10-arm64.deb
dpkg -i dl-mongodb-org-client-3.6.10-arm64.deb
Starting the server
systemctl start mongod
Check the correct start by consulting the log:
tail -f /var/log/mongodb/mongod.log
To exit this command: CTRL+C
And you get suggestions for tuning the kernel……. a temporary application will be:
echo never > /sys/kernel/mm/transparent_hugepage/defrag
You can apply this rule to server startup by adding :
kernel/mm/transparent_hugepage/enabled = never
at the end of the file /etc/sysfs.conf
Server shutdown
systemctl stop mongod
Mongodb-tools (mongodump, mongorestore) - arm64
We’re not going to compile anything, and just install the existing package for Debian (version 3.2):
apt install mongo-tools
(**) be careful this last instruction may not work, some users have had problems since the release of mongodb Version 4
Compilation
Mongodb tools, such as mongodump, mongorestore,… have been rewritten in GO language. The sources are available herehttps://github.com/mongodb/mongo-tools
The file “README.md” of this repository explains how to compile these tools. But you’re going to have to adapt the instructions:
apt install golang golang-go.tools libpcap0.8-dev build-essential
cd /opt
mkdir -p src/github.com/mongodb/
cd src/github.com/mongodb/
git clone https://github.com/mongodb/mongo-tools
cd mongo-tools
export GOROOT=/usr/lib/go-1.11/;export CC=gcc;./build.sh
Create the Debian package
cd /opt/src/github.com/mongodb/mongo-tools
mkdir mongodb-org-tools-arm64
cd mongodb-org-tools-arm64/
cp ../bin/* usr/bin/.
chmod 755 usr/bin/*
We need a control file
vi DEBIAN/control
Add this content:
Package: mongodb-org-tools
Version: 2019.03.26
Source: https://github.com/mongodb/mongo-tools
Section: database
Priority: optional
Architecture: arm64
Maintainer: https://github.com/mongodb/mongo-tools
Build-Depends:
Homepage: https://github.com/mongodb/mongo-tools
Description: mongodb tools
Save and exit: ESC: wq
To create the package:
cd ...
dpkg-deb --build mongodb-org-tools-arm64
If you don’t want to compile, download the Debian package I created: https://git.mytinydc.com/Mytinydc/mongodb-arm64-debian/raw/master/mongodb-org-tools-arm64.deb
Debian package installation
Package you created: **Package you created: **
cd[directory where the.deb files are available]
dpkg -i mongodb-org-tools-arm64
**Package downloaded: **Package downloaded: **
cd[directory for downloading.deb files]
dpkg -i dl-mongodb-org-tools-arm64
Security
CAUTION: by default mongodb listens to the local address 127.0.0.0.1 and therefore does not have any access security settings. Only processes hosted on this machine have access to Mongodb databases. If you need to change this configuration, refer to the many documents related to the security of Mongodb servers.
Document licence : Creative Commons (CC BY-NC-ND 4.0)
THIS DOCUMENTATION IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND AND DISTRIBUTED FOR EDUCATIONAL PURPOSES ONLY. THE AUTHOR, CONTRIBUTORS TO THIS DOCUMENTATION OR ©MYTINYDC.COM SHALL IN NO EVENT BE LIABLE FOR ANY DIRECT OR INDIRECT DAMAGE THAT MAY RESULT FROM THE APPLICATION OF THE PROCEDURES IMPLEMENTED IN THIS DOCUMENTATION, OR FROM THE INCORRECT INTERPRETATION OF THIS DOCUMENT.