Installing DMK
DMK first installation and setup.
This page describes how to install and configure DMK for the first time on a MongoDB server.
Unzipping DMK
Log in as the mongodb user using su - mongodb, and unzip DMK into the /u01/app/mongodb/local directory.
su - mongodb
unzip -oq dmk_mongodb-2.3.1.zip -d /u01/app/mongodb/localRunning dmk.sh for the first time
dmk.sh for the first timeThen, source the dmk.sh script with . /u01/app/mongodb/local/dmk/bin/dmk.sh script to initialize the environment. It will create the basic configuration files.
Warning Be sure to run . dmk.sh (with a leading dot) rather than dmk.sh to ensure that environment variables are properly set in the current shell session.
[mongodb@vm00 ~]$ . /u01/app/mongodb/local/dmk/bin/dmk.sh
[mongodb@vmdmk ~]$ . /u01/app/mongodb/local/dmk/bin/dmk.sh
2025-12-04 10:03:48 | INFO | DMK_HOME environment variable is not defined.
2025-12-04 10:03:48 | INFO | First time installation of DMK.
2025-12-04 10:03:48 | INFO | DMK has been extracted to /u01/app/mongodb/local/dmk
2025-12-04 10:03:48 | INFO | Using DMK_HOME=/u01/app/mongodb/local/dmk
2025-12-04 10:03:48 | INFO | Default configuration file '/u01/app/mongodb/local/dmk/etc/dmk.conf.default' does not exist. Creating it.
2025-12-04 10:03:48 | INFO | Copying template file '/u01/app/mongodb/local/dmk/templates/etc/dmk.conf.unix' to '/u01/app/mongodb/local/dmk/etc/dmk.conf.default'
2025-12-04 10:03:48 | INFO | Local configuration file does not exist. Creating it.
2025-12-04 10:03:48 | INFO | Copying template file '/u01/app/mongodb/local/dmk/templates/etc/dmk.conf.local.template' to '/home/mongodb/.dmk/dmk.conf.local'
2025-12-04 10:03:48 | INFO | Creating symlink '/u01/app/mongodb/local/dmk/etc/dmk.conf.local' to '/home/mongodb/.dmk/dmk.conf.local'
2025-12-04 10:03:48 | WARNING | MONGO_BASE environment variable is not set. Trying to retrieve it from DMK_HOME (/u01/app/mongodb/local/dmk).
2025-12-04 10:03:48 | WARNING | MONGO_BASE set to '/u01/app/mongodb' based on DMK_HOME location.
2025-12-04 10:03:48 | WARNING | If you're running DMK for the first time, you can ignore these warnings.
2025-12-04 10:03:48 | WARNING | Otherwise, please set MONGO_BASE in /home/mongodb/.DMK before sourcing DMK.
2025-12-04 10:03:48 | WARNING | File '/u01/app/mongodb/etc/mongodb.lst' does not exist. Creating an empty file.
2025-12-04 10:03:48 | INFO | Creating DMK source file at '/home/mongodb/.DMK' with the following content:
2025-12-04 10:03:48 | INFO | DMK_HOME=/u01/app/mongodb/local/dmk
2025-12-04 10:03:48 | INFO | PYTHON_BIN=/usr/bin/python3
2025-12-04 10:03:48 | INFO | MONGO_BASE=/u01/app/mongodb
2025-12-04 10:03:48 | WARNING | Please make sure to source the .DMK file in your shell profile (e.g., .bash_profile).
2025-12-04 10:03:48 | WARNING | An example is provided at /u01/app/mongodb/local/dmk/templates/profile/dmk.mongodb.profileAfter running this command, the DMK environment is loaded. In particular, an alias defined in dmk.sh allows you to reload the DMK environment at any time.
For future use of the DMK, you can just load the environment with dmk.
Files created at this point are :
$MONGO_BASE/etc/mongodb.lst: List of all MongoDB instances (empty at first).$DMK_HOME/etc/dmk.conf.default: Default configuration file for DMK. Do not modify this file, as it will be overwritten during DMK updates.~/.dmk/dmk.conf.local: Local configuration file for DMK. Changes made here overwrite default configuration.~/.DMK: File whereDMK_HOMEand the Python bin directory are defined. If yourMONGO_BASEvariable is different from$DMK_HOME/../.., then you should add a line to this file to specify your customMONGO_BASEvariable, and re-login to themongodbuser.
If you have a custom Python installation, please change the PYTHON_BIN variable.
Editing .bash_profile
.bash_profileNow, edit your .bash_profile file to add the function which will be used to source DMK environment at login, and to switch between instances. The template can be found under /u01/app/mongodb/local/dmk/templates/profile/dmk.mongodb.profile.
This .bash_profile will load DMK at login.
You can source .bash_profile to verify that the DMK environment is correctly loaded:
You have successfully completed the DMK installation process.
Last updated