Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kennwhite/01cd1da9e2e6bfc86a95ac12637a3424 to your computer and use it in GitHub Desktop.
Save kennwhite/01cd1da9e2e6bfc86a95ac12637a3424 to your computer and use it in GitHub Desktop.
Reproducibly build MongoDB (7.0.0-rc0) from source on CentOS 9 Streams
# Reproducible CentOS 9 Streams install steps for mongod v. 7.0.0
# Cent 8 doesn't support g++-11.3
#
# NOT MEANT AS A TRUE SCRIPT -- SOME INTERACTION IS REQUIRED FROM PROMPTS
#
# THIS IN NO WAY IS OFFICIAL, OR REPRESENTS MongoDB Inc. USE AT YOUR OWN RISK
#
# Get ami # for official CentOS 9 Stream from https://www.centos.org/download/aws-images/
sudo yum -y update # Yes to import CentOS GPG keys
# gcc / g++ default versions on Cent9 are 11.3
sudo yum -y install gcc gcc-c++
sudo yum -y group install "Development Tools"
sudo yum -y install curl-devel python3-devel
# lld.x86_64 fixes: gcc warnings: std:hardware_destructive_interference_size assumed cache-line size 64 (which is 64 on all modern processors)
sudo yum -y install llvm llvm-devel clang lld.x86_64
sudo reboot
mkdir build1
cd build1
python --version
pip -V
pip3 -V
git clone https://github.com/mongodb/mongo.git
cd mongo
git checkout r7.0.0-rc0
# DISABLE SELINUX?
pip3 install -r etc/pip/compile-requirements.txt
time python3 buildscripts/scons.py install-mongod --disable-warnings-as-errors
# Executable has full debugging symbols, weighing in ~3GB, stripping symbols shrinks to 173MM
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 shutdown:
sudo killall mongod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment