|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Install MongoDB command line tools |
| 4 | + |
| 5 | +# We need to download MongoDB Database Tools to import data. In Linux we have two architectures: |
| 6 | +# Linux identifies as amd64, in MongoDB the file has ARM64 for Mac M1 |
| 7 | +# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2404-arm64-100.11.0.tgz |
| 8 | +# Linux identifies as aarch64, in MongoDB the file has x86_64 for intel |
| 9 | +# https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2404-x86_64-100.11.0.tgz |
| 10 | + |
| 11 | +export MONGO_TOOLS_VERSION=100.11.0 |
| 12 | +export ARCH=$(dpkg --print-architecture) |
| 13 | +if [ $ARCH = "amd64" ]; then export TARGET_ARCH="x86_64"; else export TARGET_ARCH="arm64"; fi |
| 14 | +export TARGET="mongodb-database-tools-ubuntu2404-${TARGET_ARCH}-${MONGO_TOOLS_VERSION}.deb" |
| 15 | +echo "Installing tools for architecture $ARCH, linux/${TARGET_ARCH}, target file=${TARGET}" |
| 16 | +echo "curl https://fastdl.mongodb.org/tools/db/${TARGET}" |
| 17 | +curl "https://fastdl.mongodb.org/tools/db/${TARGET}" --output "${TARGET}" |
| 18 | +apt-get install -y "./${TARGET}" |
| 19 | +rm "./${TARGET}" |
| 20 | + |
| 21 | +# Install mongosh |
| 22 | + |
| 23 | +# https://downloads.mongodb.com/compass/mongosh-2.4.0-linux-x64.tgz |
| 24 | +# https://downloads.mongodb.com/compass/mongosh-2.4.0-linux-arm64.tgz |
| 25 | + |
| 26 | +echo "Installing mongosh" |
| 27 | +if [ ARCH = "amd64" ]; then export MONGO_SHELL="mongosh-2.4.0-linux-x64"; else export MONGO_SHELL="mongosh-2.4.0-linux-arm64"; fi |
| 28 | +curl "https://downloads.mongodb.com/compass/${MONGO_SHELL}.tgz" --output "${MONGO_SHELL}.tgz" |
| 29 | +tar xvfz "${MONGO_SHELL}.tgz" |
| 30 | +rm "./${MONGO_SHELL}.tgz" |
| 31 | +cp mongosh-2.4.0-linux-arm64/bin/* /usr/local/bin/ |
| 32 | +rm -rf "./${MONGO_SHELL}" |
0 commit comments