Install MongoDB for integration with DMK

Create user

Commands are executed as the mongodb user.

root $ groupadd mongodb -g 1500
root $ useradd --uid  1500 -d /home/mongodb -g mongodb  -m -s /bin/bash -p $(openssl passwd mongodb) mongodb

Create directory layout (change the version number)

The variables $MONGODB_BASE, $MONGODB_LOG and $MONGODB_BACKUP are defined in $DMK_HOME/etc/dmk.conf

Variable
Default Value

MONGODB_BASE

/u01/app/mongodb

MONGODB_LOG

/u02/mongodblog

MONGODB_BACKUP

/u90/backup

On the server, it is recommended to have the directories (mount points) as follows:

  • /u01 : contains the DMK installation and MongoDB binaries.

  • /u02 : contains the database files and logs.

  • /u90 : contains the backups.

export MONGODB_BASE=/u01/app/mongodb
export MONGODB_LOG=/u02/mongodblog
export MONGODB_BACKUP=/u90/backup
mkdir -p $MONGODB_BASE
mkdir -p $MONGODB_BASE/local
mkdir -p $MONGODB_BASE/admin
mkdir -p $MONGODB_BASE/etc
mkdir -p $MONGODB_BASE/product
mkdir -p $MONGODB_BASE/artifacts
mkdir -p /u02/mongodbdata
mkdir -p $MONGODB_LOG
mkdir -p $MONGODB_BACKUP
chown -R mongodb: /u01/
chown -R mongodb: /u02/
chown -R mongodb: /u90/

Packages install

The packages may change, depending on the MongoDB version. See documentation for packages requirements.

See https://www.mongodb.com/docs/manual/installation/ and https://www.mongodb.com/docs/manual/administration/install-on-linux/ for detailed information.

To download packages, see https://www.mongodb.com/try/download/community.

🟡 NOTE:

  • The packages listed in the wget command are for Ubuntu. Adapt the package list for your OS.

  • Some additional packages can be needed (RPM or APT, depending on your OS type). Please check the documentation to find the right packages.

Commands are executed as the mongodb user.

root@dev-vm:~$ sudo su - mongodb
mongodb@dev-vm:~$ export MONGODB_BASE=/u01/app/mongodb
mongodb@dev-vm:~$ cd $MONGODB_BASE/artifacts
# get files for MongoDB 8.0 (this is an example, change-it following the version used)
mongodb@dev-vm:~$ wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-{os_version}-8.0.4.tgz
mongodb@dev-vm:~$ wget https://downloads.mongodb.com/compass/mongosh-{version}-linux-x64.tgz
mongodb@dev-vm:~$ wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-{os_version}-x86_64-100.10.0.tgz

mongodb@dev-vm:~$ ls -l
-rw-r--r-- 1 mongodb mongodb 54047120 Jan 14 10:11 mongodb-database-tools-{os_version}-x86_64-100.10.0.tgz
-rw-r--r-- 1 mongodb mongodb 39047168 Jan 14 10:10 mongodb-linux-x86_64-{os_version}-8.0.4.tgz
-rw-r--r-- 1 mongodb mongodb 82047119 Jan 14 10:10 mongosh-{version}-linux-x64.tgz

Uncompress archives

mongodb@dev-vm:~$ cd $MONGODB_BASE/artifacts
mongodb@dev-vm:~$ mkdir /u01/app/mongodb/product/8.0
mongodb@dev-vm:~$ for f in *.tgz; do tar -xvzf $f -C /u01/app/mongodb/product/8.0   ; done
mongodb@dev-vm:~$ ls -l /u01/app/mongodb/product/8.0
total 12
drwxr-xr-x 3 mongodb mongodb 4096 Jan 14 10:23 mongodb-database-tools-ubuntu2204-x86_64-100.10.0
drwxr-xr-x 3 mongodb mongodb 4096 Jan 14 10:23 mongodb-linux-x86_64-ubuntu2204-8.0.4
drwxr-xr-x 3 mongodb mongodb 4096 Dec 30 23:03 mongosh-2.3.8-linux-x64

Commands are executed as the mongodb user.


mongodb@dev-vm:~$ mkdir /u01/app/mongodb/product/8.0/bin/
mongodb@dev-vm:~$ find $MONGODB_BASE/product/8.0/ -executable -type f -exec ln -s {} $MONGODB_BASE/product/8.0/bin/ ';'
mongodb@dev-vm:~$ ls -l $MONGODB_BASE/product/8.0/bin/
rwxrwxrwx 1 mongodb mongodb 91 Jan 14 10:26 bsondump -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/bsondump
lrwxrwxrwx 1 mongodb mongodb 86 Jan 14 10:26 install_compass -> /u01/app/mongodb/product/8.0/mongodb-linux-x86_64-ubuntu2204-8.0.4/bin/install_compass
lrwxrwxrwx 1 mongodb mongodb 77 Jan 14 10:26 mongod -> /u01/app/mongodb/product/8.0/mongodb-linux-x86_64-ubuntu2204-8.0.4/bin/mongod
lrwxrwxrwx 1 mongodb mongodb 92 Jan 14 10:26 mongodump -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongodump
lrwxrwxrwx 1 mongodb mongodb 94 Jan 14 10:26 mongoexport -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongoexport
lrwxrwxrwx 1 mongodb mongodb 93 Jan 14 10:26 mongofiles -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongofiles
lrwxrwxrwx 1 mongodb mongodb 94 Jan 14 10:26 mongoimport -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongoimport
lrwxrwxrwx 1 mongodb mongodb 95 Jan 14 10:26 mongorestore -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongorestore
lrwxrwxrwx 1 mongodb mongodb 77 Jan 14 10:26 mongos -> /u01/app/mongodb/product/8.0/mongodb-linux-x86_64-ubuntu2204-8.0.4/bin/mongos
lrwxrwxrwx 1 mongodb mongodb 64 Jan 14 10:26 mongosh -> /u01/app/mongodb/product/8.0/mongosh-2.3.8-linux-x64/bin/mongosh
lrwxrwxrwx 1 mongodb mongodb 76 Jan 14 10:26 mongosh_crypt_v1.so -> /u01/app/mongodb/product/8.0/mongosh-2.3.8-linux-x64/bin/mongosh_crypt_v1.so
lrwxrwxrwx 1 mongodb mongodb 92 Jan 14 10:26 mongostat -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongostat
lrwxrwxrwx 1 mongodb mongodb 91 Jan 14 10:26 mongotop -> /u01/app/mongodb/product/8.0/mongodb-database-tools-ubuntu2204-x86_64-100.10.0/bin/mongotop

Last updated