Last active
February 7, 2024 06:04
-
-
Save kennwhite/47d477eac4717e4d21b33536ebfc7dea to your computer and use it in GitHub Desktop.
Reproducibly build MongoDB (7.0.0-rc0) from source on Debian 11 Bullseye
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reproducible Debian 11 install steps for mongod v. 7.0.0 (defaults to gcc/g++ v 12, not 11, which requires more steps) | |
# NOT MEANT AS A TRUE SCRIPT -- SOME INTERACTION IS REQUIRED FROM PROMPTS | |
# DO NOT DO run apt get autoremove !!! | |
# | |
# THIS IN NO WAY IS OFFICIAL, OR REPRESENTS MongoDB Inc. USE AT YOUR OWN RISK | |
# | |
# Get ami # for Debian 11 Bullseye, from: https://wiki.debian.org/Cloud/AmazonEC2Image/Bullseye | |
echo 'deb http://http.us.debian.org/debian/ testing non-free contrib main' | sudo tee -a /etc/apt/sources.list >/dev/null | |
sudo apt -y update | |
# Accept defaults to chrony questions ("No", "ssh...", "Keep...") | |
sudo apt -y install libcurl4-openssl-dev liblzma-dev git | |
sudo apt -y install clang-13 lld-13 llvm-13-dev | |
sudo apt -y install python3 python3-dev python-dev-is-python3 libssl-dev python3-pip | |
sudo apt -y install build-essential | |
# sudo apt -y remove g++-12 gcc-12 # Not necessary with gcc/g++ 11 soft links | |
sudo apt -y install g++-11 # will also pick up gcc-11 | |
sudo ln -sf '/usr/bin/g++-11' '/usr/bin/g++' | |
sudo ln -sf '/usr/bin/gcc-11' '/usr/bin/gcc' | |
sudo mv /usr/lib/python3.11/EXTERNALLY-MANAGED /usr/lib/python3.11/EXTERNALLY-MANAGED-orig | |
mkdir build1 | |
cd build1 | |
git clone https://github.com/mongodb/mongo.git | |
cd mongo | |
git checkout r7.0.0-rc0 | |
pip3 install -r etc/pip/compile-requirements.txt | |
python3 buildscripts/scons.py install-mongod --disable-warnings-as-errors LINKFLAGS=-B/usr/lib/llvm-13/bin | |
mv ./build/install/bin/mongod ./build/install/bin/mongod-debug | |
objcopy --strip-debug ./build/install/bin/mongod-debug ./build/install/bin/mongod | |
cd ./build/install | |
rm -rf ./dbfiles | |
rm -rf ./dblogs | |
mkdir ./dbfiles | |
mkdir ./dblogs | |
./bin/mongod --fork --replSet rs0 --dbpath ./dbfiles --bind_ip 0.0.0.0 -port 27017 --logpath ./dblogs/mongod.log | |
# from mongosh: | |
rs.initiate() | |
# to stop db: | |
killall mongod | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment